React-native-router-flux: 如何重置历史?

创建于 2016-04-12  ·  3评论  ·  资料来源: aksonov/react-native-router-flux

版本

  • react-native-router-flux v3.2.13
  • 反应原生 v0.24.0-rc2

如果我有初始场景是搜索的场景:

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"});

所有3条评论

Actions.signin({type: "reset"});

这不是正确的方法...
如果我添加 'Actions.signin({type: "reset"})' 导航将无法正常工作。
在'Actions.signin({type: "reset"})'之后,'Actions.search'在登录组件中不起作用

525

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

GCour picture GCour  ·  3评论

fgrs picture fgrs  ·  3评论

vinayr picture vinayr  ·  3评论

sreejithr picture sreejithr  ·  3评论

maphongba008 picture maphongba008  ·  3评论