【问题标题】:Footer tabs using NativeBase in iOS not working well在 iOS 中使用 NativeBase 的页脚选项卡无法正常工作
【发布时间】:2017-04-03 18:40:05
【问题描述】:

我在我的应用程序中使用 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”选项卡是在页脚选项卡中选择的。

【问题讨论】:

    标签: react-native react-native-android react-native-ios native-base


    【解决方案1】:

    在我的案例中,我通过重新安装本机基础依赖项解决了这个问题:

    • npm 卸载原生库
    • npm install native-base@2.0.13
    • react-native start --reset-cache
    • react-native run-ios

    完成!!

    【讨论】:

    • 很高兴知道你已经开始运行了
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-02
    相关资源
    最近更新 更多