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