PropTypes Warnings on expo-web
See original GitHub issueWhen you run this library in Expo Web, you get warnings for every time ViewPropTypes.style
is used. For example:
Warning: Failed prop type: Toast: prop type `style` is invalid; it must be a function, usually from the `prop-types` package, but received `object`.
in Toast (at App.tsx:40)
in App (created by ExpoRootComponent)
in ExpoRootComponent (created by RootComponent)
in RootComponent
in div (created by View)
in View (created by AppContainer)
in div (created by View)
in View (created by AppContainer)
in AppContainer
Happens because of the PropTypes here https://github.com/calintamas/react-native-toast-message/blob/master/src/index.js#L383
This is probably because prop-types has been depricated on React-Native-Web, but not React-Native. https://github.com/necolas/react-native-web/issues/1537#issuecomment-601167089
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Don't Call PropTypes Warning
In a future major release of React, the code that implements PropType validation functions will be stripped in production. Once this happens, any...
Read more >PropTypes Module is not giving warnings like it should
I imported Proptypes at the top of my component and tried to set some required proptypes for my component, but I am not...
Read more >PropType validation does not show warning in console
NET and am trying to implement propType validation. But I don't receive any warnings even though the props I am passing to my...
Read more >Disable PropType warnings in Jest and React - Code Is Bae
A quick look at how to disable proptype warnings in React and Jest. ... This post shows how to disable proptype warning messages...
Read more >How to forget about type errors in your React props with ...
Using prop types in React gives you a bit of the TypeScript ... can pass in any type of data and it compiles...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, looks like we’ll need the prop-types stuff dropped in order to support the latest
react-native-web
. In the meantime, following the example in the linkedreact-native-web
issue, here is a script that will monkey-patch the library:fix-rn-web-proptypes.sh:
Then add
"postinstall": "./fix-rn-web-proptypes.sh"
in thescripts
section of yourpackage.json
.After doing the above, I’m able to use this package with
react-native-web
👍published a fix in v1.4.5