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

Hodeem Miller
2 min readSep 19, 2021

--

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.

4. Replace all instances ofViewPropTypes ? ViewPropTypes.style : View.propTypes.style with stylePropType.

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

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.

--

--

Hodeem Miller

React/React Native Developer. Follow me on Twitter @HMCodes