私は 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>
)
}
}
前もって感謝します