如果我有初始场景是搜索的场景:
export default Actions.create(
<Scene key="root" titleStyle={{ fontSize: 20, fontFamily: 'Avenir-Roman', color: 'white' }} navigationBarStyle={{ backgroundColor: '#1db198', height: 80, borderBottomWidth: 0 }} >
<Scene key="signin" component={SignIn} title="Accedi all'App" />
<Scene key="signup" component={SignUp} title="Crea il tuo account" />
<Scene key="checkPhone" component={CheckPhone} title="Codice di sicurezza" />
<Scene key="search" component={Search} title="Search" initial={true} />
</Scene>
);
但我重定向到登录场景:
class Search extends Component {
constructor(props) {
super(props);
}
componentWillMount() {
this.checkAuth();
}
checkAuth(){
if( this.props.auth_token && this.props.user_id ) {
//Check if valid
console.log( 'Log: ' + this.props.auth_token )
return
}
Actions.signin()
}
render() {
return (
<FLayout>
<View>
<Text style={sharedStyle.welcome}>
YO!
</Text>
</View>
</FLayout>
);
}
}
如果我想在登录场景中隐藏 backButton ???如何?
Actions.signin({type: "reset"});
这不是正确的方法...
如果我添加 'Actions.signin({type: "reset"})' 导航将无法正常工作。
在'Actions.signin({type: "reset"})'之后,'Actions.search'在登录组件中不起作用
最有用的评论
Actions.signin({type: "reset"});