【问题标题】:What's wrong with this implementation for headerStyle? I want to hide the shadow/elevation of the headerheaderStyle 的这个实现有什么问题?我想隐藏标题的阴影/高度
【发布时间】:2021-11-28 09:40:27
【问题描述】:

https://drive.google.com/file/d/1456izDo_zxkFxqAti7Kd4Reaer5mwzOh/view?usp=sharing

我想隐藏标题的阴影,但不能这样做。我尝试使用 navigationOptions 但找不到隐藏标题阴影的方法。 backgroundColor 工作正常,但阴影不是。请找出错误。谢谢。

const Stack = createNativeStackNavigator();

<Stack.Navigator
    defaultNavigationOptions={{}}
    screenOptions={({navigation}) => ({
      headerBackTitleVisible: false,
      title: '',
      headerStyle: {
        backgroundColor: 'papayawhip',
        elevation: 0,
        shadowOpacity: 0,
        borderBottomWidth: 0,
      },
      headerLeft: () => (
        <AppMaterialIcon
          onPress={() => navigation.goBack()}
          name={'chevron-left'}
          style={{marginLeft: -10}}
          size={35}
          color={colors.kermitGreen}
          backgroundColor={colors.white}
        />
      ),
    })}>
    <Stack.Screen
      name="ForgotPasswordEmail"
      component={ForgotPasswordEmailScreen}
    />
</Stack.Navigator>

【问题讨论】:

  • 这不是影子。是状态栏

标签: javascript react-native react-navigation


【解决方案1】:

我刚刚做的是设置 headerShadowVisible: false。成功了!!

【讨论】:

    猜你喜欢
    • 2013-06-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-10
    • 2021-10-17
    • 2011-09-28
    • 2011-12-14
    • 2017-08-05
    相关资源
    最近更新 更多