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