Skip to content

Warning: Failed prop type: Invalid prop activeTextStyle of type array supplied to Switch, expected object #91

@benomatis

Description

@benomatis

I know this warning is being shown as PropTypes of style props are set to object and I used an array (as is common in React Native to define styles), but the interesting thing is that the styles I applied this way would still work.

I first thought I'd just submit a PR and turn this...

activeTextStyle: PropTypes.object,

...into this...

activeTextStyle: PropTypes.oneOfType([
  PropTypes.object,
  PropTypes.array
]),

...but I was wondering if it would actually cause issues as it's being used like this further down:

<Text style={[styles.text, styles.paddingRight, activeTextStyle]}>
{activeText}
</Text>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions