2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

React Navigationのヘッダー下のborderを消す

Last updated at Posted at 2020-04-02

前提

  • ReactNative 0.61.4
  • react-navigation v5

問題

ヘッダーとコンポーネントが連続して一つに見える、以下のようなデザインを実装したいのだが、
境界の白線が消せない。

image.png

一体どこをいじったらいいのか。

方法

shadowColor: 'transparent' をheaderStyleに設定すれば消える。

※追記(Androidの方はこれも必要でした。)
elevation: 0 をheaderStyleに設定すれば消える。

念のためコードは以下


<NavigationContainer theme={Theme}>
     <Stack.Screen
          name={screen}
          component={Screen}
          options={{
            title: 'Header Title',
            headerStyle: {
              shadowColor: 'transparent', //ここ(iOS)
              shadowOpacity: 0, // ここ(iOSはこちらでも可)
              elevation: 0, // ここ(Android)
            },
          }}
        />
      </Stack.Navigator>
</NavigationContainer>

参考記事

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?