Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update React Native installation instructions #236

Closed
Emilios1995 opened this issue Jan 3, 2016 · 32 comments
Closed

Update React Native installation instructions #236

Emilios1995 opened this issue Jan 3, 2016 · 32 comments

Comments

@Emilios1995
Copy link

Seems that React Native works on top of react already. the issue facebook/react-native#2985 is already closed.
Can we already use React-Redux 4?

@esamattis
Copy link
Contributor

That change is not in the released version yet. In few days I guess...

@zenlambda
Copy link

The change is included in the newly released 0.18-rc (I haven't tested it with redux 4 yet), so hopefully not long to go!

@alinz
Copy link

alinz commented Jan 7, 2016

OK, I got react-redux 4.0.6 to work with react-native, it will be available in example-react-native-redux.

There are couple of steps need to be done which I hide them at the moment in package.json's postscript. Here's the details:

  1. react module in react-native/node_module must be deleted.
  2. fbjs module in react-native/node_modules must be deleted.
  3. fbjs module in react/node_modules must be deleted.
  4. fbjs module must be added as module to project in main package.json
  5. all .babelrc files must be deleted under node_module folder

There is a discussion here facebook/react-native#2985 (comment) which @spicyj talks about changing fbjs.

Also @gaearon I still need to remove all .babelrc files under node_modules before I can run the example-react-native-redux. What is your suggestion?

@gaearon
Copy link
Contributor

gaearon commented Jan 7, 2016

I don't have any suggestions here. Feedback from people more knowledgeable in RN is welcome.

Perhaps @ide or @spicyj could clarify the situation.

@Purii
Copy link

Purii commented Jan 7, 2016

Before checking anything I just replaced import { connect } from 'react-redux/native' with import { connect } from 'react-redux'. Also updated the following:

import { Provider } from 'react-redux/native';
...
<Provider store={store}>    
  {() => <App/>}
</Provider>

TO:

import { Provider } from 'react-redux';
...
<Provider store={store}>    
 <App/>
</Provider>

I use the most recent version of react-redux:

"react-native": "^v0.18.0-rc",
"react-redux": "^4.0.6",
"redux": "^3.0.5",

I didn't need to change anything in the react-redux package. It just works, as expected by a tool from @gaearon ;-)

@alinz
Copy link

alinz commented Jan 7, 2016

In npm 2.x, if you define peerDependencies, it will install it in your root node_modules. react-redux has a peerDependency to react and react-native has react module. if you start the app using react-native start, haste will throw an exception that fbjs on react has a conflict with fbjs in react-native. @Purii I would like to see an example from you. Would you create a repo and upload an example?

@sophiebits
Copy link

Maybe if we make react and fbjs peer deps of RN that'll help?

@ide
Copy link
Contributor

ide commented Jan 7, 2016

@spicyj That's an interesting idea. Making react a peer dep sounds like it could be semantically correct. I think it's probably more correct that fbjs is a normal dependency though, and RN 0.19 may address the issue with conflicting fbjs modules with some patches that are being reviewed. (Alternatively npm3 fixes this too.)

@Purii
Copy link

Purii commented Jan 7, 2016

@alinz I use npm@3

@alinz
Copy link

alinz commented Jan 7, 2016

@Purii That should be it, since npm@3 promises flat node_modules. The only issue is that, not all modules in npmjs are compatible with npm@3. Thanks though for letting me know

@steida steida mentioned this issue Jan 9, 2016
3 tasks
@klvnptr
Copy link

klvnptr commented Jan 11, 2016

@Purii thanks. your method works perfectly for me with npm@3

@john916zhang
Copy link

It works for me with npm@3

@gaearon
Copy link
Contributor

gaearon commented Jan 21, 2016

I think it's safer to modify the instructions if/after react-native is a peer of react.
@spicyj Plans to make this happen?

@sophiebits
Copy link

Send a PR? Should be pretty simple.

@zuk
Copy link

zuk commented Jan 23, 2016

For those here looking for a solution for react-redux, everything is working great for me with react-native-0.19.0-rc and npm3, but definitely not with npm2.

@ide
Copy link
Contributor

ide commented Jan 23, 2016

The fbjs commits didn't make it into 0.19 so stay tuned for 0.20 or 0.21.

@mudetroit
Copy link

To be fair, the problems at this point that result from using react-native@0.18 and react-redux@4 are entirely bugs within the dependency resolver the react-native bundle operation performs. They are in no way unique to react-redux. They do go away with npm@3; because, it no longer has the duplicate dependencies.

@ranyefet
Copy link

ranyefet commented Feb 4, 2016

@zuk @alinz How did it work for you guys?
This is the error I get:

Unable to resolve module react from /Users/ranyefet/Code/yesno/ios-app/node_modules/react-redux/lib/components/Provider.js: Invalid directory /Users/node_modules/react

I'm using NPM3 with these dependencies:

"react-native": "^0.19.0",
"redux": "^3.2.1",
"react-redux": "^4.2.1",

I don't have react dependency in my package.json (should I have?)
Please anyone help :)

@gaearon
Copy link
Contributor

gaearon commented Feb 4, 2016

Yes, you’d need to depend on react. When you do, make sure to delete node_modules/react-native/node_modules/react so you don’t end up with two of them.

@ranyefet
Copy link

ranyefet commented Feb 4, 2016

@gaearon Thanks Dan, looks like it's working :)

But, now I get a different error:

Unable to resolve module LinkedStateMixin from /Users/ranyefet/Code/yesno/ios-app/node_modules/react-native/Libraries/react-native/react-native.js: Invalid directory /Users/node_modules/LinkedStateMixin

Which seems there's no solution yet :(

@gaearon
Copy link
Contributor

gaearon commented Feb 4, 2016

Unfortunately I can’t really help you with this! Hopefully this will be fixed.

@ranyefet
Copy link

ranyefet commented Feb 4, 2016

Yeah I know it's not related to this repo, just ranting 😞
Thanks anyway!

@alinz
Copy link

alinz commented Feb 4, 2016

@ranyefet we do have react@0.14.5 as our dependency in our project. make sure to delete node_modules folder and try again. and here is my react-native module as a reference.

screen shot 2016-02-04 at 11 49 42 am

my npm version is 3.6.0
my node version is v5.5.0

@ranyefet
Copy link

ranyefet commented Feb 7, 2016

Thanks @alinz upgrading Node to 5.5 appear to fixed other issues I had, weird!

@Emilios1995
Copy link
Author

So, what's going on? Are we still waiting for react-native to be a peer of react?

@zxcpoiu
Copy link

zxcpoiu commented Feb 17, 2016

If anyone encountered same problems, here is a way worth to try:

  1. DELETE FULL node_module directory
  2. edit you package.json, react-native@19 and react-redux@4
  3. make sure your npm@3
  4. npm install

with a refreshed install and see if it works

@gaearon
Copy link
Contributor

gaearon commented Feb 17, 2016

So, what's going on? Are we still waiting for react-native to be a peer of react?

Yes. AFAIK it is already the case in master. Just waiting for the next release.

@Emilios1995
Copy link
Author

Good! But wasn't it included in 0.20? @gaearon do you recommend reinstalling the modules to make it work right now?

@gaearon
Copy link
Contributor

gaearon commented Feb 17, 2016

@skevy
Copy link

skevy commented Feb 17, 2016

@gaearon working on it :) We'll know by Friday if "React as as a peer dep" is going to make it into the 0.21-RC branch cut.

Thanks for the ping. Trust me, we're working hard to get this stuff worked out and make React Native a better member of the general React ecosystem.

@gaearon
Copy link
Contributor

gaearon commented Feb 17, 2016

I have no doubts about your efforts, thank you very much for working on this!

@gaearon
Copy link
Contributor

gaearon commented Mar 5, 2016

The note in README now says you can use react-redux@4.x just fine. I’ll add a clarification that you should be careful to avoid ending up with two reacts.

@gaearon gaearon closed this as completed Mar 5, 2016
foiseworth pushed a commit to foiseworth/react-redux that referenced this issue Jul 30, 2016
…test

Added test for shallowEqualScalar in connect decorator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests