In my react native app built with Expo I have an alert that pops up when there’s a new version of the app available. Earlier this year this was working, but now when I test this in the simulator (same problem arises for the physical device) when a user clicks “Upgrade” the following error arises:
TypeError: undefined is not an object (evaluating ‘_expo.Linking.openURL’) Error: Unable to resolve module ./Libraries/Components/DatePicker/DatePickerIOS from /Users/username/Documents/ABC/abc-client-react/node_modules/react-native/index.js:
This related to this error:
None of these files exist:
- node_modules/react-native/Libraries/Components/DatePicker/DatePickerIOS(.native|.native.ts|.ts|.native.tsx|.tsx|.native.js|.js|.native.jsx|.jsx|.native.json|.json)
The problem require statement looks like this:
import typeof DatePickerIOS from ‘./Libraries/Components/DatePicker/DatePickerIOS’;
I am running version 14.3.1 of XCode, and there don’t seem to be any additional updates available.
This is the code in question:
Alert.alert(
'New Version Available',
`App version ${newVersion.version} is now available.`,
[
{
text: 'Upgrade',
onPress: () => {
if (Platform.OS === 'ios') Linking.openURL(newVersion.iOS);
else Linking.openURL(newVersion.android);
},
style: 'default',
},
// Other code
],
{ cancelable: false }
);
My package.json looks like this:
{
"main": "node_modules/expo/AppEntry.js",
"version": "1.0.59",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"postinstall": "patch-package"
},
"dependencies": {
"@react-native-community/datetimepicker": "6.5.2",
"@react-native-picker/picker": "^2.4.8",
"@react-navigation/bottom-tabs": "^6.4.0",
"@react-navigation/drawer": "^6.5.0",
"@react-navigation/native": "^6.0.13",
"@react-navigation/native-stack": "^6.9.1",
"@react-navigation/stack": "^6.3.2",
"crypto-es": "^1.2.7",
"crypto-js": "^4.1.1",
"deprecated-react-native-prop-types": "2.2.0",
"expo": "^47.0.0",
"expo-av": "^13.0.2",
"expo-crypto": "~12.0.0",
"expo-device": "~5.0.0",
"expo-linear-gradient": "~12.0.1",
"expo-location": "~15.0.1",
"expo-sqlite": "~11.0.0",
"expo-status-bar": "~1.4.2",
"expo-updates": "~0.15.6",
"isaac": "^0.0.5",
"lodash.clonedeep": "^4.5.0",
"lodash.debounce": "^4.0.8",
"lodash.isequal": "^4.5.0",
"moment": "^2.29.4",
"patch-package": "^6.4.7",
"react": "18.1.0",
"react-native": "0.70.5",
"react-native-bcrypt": "^2.4.0",
"react-native-draggable-flatlist": "^4.0.0",
"react-native-gesture-handler": "~2.8.0",
"react-native-get-random-values": "~1.8.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-keyboard-spacer": "^0.4.1",
"react-native-modal-selector": "^2.1.2",
"react-native-open-maps": "^0.4.0",
"react-native-randombytes": "^3.6.1",
"react-native-reanimated": "~2.12.0",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "~3.18.0",
"react-native-signature-pad": "^0.1.2",
"react-native-svg-charts": "^5.4.0",
"react-native-tab-view": "^3.3.4",
"react-native-webview": "11.23.1",
"react-navigation": "^4.4.4",
"react-navigation-drawer": "^2.7.2",
"react-redux": "^8.0.4",
"react-serialize": "^0.2.1",
"redux": "^4.2.0",
"redux-thunk": "^2.4.1",
"serialize-javascript": "^6.0.0",
"socket.io-client": "2.1.0"
},
"devDependencies": {
"@babel/core": "^7.19.3"
},
"private": true
}
To clarify, the build works. It’s just when I fire this one function that this happens.
How can I resolve this situation?