How do I hide the shadow under react-navigation headers?

后端 未结 14 983
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-03 21:30

How do I hide the shadow under react-navigation headers?
They look like this.

14条回答
  •  不思量自难忘°
    2021-02-03 21:45

    This works for me:

    export const AppNavigator = StackNavigator(
        {
          Login: { screen: LoginScreen },
          Main: { screen: MainScreen },
          Profile: { screen: ProfileScreen },
        },
        navigationOptions: {
            headerStyle: {
                elevation: 0,
                shadowOpacity: 0,
            }
        }
    );
    

    or

    export const AppNavigator = StackNavigator(
        {
          Login: { screen: LoginScreen },
          Main: { screen: MainScreen },
          Profile: { screen: ProfileScreen },
        },
        header: {
            style: {
                elevation: 0, //remove shadow on Android
                shadowOpacity: 0, //remove shadow on iOS
            }
        }
    );
    

提交回复
热议问题