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,
    }

 

posted @ 2017-05-19 11:35  天清云澈  阅读(1733)  评论(0)    收藏  举报