-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Dependency inject React. #2031
Dependency inject React. #2031
Conversation
Allows use with React Native or other custom React version.
Ignoring whitespace makes the commit more readable. Could you not just hook into your build tool and manually resolve the "react" library? We do this in the redux example code to use the local version instead of the one from the package repo. |
@timdorr unfortunately, you can't do that with React Native, as far as I'm aware. It doesn't use webpack (or anything like it) - it has it's own packager that does special dependency resolution. |
Unfortunately, that's not how RN works. You have to use the bundled version of react that's built in. I presume eventually they will upgrade to 0.14.0 and split off the native component, but it's my understanding that it's going to be a bit until that happens. |
Welp, I'm having no luck in this conversation 😄 I would say this significantly impacts a number of use cases that I and others have with the package introspection that you mentioned. Perhaps a better approach would be to simply change all the react imports to a local module that can be configured in some way to pass back any object as |
I found this thing: https://github.com/mjohnston/react-native-webpack-server Does that help the situation? |
@ryanflorence @mjackson This was the PR I mentioned for React Router + RN. |
@timdorr definitely familiar with that project and have used it a few times. Problem is that 1) it's unsupported and 2) it's buggy. In general, not really a super viable option (at least in my opinion) for production ready RN apps. At least at the moment. Hopefully that will change. :-) So the options I see are the following:
I would rank these in order of difficulty from easiest to hardest, respectively. As far as the most "right" path forward? I think it's hands down # 3. To allow people to use RR on RN today? Would probably be the first option. It's really up to the maintainers on the direction they want to go with the lib. Really just was aiming to share this PR to start discussion on react-router on RN. Oh btw, it basically "just works", if you ignore for a moment integrating with Navigator and TabBarIOS. Those integrations are more difficult (I have working versions of each, but need to work to test them and continue to make them stable). Point is, it's possible and super doable, providing there's some workaround for this packaging problem. |
Thanks for putting so much effort and thought into this, @skevy! TBH, I was just kind of ignoring the whole packaging problem, hoping that the RN team would come around and support 0.14 and we could all sort of just make the leap at the same time. But that may not be practical. I wonder if @vjeux knows what React Native's plans re: 0.14 are? |
I read in a tweet that after 0.14, a compatible RN version may arrive in a few weeks. |
Some race conditions have been fixed lately so maybe you should give it another try. |
@mjackson @gaearon fwiw @ide made an issue about the 0.14 migration last night, for reference: facebook/react-native#2985 TLDR; it's priority for them, but no timeline yet (it seems). |
@skevy Since react-router is now using 0.14, does this look to OK to close now? |
I think it's fine to close. There's a bigger discussion to be had about actually integrating with the React Native and the direction that that could take...but @mjackson and I are supposed to offline about that at some point in the very near future. I also need to keep harping on facebook/react-native#2985 to make sure that actually happens, in order to make stuff like this possible. |
Yeah, that sounds like some great RN ecosystem enhancement. Hope they can get to it soon! |
Allows use with React Native or other custom React version. I followed the same pattern as rackt/react-redux.
The only breaking change with this (since all tests pass, and you guys write awesome tests) would be for people who import directly from "react-router/lib/[something]" and use private APIs. I'm not sure what your thoughts would be on what to do about those people.
I'm also aware that you might not even want to accept a PR like this, given the fact that one day (though none of us know what day that is haha) we can all depend on React >= 0.14, and react-router can depend on just react (sans react-dom), and that will (hopefully) just work with react-native with no changes needed. Ahhh, the future. It will be so nice.
But for using react-router on RN today, this is needed.