如何在响应本机导航中的每个屏幕上显示标题

问题描述 投票:0回答:1

看起来标题默认情况下仅适用于堆栈导航器。我想知道如何显示从导航器打开的任何屏幕的标题吗?

我在主屏幕上具有的代码

const createHomeStack = () =>
<Stack.Navigator>
 <Stack.Screen
  name='Feed'
  component={Feed}
 />
 <Stack.Screen name='Details' component={Details} />
 </Stack.Navigator>

const createBottomTabs = () =>
 <MaterialBottomTabs.Navigator>
  <MaterialBottomTabs.Screen name='Decks' component={Decks} />
  <MaterialBottomTabs.Screen name='Study' component={Study} />
 </MaterialBottomTabs.Navigator >

export default function App() {


 return (
 <Provider store={store}>
  <NavigationContainer>
      <Drawer.Navigator>
        <Drawer.Screen name='Home' children={createHomeStack}
          options={{
            title: 'My home',
            headerStyle: {
              backgroundColor: '#f4511e',
            },
            headerTintColor: '#fff',
            headerTitleStyle: {
              fontWeight: 'bold',
            },
          }}
        />
        <Drawer.Screen name='Translate' component={TranslateScreen} />
        <Drawer.Screen name='History' component={History} />
        <Drawer.Screen name='Study' component={createBottomTabs} />
      </Drawer.Navigator>
  </NavigationContainer>
  </Provider>
 );
 }

我要查找的屏幕快照类似于在每个屏幕上都带有打开或关闭的导航器的标题的屏幕快照。

screenshot

react-native react-native-navigation
1个回答
0
投票

您可以看一下React-native-elements-header

我认为这就是您想要的。

© www.soinside.com 2019 - 2024. All rights reserved.