Hide parent's navigation header from the nested navigator

耗尽温柔 提交于 2019-12-07 11:33:30

Unfortunately, I didn't figure how to do that without using redux.

So I had to do a workaround.

I declared my Nested Navigator directly in the Main Navigator. "in the same level as Authentication & Bottom Bar Navigations" and set the header as null for this specific nav.

And then, navigate to that nested whenever i want.

Also, I had to add my custom icon to navigate the user back. because in our case there is no history in the new navigator in order to navigate back to.

so, i did like this:

static navigationOptions = ({ navigation }) => ({
headerLeft: (
  <Icon
    name="chevron-left"
    color="#fff"
    underlayColor="#4BA6F8"
    onPress={() => {
      const backAction = NavigationActions.back();
      navigation.dispatch(backAction);
    }}
  />
),

});

I know this is not the real answer for my question, but at least it solved my issue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!