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

Redux/Mobx Integration: Nested TabNavigator not rendering the first tab navigate #3604

Closed
toytonic opened this issue Feb 26, 2018 · 4 comments

Comments

@toytonic
Copy link

Current Behavior

I have a the following structure with a nested tab navigator (main navigation) inside a stack navigator (for modals to 'popover'). Once managing the state via redux or mobx the first navigate (via tabbing) in the tab navigator to e.g. 'Tab2' is not rendered. After navigating back and forth it gets rendered. Using the same navigation structure but without redux/mobx works just fine.

export const MainNavigator = TabNavigator({
  Tab1: {screen: createScreen('tab1')},
  Tab2: {screen: createScreen('tab2')},
  Tab3: {screen: createScreen('tab3')}
})

export const AppNavigator = StackNavigator({
  Main: { screen: MainNavigator },
});

Expected Behavior

Use a redux/mobx state management with the same behaviour as plain react navigation.

How to reproduce

Here's a demo on expo:
https://snack.expo.io/@toytonic/react-navigation-nested-tabnavigator-redux

Your Environment

software version
react-navigation 1.2.0 ( or latest master)
react-native 0.52.0
node 8
npm or yarn 1.3.2
@nol13
Copy link

nol13 commented Feb 26, 2018

I believe am having same issue even when not integrated with redux.

Current hacky workaround: in Tab1..

componentDidMount() {
  setTimeout(() => this.props.navigation.navigate('Tab2'), 500);
  setTimeout(() => this.props.navigation.navigate('Tab1'), 501);
}

@nico1510
Copy link

I noticed that the redux listener for 'willFocus' is not called when first navigating to tab2. Only when switching back and forth again it is called. This could be related to what you're experiencing.

@brentvatne
Copy link
Member

hi there! if you can't reproduce this without redux then this issue belongs on https://github.com/react-navigation/react-navigation-redux-helpers

thank you for taking the time to fill out the issue template properly!

@nol13
Copy link

nol13 commented Feb 27, 2018

Ok can reproduce this issue without redux now. When I tried to simplify it couldn't reproduce, so lot of nesting..

https://snack.expo.io/B1LdhUmdM

Steps to reproduce:

  1. click on search tab
  2. click on SavedSearch, screen is blank
  3. click back to NewSearch
  4. click on SavedSearch again, screen is not blank

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

4 participants