Comments (5)
I was able to fix the problem by mocking react-navigation and react-navigation-redux-helpers
jest.mock('react-navigation', () => ({
NavigationActions: {
init: () => {},
},
createNavigationContainer: () => ({}),
createNavigator: () => ({}),
createStackNavigator: () => ({}),
createMaterialTopTabNavigator: () => ({}),
createBottomTabNavigator: () => ({}),
createSwitchNavigator: () => ({}),
}));
jest.mock('react-navigation-redux-helpers', () => ({
createNavigationReducer: () => (state = {}, action) => (state),
createReactNavigationReduxMiddleware: () => () => () => () => {},
reduxifyNavigator: () => () => {},
}));
Hope that's help
from redux-helpers.
Some context in #23 for people who haven't seen it (@Devid2727, I know you have).
I'm not immediately sure what's going on exactly here. The error is on the import of NavigationActions
from react-navigation
, and your version of react-navigation
is quite old, so my first thought is that maybe that version of react-navigation
doesn't declare that export correctly. You could read the code in node_modules/react-navigation
and see if you can find the export.
In general I'd suggest updating your versions of both react-navigation
and react-navigation-redux-helpers
.
If you can create a minimal repro using either Expo Snack or a clean react-native init
'd repo, I can try and help debug the issue.
from redux-helpers.
Hi all. A faced the same issue after upgrade to RN 0.57
Adding react-navigation-redux-helpers
in transformIgnorePatterns
did not help.
My package.json
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/polyfill": "^7.0.0",
"@babel/preset-flow": "^7.0.0",
"babel-plugin-jest-hoist": "^23.2.0",
"@babel/plugin-transform-block-scoping": "^7.0.0",
"@babel/plugin-transform-flow-strip-types": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-transform-computed-properties": "^7.0.0",
"@babel/plugin-transform-destructuring": "^7.0.0",
"@babel/plugin-transform-function-name": "^7.1.0",
"@babel/plugin-transform-literals": "^7.0.0",
"@babel/plugin-transform-parameters": "^7.1.0",
"@babel/plugin-transform-shorthand-properties": "^7.0.0",
"@babel/plugin-transform-react-jsx": "^7.0.0",
"@babel/plugin-transform-regenerator": "^7.0.0",
"@babel/plugin-transform-sticky-regex": "^7.0.0",
"@babel/plugin-transform-unicode-regex": "^7.0.0",
"@babel/plugin-transform-modules-commonjs": "^7.1.0",
"@babel/plugin-transform-classes": "^7.1.0",
"@babel/plugin-transform-arrow-functions": "^7.0.0",
"@babel/plugin-transform-spread": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/plugin-transform-template-literals": "^7.0.0",
"@babel/plugin-transform-exponentiation-operator": "^7.1.0",
"@babel/plugin-transform-object-assign": "^7.0.0",
"@babel/plugin-transform-for-of": "^7.0.0",
"@babel/plugin-transform-react-display-name": "^7.0.0",
"@babel/plugin-transform-react-jsx-source": "^7.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "^0.45.6",
"react": "16.5.0",
"react-native": "0.57.0",
"react-navigation": "2.9.1",
"react-navigation-redux-helpers": "2.0.4",
"react-redux": "^5.0.7",
"redux": "^3.7.2",
},
"jest": {
"preset": "react-native",
"transformIgnorePatterns": [
"node_modules/(?!(jest-)?react-native|react-redux|react-navigation-redux-helpers)"
],
"transform": {
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
}
}
}
And my .babelrc
{
"presets": ["module:metro-react-native-babel-preset"]
}
from redux-helpers.
Same problem here.
from redux-helpers.
I'm still not sure what's going on here, and I'm not familiar enough with Jest to investigate without having to do a whole bunch of learning first.
Consider this issue to be a "help wanted" - if somebody familiar with Jest is experiencing this issue, perhaps they could take the time to investigate what's going on.
Alternately, if anybody is able to create a clean repo with minimal code that reproduces the issue, I'd be willing to take a quick look.
from redux-helpers.
Related Issues (20)
- Issues in ThemeProvider HOT 3
- this .setState does'nt work in componnent didmount anyone can help me? HOT 3
- Is @react-navigation/core needed? v4.0.1 HOT 3
- Invariant Violation: App.router must be provided to createNavigationPropConstructor as of [email protected] HOT 2
- NavState missing routes
- React Nav 5 support - undefined is not object _core.NavigationActions.init HOT 7
- When will react-navigation-5 be adapted? HOT 2
- undefined is not object _core.NavigationActions.init HOT 2
- TypeError: undefined is not an object (evaluating 'Navigator.router')
- React navigation navigation.getChildNavigation is not a fucntion HOT 1
- createReactNavigationReduxMiddleware called more than once
- Cannot read property 'routes' of undefined HOT 2
- TypeScript typings rely on nonexistent @react-navigation/core libdefs HOT 4
- Typings error HOT 2
- Upgrading react-navigation from 1.0.0-beta.13 to latest, having trouble re-integrating my nested navigators with redux. HOT 3
- Cannot read property 'routes' of undefined - react-navigation 3.11, redux-helper 3.0.2 HOT 1
- createNavigationReducer on Web HOT 1
- Upgrading from 1.0.0-beta.21 to v4, gives navigation.getChildNavigation is not a function HOT 3
- Invariant Violation HOT 5
- Changing imports from @react-navigation/core to react-navigation breaks web apps HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redux-helpers.