1

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?

Sharcoux
  • 5,546
  • 7
  • 45
  • 78
  • 1
    run npm start in your project – lovepreet singh Apr 18 '19 at 10:39
  • I already did. This starts the Metro Bundler server, and as I said, it is up and running: `Running Metro Bundler on port 8081.`. If you don't mind, could you try to clone the sample repo https://github.com/Sharcoux/redux.git and see if it works for you maybe? – Sharcoux Apr 18 '19 at 12:37
  • define routes screen in router – lovepreet singh Apr 18 '19 at 12:48
  • I'm sorry in advanced if my question is stupid, but what do you mean exactly? What am I supposed to do concretely? (Thanks a lot for your help anyway) – Sharcoux Apr 18 '19 at 13:01
  • Any idea what caused the down vote btw? – Sharcoux Apr 18 '19 at 13:38
  • Could you try the changes I did here in this commit? https://github.com/aksonov/react-native-router-flux/commit/cd74da5f28f3a0d3c33be781a7f07463ace6b00f I believe some of those are still relevant for this sort of errors. – Davis Z. Cabral Apr 23 '19 at 09:29
  • I'll try that ASAP and let you know. Thanks. – Sharcoux Apr 23 '19 at 14:31
  • do you experience the same problems when starting a new project with `react-native init`? did you try `react-native run --reset-cache`? Are you running an emulator or real device? If this is not related to this specific project, you may want to try [the common solutions for this bug](https://stackoverflow.com/questions/44446523/unable-to-load-script-from-assets-index-android-bundle-on-windows) Instead if it is related to the dependencies, the question is which dependency is causing the issue so that we can better understand what is wrong – Fabrizio Bertoglio Apr 24 '19 at 07:09
  • @DavisZ.Cabral Ok, back to the problem, I'm not sure about what you expect me to do. Moreover, your PR has already been merged into RNRF apparently, so I guess I do have your changes into my project, don't I? – Sharcoux Apr 24 '19 at 08:00
  • Sorry about the late answer - yes - but the related changes to gradle sometime are required. Android development with react-native is a bit painful yet. Glad someone else found the fix for you. – Davis Z. Cabral Apr 25 '19 at 19:05

1 Answers1

4

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 react-navigation-redux-helpers@3.0.0! 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.

Sharcoux
  • 5,546
  • 7
  • 45
  • 78
errorau
  • 2,121
  • 1
  • 14
  • 38
  • Not bad. let me investigate that last issue. Thanks a lot. – Sharcoux Apr 24 '19 at 08:46
  • I searching too. İf I will find I can add :) – errorau Apr 24 '19 at 09:16
  • Ok. So, basically, is you replace `reduxifyNavigator` by `createReduxContainer` everywhere inside `app.js`, and `Router` by `ReduxNavigator` line 36, and then remove `navigator={ReduxNavigator}` line 43, the app will start. Which is great... Except that the navigation doesn't work... Which sucks. – Sharcoux Apr 24 '19 at 09:38
  • Ok I got it to work ! :) The steps: replace `reduxifyNavigator` by `createReduxContainer`. Remove the first parameter `root` in `createReactNavigationReduxMiddleware` line 31, and boom ! It works – Sharcoux Apr 24 '19 at 09:43