在react-native-router-flux导航上隐藏tabBar和navBar

时间:2017-09-21 07:33:45

标签: react-native react-native-router-flux

我使用react-native-router-flux navigation(版本: ^ 4.0.0-beta.21 )作为React Native。(版本: 0.48.3 < /强>) 场景如下:

<Scene key="scene_condition"
       tabs={true}
       type="reset"
       tabBarStyle={styles.tabBarStyle}
       tabBarSelectedItemStyle={styles.tabBarSelectedItemStyle}
       navigationBarStyle={styles.navBarStyle}
       titleStyle={styles.navBarTitleStyle}
       hideTabBar={false}
       hideNavBar={true}
       duration={0}
       tabBarPosition="bottom"
       labelStyle={{fontSize: 7}}
       title="">
    <Scene key="scene_condition_car"
           tabBarLabel={gettext("Model")}
           title={gettext("Model")}
           component={Car}
           icon={TabIcon}
           duration={0}
           iconTittleHidden
           iconName="directions-car"
           leftButtonIconStyle={styles.moduleButton}
           leftButtonImage={require('./img/icons/left.png')}
           onLeft={(props) => requestOverview(props.request.id)}
           navigationBarStyle={styles.navBarStyle}
           titleStyle={styles.navBarTitleStyle}/>
    <Scene key="scene_condition_specs"
           tabBarLabel={gettext("Specifications")}
           title={gettext("Specifications")}
           labelStyle={{fontSize: 18}}
           component={CarSpecs}
           icon={TabIcon}
           iconTittleHidden
           duration={0}
           iconName="control-point-duplicate"
           leftButtonIconStyle={styles.moduleButton}
           leftButtonImage={require('./img/icons/left.png')}
           onLeft={(props) => requestOverview(props.request.id)}
           navigationBarStyle={styles.navBarStyle}
           titleStyle={styles.navBarTitleStyle}/>
    <Scene key="scene_condition_picture"
           tabBarLabel={gettext("Pictures")}
           title={gettext("Pictures")}
           component={CarPicture}
           icon={TabIcon}
           iconTittleHidden
           duration={0}
           iconName="photo-camera"
           leftButtonIconStyle={styles.moduleButton}
           leftButtonImage={require('./img/icons/left.png')}
           onLeft={(props) => requestOverview(props.request.id)}
           navigationBarStyle={styles.navBarStyle}
           titleStyle={styles.navBarTitleStyle}/>
</Scene>
因此,主要场景和三个标签场景。我的问题是如何使用键scene_condition_picture在选项卡场景中隐藏tabBar和navBar?

该组件的render方法如下:

render() {
        const self=this;

        if(this.state.showCamera){
            return <CameraApp cameraData={this.state.data}/>;
        }

        return (
            <View>
                <StatusBar backgroundColor="blue" barStyle="light-content"/>
                <Zoom visible={this.state.zoomVisible} close={() => this.setState({zoomVisible: false})} image={this.state.zoomImage} imageIndex={this.state.zoomIndex} pictures={this.state.zoomPictures} remove={this.onRemoveImage.bind(this)} />
                <FlatList
                    data={this.state.pictures}
                    renderItem={({item}) => {
                        return (
                            <View style={styles.card}>
                                <Card title={item.title} mandatory={item.mandatory} image={item.image} noImage={item.noImage} onPress={() => self.pictureOverlay(item)}/>
                            </View>
                        )
                    }}
                    keyExtractor={() => Common.generateUUID()}
                    numColumns={3}
                />
            </View>
        )
    }

因此,我只想在this.state.showCameratrue时隐藏tabBar和navBar。然后我想加载相机,我不需要 tabBar navBar

如果this.state.showCamera为false,那么我想要显示 tabBar navBar ,这种情况就好了。

因此,如果this.state.showCameratrue,我唯一需要隐藏 tabBar navBar

有什么想法吗?

0 个答案:

没有答案