Skip to content

Warning: Failed prop type: Invalid prop textMessage supplied to SnackbarComponent. #91

Description

@balsick

The declared type for prop textMessage is not correctly working with memoized components supplied as prop for textMessage.
The most proper type should be PropTypes.element instead of PropTypes.func.

Additionally, bottom could be set more specifically instead of just declaring them as object.

SnackbarComponent.propTypes = {
   left: PropTypes.number,
   right: PropTypes.number,
   top: PropTypes.number,
-  bottom: PropTypes.number,
+  bottom: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Animated.Value)]),
   visible: PropTypes.bool,
   actionText: PropTypes.string,
-  textMessage: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
+  textMessage: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
   position: PropTypes.oneOf(['bottom', 'top']), // bottom (default), top
   // eslint-disable-next-line react/no-unused-prop-types
   autoHidingTime: PropTypes.number, // How long (in milliseconds) the snack bar will be hidden.
   containerStyle: ViewPropTypes.style,
   messageStyle: Text.propTypes.style,
   actionStyle: Text.propTypes.style,
 };

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