导航到场景,没有回来出现



我正在构建一个头像构建器,并且我对React-Native-native-nive-native-router-flux的实施遇到了一些问题。在下面的示例中,我将用户降落在"家"上。他们访问了比赛现场,然后将它们发送到子节目场景。我的问题是,当我完成选择子句话时,我使用Actions.home将它们发送回家。它使他们回家,但还启用了后退按钮。任何帮助将不胜感激。

export default class App extends Component {
  render() {
    return (
        <Router>
          <Scene key= 'root'>
            <Scene key= "home" hidenavbar={true} component={HomeScreen} title="Create Character" initial={true} />
            <Scene key= "race" component={Race} title="Choose Race"  />
            <Scene key= "subrace" component={Subrace} title="Choose Subrace" />
          </Scene>
        </Router>
    );
  }
}

以下是子节目组件

export default class Subrace extends Component {
   render(){
    return (
      <Container>
        <Header><Title>Choose Subrace</Title></Header>
        <Content>
          <List>
            <ListItem button onPress = {Actions.home}>
              <Thumbnail square size={80}/>
              <Text>Underground elf</Text>
            </ListItem>
            <ListItem button onPress = {Actions.home}>
              <Thumbnail  square size={80} />
              <Text>forest elf</Text>
            </ListItem>
          </List>
        </Content>
      </Container>
    );
  }
}

尝试以下:

export default class Subrace extends Component {
   render(){
    return (
      <Container>
        <Header><Title>Choose Subrace</Title></Header>
        <Content>
          <List>
            <ListItem button onPress={() => Actions.home({ type: 'reset' })}>
              <Thumbnail square size={80}/>
              <Text>Underground elf</Text>
            </ListItem>
            <ListItem button onPress={() => Actions.home({ type: 'reset' })}>
              <Thumbnail  square size={80} />
              <Text>forest elf</Text>
            </ListItem>
          </List>
        </Content>
      </Container>
    );
  }
}

相关内容

  • 没有找到相关文章

最新更新