如何为 Android 上的 React Native、React Navigation v6 移除 header 上的阴影?

How do I remove the shadow on header for React Native on Android, React Navigation v6?

影子看起来像这样。

我试过使用

headerStyle: {
      elevation: 0,
      shadowOpacity: 0,
      borderBottomWidth: 0,
    }

但是根据这个link https://reactnavigation.org/docs/native-stack-navigator#options 在 React Navigation v6 中,headerStyle 中唯一支持的 属性 仅是 backgroundColor。

对于 react-navigation v6,您可以使用 headerShadowVisible 来隐藏或显示 header 的影子。

<Stack.Navigator screenOptions={{headerShadowVisible: false}}>
      <Stack.Screen name="Home" component={HomeScreen} />
      <Stack.Screen name="Notifications" component {NotificationsScreen} />
      <Stack.Screen name="Profile" component={ProfileScreen} />
      <Stack.Screen name="Settings" component={SettingsScreen} />
</Stack.Navigator>