react-native-snap-carousel icon indicating copy to clipboard operation
react-native-snap-carousel copied to clipboard

ViewPropTypes will be removed from React native

Open Akshaybagai52 opened this issue 1 year ago • 1 comments

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

Akshaybagai52 avatar Jan 17 '24 03:01 Akshaybagai52

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

ShreyashMs avatar Jan 18 '24 07:01 ShreyashMs