headerLeft 在 reactNavigation V3 中不起作用



我已经检查了以前的答案并尝试了不同的方法,但仍然不起作用。仅当我使用静态导航屏幕内的选项时,它才有效

我尝试使用默认导航选项,但不起作用,导航其上的选项不起作用

TIMETABLE = createStackNavigator(
{
timetable: {
screen: timetable,
defaultNavigationOptions: {
title: i18n.t('TIMETABLE'),
headerStyle,
headerTitleStyle,
headerLeft: (
<Button
title="oi"
color="#fff"
/>
)
}
}
}
);
the above does not work and neither the below code: 
TIMETABLE = createStackNavigator(
{
timetable: {
screen: timetable,
navigationOptions: {
title: i18n.t('TIMETABLE'),
headerStyle,
headerTitleStyle,
headerLeft: (
<Button
title="oi"
color="#fff"
/>
)
}
}
}
);

希望在堆栈导航器标题的左侧看到标题为"oi"的按钮,但没有显示任何按钮。

不是因为你的button背景是白色的吗?

navigationOptions: {
title: i18n.t('TIMETABLE'),
headerLeft: (
<View style={{paddingLeft: 20}}>
<Button
title="oi"
color="black"
/>
</View>
)
}

按钮执行示例

最新更新