0
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 5 years have passed since last update.

【React Navigation】ヘッダーを透明にして影を消す方法

Posted at

headerTransparentをtrueに 

さっそくコードですが、

const MainStack = createStackNavigator(
  {
    Home: {
      screen: HomeScreen,
    },
    Details: {
      screen: DetailsScreen,
      navigationOptions:() => ({
        title: '',
        headerTransparent:true,  //<-ここでヘッダーを透明に
      })
    },
  }
);

このようにすることでヘッダーを透明にして影を消すことができました。

試したがダメだった方法

https://github.com/react-navigation/react-navigation/issues/790
ここなどに書いてあるのですが、

  navigationOptions = {
      headerStyle: {
        elevation: 0,
        shadowOpacity: 0
      }
  }

このようにしても自分はうまくいきませんでした...
backgroundColor = "transparentにしていたからかも?

とりあえず、自分は
headerTransparent:true
とすることでうまくいったのでもしよければ試してみてください!

0
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
0
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?