Cra*_*acs 6 react-native react-navigation react-navigation-v6
我将应用程序更新为 React Navigation 6。在所有屏幕中,我自定义了headerBackImage
,并添加了一些headerRight
文本。在React Navigation 5中,如果headerTitle
太长,它会被直接截断,并在标题末尾添加...,如下所示:
但在 React navigation 6 中,这个功能看起来发生了变化。我添加了一些背景颜色来向您展示标题的剪切:
我看到了这个主题:React Native Navigation Header title too long, 最终溢出,但也许 V6 中添加了新的 props。
这是我的屏幕:
<ProfileStack.Screen
options={({ navigation }: ScreenProps) => ({
headerTitle: 'My header title is not truncated why ?',
headerTitleStyle: {
backgroundColor: EColors.rouge,
},
headerBackImage: () => (
<BackButton />
),
headerTitleAlign: 'center',
headerBackTitle: ' ',
headerRight: () => (
<Text
onPress={() => navigation.navigate('toOtherScreen')}
style={{ marginRight: 20, backgroundColor: EColors.vert }}
>
Infos
</Text>
),
})}
name="screenName"
component={ComponentName}
/>
Run Code Online (Sandbox Code Playgroud)
有人在RN V6中遇到过这种情况吗?
归档时间: |
|
查看次数: |
690 次 |
最近记录: |