-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix: undefined View propTypes issue #820
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
Conversation
|
thanks for this! would be great to get this bumped and merged in! thanks! |
|
Yeah agreed, the merge would make my day guys! |
|
This works well, can we get a merge please? |
|
Thanks, @capelski, |
| callbackOffsetMargin: PropTypes.number, | ||
| containerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, | ||
| contentContainerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, | ||
| containerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes ? View.propTypes.style : () => null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
containerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes?.style ? View.propTypes.style : () => null
instead... Your's didnt work for me, but the ?. does....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these solutions are awesome I'll try it out right away
| containerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, | ||
| contentContainerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, | ||
| containerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes ? View.propTypes.style : () => null, | ||
| contentContainerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes ? View.propTypes.style : () => null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above:
contentContainerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes?.style ? View.propTypes.style : () => null,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry - terrible at using this github stuff!!!
You change did not fix the problem, still got red errors in chrome.... The following (just in the Carousel.js) did fix it as a slight mod to yours:
containerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes?.style ? View.propTypes.style : () => null,
contentContainerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes?.style ? View.propTypes.style : () => null,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @cyphire. Which device and browser are you testing it from? The fix was working fine on a Windows 10 Chrome browser. The only difference in your code is checking that View.propTypes contains a property named style. In fact, your code would be more readable if you'd replace the ternary operator with an or operator:
| contentContainerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes ? View.propTypes.style : () => null, | |
| contentContainerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes?.style || () => null, |
But again, in which case do you get a View.propTypes without the style property?
|
This works, however I think the underlying problem is this. After applying the fix from the linked comment web also works fine for me. |
|
As mentioned in #779 (comment), React Native deprecated |
|
How do we solve this, I am getting errors too |
Chris-Imade
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why isn't this correction merge...when I run yarn add react-native-snap-carousel I still get the not updated files
| callbackOffsetMargin: PropTypes.number, | ||
| containerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, | ||
| contentContainerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, | ||
| containerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes ? View.propTypes.style : () => null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these solutions are awesome I'll try it out right away
|
If you want this code in your project instead of the current, broken code, you can |
Platforms affected
Google Chrome on Windows
What does this PR do?
Fix propTypes issues on browsers
What testing has been done on this change?
Launched the app in the Expo Client