React Navigation default background color

前端 未结 6 1254
春和景丽
春和景丽 2021-01-02 16:45

I\'m using react-navigation and stack-navigator to manage my screens.

Platforms I\'m using:

  • Android
  • React Native: 0.47.1
  • React Naviga
6条回答
  •  遥遥无期
    2021-01-02 17:28

    As of react-navigation@2.17.0 there is a config option transparentCard that makes this possible.

    const RootNavigator = createStackNavigator(
      {
        App,
        YourModal,
      },
      {
        headerMode: 'none',
        mode: 'modal',
        transparentCard: true,
      },
    );
    

    This won't blur the background for you; it will just make it transparent. To properly blur it, you'll need to do something like this. Make sure you start the background way above the top edge of the screen, since the card will animate in from the bottom, and you probably want the screen to gradually blur instead of the opacity having a sharp edge as it animates in.

提交回复
热议问题