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

bindActionCreators to navigation prop #3620

Closed
kodayashi opened this issue Feb 28, 2018 · 2 comments
Closed

bindActionCreators to navigation prop #3620

kodayashi opened this issue Feb 28, 2018 · 2 comments

Comments

@kodayashi
Copy link

The issue tracker is reserved for bug reports only.

If you have a question, feature request, or an idea for improving the library or its related tools, please try one of the following resources:

Bugs with react-navigation must be reproducible without any external libraries that operate on it. This means that if you are attempting to use Redux or MobX with it and you think you have found a bug, you must be able to reproduce it without Redux or MobX in this report. Redux related issues belong in react-navigation-redux-helpers, and we do not have any first-class integration with MobX at the moment.


Current Behavior

  • What code are you running and what is happening?

I'm trying to bind action creators to the navigation property. I am managing navigation state with redux.

  • Include a screenshot if it makes sense.

Expected Behavior

  • What do you expect should be happening?

When doing this: <AppNavigator navigation={addNavigationHelpers({ dispatch, state: nav, addListener, ...bindActionCreators(ActionCreators, dispatch), })} />

I would expect my action creators from ActionCreators to be bound to the navigation property, however they are not. The idea would be to use navigation.someNavigationActionCreator() as opposed to binding navigation-related action creators to the AppNavigator Component itself (in which case I would be following the typical action creator flow of just calling someNavigationActionCreator().

I'm attempting this because I would prefer to follow the pattern of not explicitly using dispatch in my containers, which is how the documented example here is doing it: https://reactnavigation.org/docs/redux-integration.html

Is there not support for binding navigation-related action creators directly to the navigation prop?

  • Include a screenshot if it makes sense.

How to reproduce

  • You must provide a way to reproduce the problem. If you are having an issue with your machine or build tools, the issue belongs on another repoistory as that is outside of the scope of Rect Navigation.
  • Either re-create the bug on Snack or link to a GitHub repository with code that reproduces the bug.
  • Explain how to run the example app and any steps that we need to take to reproduce the issue from the example app.

Your Environment

software version
react-navigation
react-native
node
npm or yarn
@brentvatne
Copy link
Member

hi there! thanks for posting, can you please re-post to https://github.com/react-navigation/react-navigation-redux-helpers? thanks!

@kodayashi
Copy link
Author

Done: react-navigation/redux-helpers#12

Thanks @brentvatne

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

2 participants