React Native

React native 네비게이션 옵션을 라우트 네임에 따라 적용방법

Machine_웅 2020. 1. 31. 11:54
728x90
반응형

예시)

 

라우트 네임에 따라서,  탭바를 보여줄지 안보여 줄지  선택

const tabbarVisible = (navigation) => {
    const { routes } = navigation.state;
  
    let showTabbar = true;
    routes.forEach((route) => {
      if (route.routeName === 'WriteBoard') {
        showTabbar = false;
      }
    });
  
    return showTabbar;
  };
// Board2 탭 메뉴 뷰들  createMaterialTopTabNavigator
const Board_TapView2 = createBottomTabNavigator(
    {
        공지사항 :{
            screen:Test_1,
            navigationOptions: ({ navigation }) => ({
                tabBarVisible: tabbarVisible(navigation),
            }),
        },
728x90
반응형