meliorence / react-native-snap-carousel

Swiper/carousel component for React Native featuring previews, multiple layouts, parallax images, performant handling of huge numbers of items, and more. Compatible with Android & iOS.
BSD 3-Clause "New" or "Revised" License
10.37k stars 2.29k forks source link

ViewPropTypes will be removed from React native #1003

Open Akshaybagai52 opened 10 months ago

Akshaybagai52 commented 10 months ago

ERROR ViewPropTypes will be removed from React Native, along with all other PropTypes. We recommend that you migrate away from PropTypes and switch to a type system like TypeScript. If you need to continue using ViewPropTypes, migrate to the 'deprecated-react-native-prop-types' package.

Is there any solution to this I'm using typescript in react native expo

Thanks

ShreyashMs commented 10 months ago

1- install "deprecated-react-native-prop-types" with npm

"npm install deprecated-react-native-prop-types"

2-Then open react-native folder inside node_modules , There you will have index.js

3-Below comment note "// Deprecated Prop Types" you will see functions like this :

// Deprecated Prop Types get ColorPropType(): $FlowFixMe { invariant( false, "ColorPropType has been removed from React Native. Migrate to " + "ColorPropType exported from 'deprecated-react-native-prop-types'.", ); },

get EdgeInsetsPropType(): $FlowFixMe { invariant( false, "EdgeInsetsPropType has been removed from React Native. Migrate to " + "EdgeInsetsPropType exported from 'deprecated-react-native-prop- types'.", ); }, get PointPropType(): $FlowFixMe { invariant( false, "PointPropType has been removed from React Native. Migrate to " + "PointPropType exported from 'deprecated-react-native-prop-types'.", ); }, get ViewPropTypes(): $FlowFixMe { invariant( false, "ViewPropTypes has been removed from React Native. Migrate to " + "ViewPropTypes exported from 'deprecated-react-native-prop-types'.", ); }, Replace it with code below :

get ColorPropType(): $FlowFixMe { return require("deprecated-react-native-prop-types").ColorPropType },

get EdgeInsetsPropType(): $FlowFixMe { return require("deprecated-react-native-prop-types").EdgeInsetsPropType }, get PointPropType(): $FlowFixMe { return require("deprecated-react-native-prop-types").PointPropType }, get ViewPropTypes(): $FlowFixMe { return require("deprecated-react-native-prop-types").ViewPropTypes }, Then save file and rebuild your project and run It may help