I have just upgraded expo from 45 to 46 to run on my physical device (apparently this update is need for the expo app). Both of this issues came up:
I have found many solutions for the deprecated module, most of them with this fix: upgrading on node_moldules/react-native/index.tsx
(as many solutions suggest):
},
// Deprecated Prop Types
get ColorPropType(): $FlowFixMe {
require('deprecated-react-native-prop-types').ColorPropType;
},
get EdgeInsetsPropType(): $FlowFixMe {
require('deprecated-react-native-prop-types').EdgeInsetsPropType;
},
get PointPropType(): $FlowFixMe {
require('deprecated-react-native-prop-types').PointPropType;
},
get ViewPropTypes(): $FlowFixMe {
require('deprecated-react-native-prop-types').ViewPropTypes;
},
};
Although after doing this "solution", I got the following error (and the "main" error persists too):
Well, I manage to solve it.
What has to be done?
1. Install patch-package
and deprecated-react-native-prop-types
.
2. In node_moldules/react-native/index.tsx
. Insert the require
lines:
// Deprecated Prop Types
get ColorPropType(): $FlowFixMe {
require('deprecated-react-native-prop-types').ColorPropType;
},
get EdgeInsetsPropType(): $FlowFixMe {
require('deprecated-react-native-prop-types').EdgeInsetsPropType;
},
get PointPropType(): $FlowFixMe {
require('deprecated-react-native-prop-types').PointPropType;
},
get ViewPropTypes(): $FlowFixMe {
require('deprecated-react-native-prop-types').ViewPropTypes;
},
};
3. Probably you will get the same issue with props as me, this means that some of your dependencies are outdated. Search for PropTypes.style
(On every dependency on node_modules
-> "yes it is boring and exhaustive", what I did to find the dependencies with issue was to comment all my code, and slowly uncomment it, so when the error shows I know which page is causing it), after finding the dependency with PropTypes.style
, try to update the dependencies with yarn <dependencie>
. If it does not fix the issue, then replace PropTypes.style
with require('deprecated-react-native-prop-types').ViewPropTypes
.
4. If updating dependencies fixed for you, your done.
5. If you had to include require(...)
in any of the dependencies, don't forget to run yarn patch-package <package-name>
6. And also don't forget to run yarn patch-package
after installing any packages with yarn
or npm