react-native之导航栏问题


1. 目前使用的NavigatorIOS组件,在做登录模块实现隐藏导航栏,第二页再显示导航栏,通过state来控制,尝试了多次,在第二页返回首页时,导航栏不能再次隐藏。确认state值已经改变了。

<NavigatorIOS initialRoute={{
                      component: Login,
                      title:'',
                      passProps:{
                          setBarHidden: this.setBarHidden.bind(this),
                      },
                  }}
                  navigationBarHidden={this.setBarHidden}
                  barTintColor='#fff' translucent={true}
                  />

 

2. 思来想去,只能让导航栏一直隐藏,自己写一个导航栏。

                    <TouchableHighlight underlayColor="#fff" onPress={this._back.bind(this)}>
                        <View style={{flexDirection:'row',justifyContent:'flex-start'}}>
                            <View style={styles.go}></View>
                            <Text style={styles.back}>返回</Text>
                        </View>
                    </TouchableHighlight>
    _back(){
        this.props.navigator.pop();
    }
    go:{
        borderLeftWidth: 4 * Util.pixel,
        borderBottomWidth: 4 * Util.pixel,
        width:10,
        height:10,
        transform:[{rotate: '45deg'}],
        borderColor: '#3BC1FF',
        marginRight:2,
        marginLeft:10,
        marginTop:3,
    }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM