react-native-exception-handler
react-native-exception-handler copied to clipboard
Cannot read property 'setHandlerForNativeException' of undefined
trafficstars
Hello! Been struggling getting the Native Exceptions working. Any assistance would be appreciated!

- node version: v10.13.0
- react version: ~16.9.0
- react-native: 0.61.5
Following the installation guide (Mostly automatic installation).
I have this innativeExceptions.js
import { setNativeExceptionHandler } from 'react-native-exception-handler';
import { Alert } from 'react-native';
const exceptionhandler = exceptionString => {
Alert.alert(
'Unexpected error occured',
`Error: ${exceptionString}
We have reported this to our team! Please close the app and start again!
`,
[{
text: 'OK'
}]
);
};
setNativeExceptionHandler(
exceptionhandler,
false
);
and then I import it in App.js
import 'utils/ErrorHandling/jsExceptions';
I have linked react-native link react-native-exception-handler and restarted the bundle. Still get the error.
Here's the project's other dependencies:
"dependencies": {
"@react-native-community/async-storage": "^1.11.0",
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/native": "^5.4.2",
"@react-navigation/stack": "^5.3.9",
"axios": "^0.19.2",
"babel-eslint": "^10.1.0",
"date-fns": "^2.14.0",
"expo": "^37.0.0",
"expo-barcode-scanner": "~8.1.0",
"expo-localization": "^8.1.0",
"expo-permissions": "~8.1.0",
"expo-updates": "~0.2.0",
"i18n-js": "^3.7.0",
"js-sha256": "^0.9.0",
"lodash.capitalize": "^4.2.1",
"lodash.isequal": "^4.5.0",
"lodash.memoize": "^4.1.2",
"react": "~16.9.0",
"react-dom": "16.8.3",
"react-native": "0.61.5",
"react-native-camera": "^3.30.0",
"react-native-dash": "0.0.11",
"react-native-dotenv": "^0.2.0",
"react-native-elements": "^2.0.2",
"react-native-exception-handler": "^2.10.8",
"react-native-flash-message": "^0.1.15",
"react-native-gesture-handler": "^1.6.1",
"react-native-modal": "^11.5.6",
"react-native-permissions": "^2.1.5",
"react-native-progress-circle": "^2.1.0",
"react-native-reanimated": "^1.8.0",
"react-native-render-html": "^4.2.0",
"react-native-safe-area-context": "^1.0.2",
"react-native-screens": "^2.7.0",
"react-native-snap-carousel": "^3.9.1",
"react-native-svg": "^12.1.0",
"react-native-swipe-gestures": "^1.0.5",
"react-native-unimodules": "^0.9.1",
"react-native-vector-icons": "^6.6.0",
"react-native-web": "^0.11.7",
"react-native-webview": "^10.3.1",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"timeago.js": "^4.0.2"
},
"devDependencies": {
"@babel/core": "~7.9.0",
"babel-jest": "~25.2.6",
"jest": "~25.2.6",
"react-test-renderer": "~16.9.0",
"mem": ">=4.0.0",
"braces": ">=2.3.1",
"babel-preset-expo": "^5.0.0",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^2.5.1"
}