react-navigation / redux-helpers

Redux middleware and utils for React Navigation
Other
296 stars 43 forks source link

Deep linking support #82

Closed salhotra closed 5 years ago

salhotra commented 5 years ago

Use case: Need to support deep linking from react navigation. https://reactnavigation.org/docs/en/deep-linking.html

In order to do that, we need to pass a prop called uriPrefix to the top level navigator.

Problem: Right now we can't pass uriPrefix (https://reactnavigation.org/docs/en/deep-linking.html#uri-prefix-1) to the Component wrapped by createReduxContainer.

Is there a decent way to fire the event listeners in the library for deep linking?

Ps: This library has been very useful for me. Thank you.

Ashoat commented 5 years ago

Yeah, you're unfortunately correct that there isn't currently any support for that in this library.

You can see how createAppContainer does it here. Basically, the URI and the uriPrefix get passed into getParamsFromPath, and the result of that is then passed to the root navigator's router's getActionForPathAndParams. That function then returns an action, which is then dispatched.

You should be able to implement this directly. The main navigator's router can be accessed on the Redux container, and getParamsFromPath can be imported. You should also take a look at how createAppContainer handles Linking.getInitialURL() on componentDidMount (basically replaces the INIT action with the getActionForPathAndParams action).

5468sun commented 5 years ago

is deep linking supported yet? I have the same problem, and dont know how to implement the previous solution.

samtoya commented 5 years ago

@Ashoat Is deep linking now supported? If not, can you please give an example on the solution you suggested/recommended?

Thank you.

BenjErgizerBunny commented 5 years ago

Is deep linking supported yet with redux? I also don't understand how to implement the solution above

Ashoat commented 5 years ago

Deep linking isn’t supported but PRs would be welcome!

scaralfred commented 4 years ago

Any update on this?