Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
balsick opened this issue Jul 17, 2023 · 0 comments

Comments

@balsick
Copy link

balsick commented Jul 17, 2023

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,
 };
balsick added a commit to balsick/react-native-snackbar-component that referenced this issue Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant