1

我在我的应用程序中使用来自 NativeBase 的组件 FooterTabs,在 Android 中一切正常,但在 iOS 中,当我单击另一个选项卡时,它会显示正确的内容,但在页脚选项卡中不会更改所选选项卡。

switchScreen(tabIndex) {
  this.setState({ tabIndex: tabIndex });
}

return(
  this.state.isLoading ?
  <Spinner color="black"/>
  :
  <Container>
      { tabContent }
    <Footer>
      <FooterTab>
        <Button active={ this.state.tabIndex == 0 ? true: false }
          onPress={ this.switchScreen.bind(this, 0) }>
          <Text>Descubrir</Text>
        </Button>
        <Button active={ this.state.tabIndex == 1 ? true: false }
          onPress={ this.switchScreen.bind(this, 1) }>
          <Text>Mi Galería</Text>
        </Button>
        <Button active={ this.state.tabIndex == 2 ? true: false }
          onPress={ this.switchScreen.bind(this, 2) }>
          <Text>Mis Cuadros</Text>
        </Button>
        <Button active={ this.state.tabIndex == 3 ? true: false }
          onPress={ this.switchScreen.bind(this, 3) }>
          <Text>Perfil</Text>
        </Button>
      </FooterTab>
    </Footer>
  </Container>

在此处输入图像描述

如您所见,我单击“Perfil 选项卡”,它显示了我的“注销”按钮,这很好,但“Mi galeria”选项卡是在页脚选项卡中选择的。

4

1 回答 1

0

我通过在我的情况下重新安装本机基础依赖项来解决它:

  • npm卸载本机基础
  • npm install native-base@2.0.13
  • react-native start --reset-cache
  • react-native run-ios

完毕!!

于 2017-04-05T23:07:28.477 回答