DEV Community

Hodeem
Hodeem

Posted on • Updated on

How I solved the >>’ViewPropTypes’ is not exported from ‘react-native-web/dist/index’<< error in ‘react-native-snap-carousel’

Introduction

I couldn’t find the fix for this error anywhere in the react-native-snap-carousel package, and it was really frustrating.

Eventually, I solved it and I hope my quick fix helps other frustrated developers. If you have a better solution, please let me know.

Solution

(1) Install react-style-proptype

(2) Open the following files in the node_modules folder once you’ve installed react-native-snap-carousel:

node_modules\react-native-snap-carousel\src\carousel\Carousel.js

node_modules\react-native-snap-carousel\src\pagination\Pagination.js

node_modules\react-native-snap-carousel\src\pagination\PaginationDot.js

node_modules\react-native-snap-carousel\src\parallaximage\ParallaxImage.js

(3) Import react-style-proptype , as prescribed by the documentation, in each file mentioned above.

image

(4) Replace all instances of ViewPropTypes ? ViewPropTypes.style : View.propTypes.style with stylePropType.

image

(5) Delete the ViewPropTypes named import from ‘react-native’

image

Conclusion

Voila! Hopefully, this works for you too. If this helped, then please leave a like or comment. And once again, if you find a better solution, please let me know.

If you liked this article, then please support me

Top comments (3)

Collapse
 
arpit2205 profile image
Arpit Gupta

THANKSSS MANNN!!!!

Collapse
 
esegebart profile image
Elyse Segebart

This seriously just saved my day! Thank you!

Collapse
 
hmcodes profile image
Hodeem

I'm glad I could help 😃