Skip to content
This repository has been archived by the owner on Feb 15, 2019. It is now read-only.

jumpToTab with NavigationActions #377

Closed
eduedix opened this issue Jan 18, 2017 · 7 comments
Closed

jumpToTab with NavigationActions #377

eduedix opened this issue Jan 18, 2017 · 7 comments

Comments

@eduedix
Copy link

eduedix commented Jan 18, 2017

I want to call jumpToTab action in a redux middleware. I would be grateful if you gave me a hand to resolve this. My TabNavigation is root and i want to jump to Tab tab1. I have tried this without success:
store.dispatch(NavigationActions.jumpToTab('root', 'tab1'))

Any idea on how to jumpToTab using NavigationActions?

@mantas-janulionis
Copy link

+1. I have the same issue. I noticed that ActionTypes.JUMP_TO_TAB is dispatched, however
ActionTypes.SET_CURRENT_NAVIGATOR is not

In some cases I did a workaround with

this.props.navigation.performAction(({ tabs }) => {
      tabs('root').jumpToTab('tab1');
    });

But If I want to call this method from anywhere outside of react component, it doesn't seem to be working. To me, it looks a like a bug

@eduedix
Copy link
Author

eduedix commented Jan 18, 2017

@mantas-janulionis
this worked:
store.dispatch(NavigationActions.jumpToTab('root', {key: 'tab1'}))

i think a documentation update is necessary.

@mikemurray
Copy link

@eduedix Solved my issue as well! Seems this PR has the updates needed for the documentation: #359

@eduedix
Copy link
Author

eduedix commented Jan 23, 2017

@mikemurray thanks for the link 👍

@eduedix eduedix closed this as completed Jan 23, 2017
@mypark
Copy link

mypark commented Feb 1, 2017

I'm getting a Navigator does not exist error even if I'm trying to call it from a component. Is there an example implementation of tabs('root').jumpToTab('tab1');

this.props.navigation.performAction(({ tabs }) => {
      tabs('root').jumpToTab('tab1');
    });

@eduedix
Copy link
Author

eduedix commented Feb 2, 2017

@mypark Is the navigatorUID called root in the element TabNavigation ?

@mypark
Copy link

mypark commented Feb 3, 2017

That's was the issue thanks. I was only setting Id

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants