I’m trying to test a component that contains a Swipeable from react-native-gesture-handler, but I’m getting this error Cannot read property 'State' of undefined
.
It’s a bug in node_modules/react-native-gesture-handler/GestureHandler.js:39:33
in the line:
const State = RNGestureHandlerModule.State;
I’m wondering if GestureHandler isn’t being mocked by jest-expo
.
This is my package.json
{
"scripts": {
"test": "node node_modules/jest/bin/jest.js --watch"
},
"jest": {
"preset": "jest-expo",
"testMatch": ["**/Tests/**/*.js"],
"transformIgnorePatterns": [
"node_modules/(?!react-native|native-base|react-navigation)/"
],
"globals": { "__DEV__": true }
},
"dependencies": {
"expo": "^22.0.0",
"react": "16.0.0-beta.5",
"react-native": "https://github.com/expo/react-native/archive/sdk-22.0.1.tar.gz"
},
"devDependencies": {
"jest-expo": "^22.0.0",
"react-test-renderer": "16.0.0-beta.5"
}
}