效果圖:
效果圖.gif
1.在tabbar下提供一個隱藏tabbar與否的參數
getInitialState(){
return{
tabType:'1',
hiddenTab:false,
}
},
2.布局的時候根據hiddenTab改變tabbar的位置
var bottom = this.state.hiddenTab==true?-49:0;
return(
<TabBarIOS style={[commonStyles.flex,{marginBottom:bottom}]}>
3.添加tabbar隱藏函數,并作為參數傳遞
hiddenTabbar:function (hidden:boolean) {
this.setState({
hiddenTab:hidden
})
}
<TabBarIOS.Item
title="項目列表"
icon={require('../images/MainView/tab_project@2x.png')}
selectedIcon={require('../images/MainView/tab_project_pre@2x.png')}
selected={this.state.tabType=='1'}
onPress={this.changeController.bind(this,'1')}>
<Project nextPage={this.hiddenTabbar}></Project>
</TabBarIOS.Item>
4.相關操作后,隱藏tabbar,我這里是點擊cell進入下一界面
_pressRow:function (rowData: id,rowID: number) {
this.props.hiddenTabbar(true)
},