Skip to content

Using non Element Components for the Badge component #1058

@aquacash5

Description

@aquacash5

I am trying to write a PriorityBadge

I expected it to render a badge with an elevation shadow. However, on iOS it doesn't render the shadow.

Expected
prioritybadge

iOS Render:
prioritybadge noelevation

I see that it is failing here on line 40 of src/badge/badge.js.

if (React.isValidElement(component)) {
  Component = component;
}

Why does this have to be an Element? Why not let it be any Component?

I would suggest something like this for the Component creation

let Component = View;

if (component) {
  Component = component
} else if (onPress) {
  Component = TouchableOpacity
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions