我正在使用 react-native-router-flux 并设置了导航栏。目前,导航栏的高度被设计为比默认高度更短,因此导航栏容器内的元素位置较低,靠近导航栏容器的底部。
我试过navigationBarStyle={{backgroundColor: 'pink', height: 55, flex: 1, justifyContent: 'center'}}
了,但还是没有运气。
如何将导航栏中的元素垂直居中?
目前,右侧导航栏按钮Settings
设置为导航到Settings
组件。但是在Settings
页面上,想去掉Settings
右边导航栏的按钮。我该怎么做?
这是它的外观(粉红色背景的导航栏是容器,左侧的抽屉按钮、场景标题(主页)和右侧的设置按钮靠近导航栏的底部):
这是代码:
const RouterWithRedux = connect()(Router)
const store = configureStore()
export default class App extends Component {
constructor() {
super()
}
render() {
return (
<Provider store={store}>
<RouterWithRedux>
<Scene key='root'>
<Scene component={Login} hideNavBar initial={true} key='login' sceneStyle={{backgroundColor: 'black'}} title='Login' type='reset'/>
<Scene key='drawer' component={NavDrawer} open={false}>
<Scene key="main" navigationBarStyle={{backgroundColor: 'pink', height: 55, flex: 1, justifyContent: 'center'}} onRight={() => Actions.settings()} rightTitle='Settings'>
<Scene
component={Home}
initial={true}
key='home'
sceneStyle={{backgroundColor: 'black'}}
title='Home'
type='reset'
/>
<Scene
component={Settings}
direction='vertical'
key='settings'
sceneStyle={{backgroundColor: 'black'}}
title='Settings'
/>
</Scene>
</Scene>
</Scene>
</RouterWithRedux>
</Provider>
)
}
}
先感谢您