Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ViewPropTypes will be removed from React native #1003

Open
Akshaybagai52 opened this issue Jan 17, 2024 · 1 comment
Open

ViewPropTypes will be removed from React native #1003

Akshaybagai52 opened this issue Jan 17, 2024 · 1 comment

Comments

@Akshaybagai52
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants