aksonov / react-native-router-flux

The first declarative React Native router
MIT License
8.99k stars 2.11k forks source link

hideTabBar doesn't work in NewVersion 0.58 #3430

Open mengerpiao opened 5 years ago

mengerpiao commented 5 years ago

when push the ModelDetail ,TabBar could't hide.How fix it? Tks

"dependencies": { "@appandflow/masonry-list": "^0.4.0", "crypto-js": "^3.1.9-1", "react": "16.6.3", "react-native": "0.58.4", "react-native-keyboard-aware-scroll-view": "^0.8.0", "react-native-router-flux": "^4.0.6", "react-native-vector-icons": "^6.3.0", "xmldom": "^0.1.27" },

        <Router createReducer={reducerCreate}
                    backAndroidHandler={onBackPress}
        >
        <Scene key='root' hideNavBar  >
            <Scene key="launch" initial={true} component={launch} title="Launch" hideNavBar hideTabBar />
            <Scene key="login" component={Login} hideNavBar/>
            <Scene key="agreement" component={Agreement} hideNavBar={false}/>
            <Tabs
                key='tabbar'
                type={ActionConst.REPLACE}
                tabBarPosition='bottom' 
                tabBarStyle={{height:40}}
                showLabel={false}
                lazy={true} 
                activeTintColor='#c489e7' 
                navigationBarStyle={{ backgroundColor: '#C4A9F6',borderBottomWidth:0 }} 
                titleStyle={{ color: 'white', alignSelf: 'center' }} 
                backTitle=" "
                backButtonTintColor='white'
            >
                <Stack
                    key="tab1"
                    icon={TabIcon}
                    idx={0}
                >
                    <Scene key="Model" component={Model} hideNavBar/>
                    <Scene key="ModelDetail" component={ModelDetail} hideNavBar hideTabBar/>
                    <Scene key="Moka" component={Moka} title="红人模卡"  hideTabBar/>
                </Stack>

                <Stack
                    key="tab2"
                    icon={TabIcon}
                    idx={1}
                >
                    <Scene key="DemandRelease" component={DemandRelease} title="发布需求"  hideTabBar back/>
                    <Scene key="DemandSuccess" component={DemandSuccess} title="发布成功"  hideTabBar />
                </Stack>
            </Tabs>
        </Scene>
</Router>

2019-02-20 11_46_29

IjzerenHein commented 5 years ago

I'm experiencing the same issue.. I do think I've found a workaround though. Try passing hideTabBar: true to Actions.push like this:

Actions.push('detail', {hideTabBar: true});
mengerpiao commented 5 years ago

@IjzerenHein Thanks a lot . but it's the same issue。

  _onPressContent = (item) => {
    Actions.push('ModelDetail',item,{hideTabBar: true});
}
mengerpiao commented 5 years ago

@IjzerenHein @aksonov I init a new project, I found the cause of the error: Ations.push can not carry parameters。but it's need to take {hideTabBar: true} in the Actions

_onPressContent = (item) => { Actions.push('ModelDetail',{hideTabBar: true}); }

i guess bacause React-Navigation upgrade to 3.x

mengerpiao commented 5 years ago

and i tried to use Actions.'ScreenKey' ,is normal ex:

_onPressContent(item){
    // Actions.push('ModelDetail',item,{hideTabBar :true});
    Actions.ModelDetail({data:item})
}
iamcxa commented 4 years ago

I can confirm this bug still exists in newest RNRf@4.2.0 release with React-Native@0.61.5 and react-navigation@4.0.10.

so the major issue is passing hideTabBar prop to a <Scene /> like <Scene key="sceneKey" hideTabBar /> is not working but using the way Actions['sceneKey']({ hideTabBar: true }) works.

hope @aksonov can fix it soon 🙏