【问题标题】:headerLeft is not working in reactNavigation V3headerLeft 在 reactNavigation V3 中不起作用
【发布时间】:2019-08-07 23:20:49
【问题描述】:

我检查了以前的答案并尝试了不同的方法,但仍然无法正常工作。只有当我在屏幕内使用静态 navigationOptions 时它才有效

我尝试使用 defaultNavigationOptions 但不起作用,其上的 navigationOptions 也不起作用

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”的按钮,但没有出现任何按钮。

【问题讨论】:

    标签: react-native react-navigation


    【解决方案1】:

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

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

    Example of button execution

    【讨论】:

    • 不是真的,我的标题颜色是深蓝色,我什至看不到按钮正文
    猜你喜欢
    • 2022-11-23
    • 2016-03-16
    • 1970-01-01
    • 1970-01-01
    • 2020-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-12
    相关资源
    最近更新 更多