-
Notifications
You must be signed in to change notification settings - Fork 960
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
Add React Native support #16
Comments
I've been working a lot with AsyncStorage lately in React Native. I might want to give this one a go. |
@ryanolsonx That would be great! Thank you! Probably the trickiest piece of this will be incorporating some tests. I know that Travis is able to run tests for Objective-C code, but I'm not sure if that will work for React Native or not. @ryanolsonx Do you have any experience running automated tests with React Native? |
On second thought, @vjeux wisely suggested that we just mock Shouldn't be too difficult! #famouslastwords |
Alright, sweet. I'll look into adding the support for React Native and adding those tests with a mock AyncStorage. Here's to hoping it's not too difficult ;) |
I probably won't have too much time to work on this issue during this week and so if anyone else has time and wants to pick it up, feel free. |
I took a crack at implementing a mock asyncstorage object https://github.com/threepointone/asyncstorage-mock hope this helps, let me know if I can fix/change anything. |
Looks great, @threepointone! We can probably use that... |
I just pushed a partial implementation. AFAICT, the private |
👍 exciting to see that this is in progress, will keep an eye out for any way I can pitch in here |
anything I can do to help here? plsthx. |
@mjackson Been recently going through the codebase to see the latest updates on the React Native solution. Would you mind giving a quick update on where we are? I've tried few potentially good approaches to implement React Router in Native, but that was before history/React Router 1.0 were announced, so no longer applicable. If there's no major work being done at the moment, I am happy to take it over and re-submit a new pull request in approximately a week or two (too many #confrences soon to invest more time unfortunatelly) Speaking test-wise, I am successfully using CircleCI iOS beta feature to run both unit and automated tests as well as build and ship the bundle to the App Store, so I think that can work quite nice. But probably best to just mock the storage implementation by either using Jest or fake object we ship with and then, just use good old mocha to test things out. The only disadvantage of having such implementation of router in React Native I can see for now is having ability to do these |
There is also a very nice thing about |
AFAICT @grabbou nobody is actively working on this. React Router 1.0 doesn't have anything to do with managing history state. Instead, all that is the responsibility of this library (history). In theory, React Native support should be as easy as adding a One of the major native-specific features I'd like to implement would be confirming transitions using |
Yep, that's one of the things I really like in latest release. Should be pretty straight forward. Confirmation-wise, I guess it's just a matter of using either AlertIOS.alert(
'Are you sure?'
[
{text: 'Yes', onPress: () => ...},
{text: 'No', onPress: () => ...},
]
) without worrying about breaking iOS8 changes to UIAlertController etc. Few weeks ago I've been thining about shimming window.alert and window.confirm in React Native, but since the confirm is syncronous in browsers, there's no way to replicate such functionallity. |
I would split this out into a separate project. While we can make a One main, distinct, challenge of mobile routing and history management is that there isn't a single history stack, but rather multiple stacks that are parallel and/or hierarchical. Following something like remix-run/react-router#743 (comment), an abstraction that offers an interface that works for native app development needs to have a different API. We cannot abstract away the differences between web and mobile because the expected navigation/history paradigms are fundamentally different. We're fine to leave the note in the README as-is, but making a |
I'm going to close this issue as out of scope, and in light of further discussion on React Router. Replicating a web history API does not seem like a route that gets us to a general mobile routing solution. When we get a chance, the right move would be to spin up a separate Let's continue the discussion on remix-run/react-router#743 as needed. |
We should introduce a
createNativeHistory
method that creates a history object that can be used with React Native. Instead ofsessionStorage
, a native history should use React Native's AsyncStorage module to persist state.The text was updated successfully, but these errors were encountered: