Search code examples
react-nativereact-native-router-flux

Impossible to make react native router flux sample project work with latest versions of dependencies


I am trying to make this sample project to work with latest dependencies versions.

I created a repo with my attempt : https://github.com/Sharcoux/redux.git

I want to be able to use react-native 0.59, but when I tried, I got this error and was requested to upgrade gradle version.

After upgrading gradle, I'm able to build the project, but I get on my phone:

Unable to load script. Make sure you're either running a metro server...

Of course, I have the server running with no error: Running Metro Bundler on port 8081. Edit: (The server starts automatically with react-native run-android, but I restarted it with yarn start just to be sure).

If I try to reload, I get a new error:

Could not connect to development server

I already tried to go to Dev settings -> Debug server host & port for device and set the 192.168.<local ip of my laptop>:8081

The project used to work fine before upgrading the dependencies. What could cause this?

Maybe someone very generous could:

git clone https://github.com/Sharcoux/redux.git
cd redux
yarn install
npx react-native run-android

And see if they can make it work?


Solution

  • First I cloned your Github project same you;

    git clone https://github.com/Sharcoux/redux.git
    cd redux
    npm i --save 
    react-native run-android
    

    I took similar error then I delete ios and android files after I run, about eject

    react-native eject
    

    again run

    npm i --save / npm install -S
    
    react-native run-android 
    

    I took again an error Count not found react-native-gesture-handler ...

    npm i react-native-gesture-handler --save
    

    The done project worked but I still a problem

    project files in app.js

    reduxifyNavigator is deprecated in [email protected]! Please use createReduxContainer instead.

    Replacing every reduxifyNavigator occurences by createReduxContainer leads to the following error: navStateSelector is not a function.

    Thanks to this post, you can notice that react-navigation-redux-helpers introduced some breaking changes in their last upgrade. The order of the parameters in createReactNavigationReduxMiddleware has changed and the key is now optional.

    Removing the 'root' key in createReactNavigationReduxMiddleware finishes to solve the problem.