效果圖:
效果圖.gif
1.在tabbar下提供一個(gè)隱藏tabbar與否的參數(shù)
getInitialState(){
return{
tabType:'1',
hiddenTab:false,
}
},
2.布局的時(shí)候根據(jù)hiddenTab改變tabbar的位置
var bottom = this.state.hiddenTab==true?-49:0;
return(
<TabBarIOS style={[commonStyles.flex,{marginBottom:bottom}]}>
3.添加tabbar隱藏函數(shù),并作為參數(shù)傳遞
hiddenTabbar:function (hidden:boolean) {
this.setState({
hiddenTab:hidden
})
}
<TabBarIOS.Item
title="項(xiàng)目列表"
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.相關(guān)操作后,隱藏tabbar,我這里是點(diǎn)擊cell進(jìn)入下一界面
_pressRow:function (rowData: id,rowID: number) {
this.props.hiddenTabbar(true)
},