【发布时间】:2021-02-07 13:46:26
【问题描述】:
我正在尝试在屏幕标题标题右侧呈现一个按钮。但我没有得到想要的结果。我已经推荐了 react-navigation 官方doc。这是我屏幕的screenshot。
这是我导航的代码 sn-p。
<NavigationContainer>
<Stack.Navigator screenOptions={{
headerStyle: {
backgroundColor: Colors.header.backgroundColor,
},
headerTintColor: Colors.header.fontColor,
headerTitleAlign: 'left',
headerTitleStyle: {
fontSize: Fonts.size.regular
}
}}>
<Stack.Screen name='Home' component={Home} options={{
headerTitle: 'Seguro',
headerRight: () => {
<Button // I want to render this button
onPress={() => console.log('This is a button!')}
title="Info"
color="#fff"
/>
}
}} />
<Stack.Screen name='Login' component={Login} />
</Stack.Navigator>
</NavigationContainer>
【问题讨论】:
标签: react-native react-navigation react-navigation-stack