Giter VIP home page Giter VIP logo

Comments (5)

spaquis avatar spaquis commented on May 2, 2024 3

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.

Ashoat avatar Ashoat commented on May 2, 2024

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.

MikhailVolkov350504 avatar MikhailVolkov350504 commented on May 2, 2024

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.

spaquis avatar spaquis commented on May 2, 2024

Same problem here.

from redux-helpers.

Ashoat avatar Ashoat commented on May 2, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.