隐藏createBottomTabNavigator上的选项卡(navigationOptions:{tabBarVisible:false})不起作用

时间:2018-07-30 10:05:23

标签: react-native react-navigation

我想在下面的代码中隐藏标签def start_requests(self): university_gen = self.superclass_data() while True: try: university_row = next(university_gen) university_row: Tuple university_id = university_row[1] university_name = university_row[2] university_pinyin = university_row[3] acadamies = get_academy(university_id) payload = {"university_id": university_id, "university_name": university_name, "university_pinyin": university_pinyin, "acadamies": acadamies, "has_detail": False } yield SeleniumRequest(url=self.UNIVERSITY_QUERY.format(query_word=university_name), meta=payload, callback=self.parse, cookies=self.cookie, wait_until=EC.presence_of_all_elements_located(((By.XPATH, '//td'))), wait_time=3 ) except StopIteration: break 。我正在使用E在react native中创建选项卡。我试过下面的代码。尽管我的逻辑返回了标签createBottomTabNavigator的{​​{1}},但tabBarVisible无法正常工作。请帮忙。谢谢!

false

1 个答案:

答案 0 :(得分:0)

您可以尝试这种方法吗?这应该对嵌套导航器有所帮助:

const getCurrentRouteName = (navigationState) => {
  if (!navigationState) {
    return null;
  }
  const route = navigationState.routes[navigationState.index];
  if (route.routes) {
    return getCurrentRouteName(route);
  }

  return route.routeName;
};

const isTabBarVisible = (navigationState) => {
  return getCurrentRouteName(navigationState) !== 'E'
}