代码之家  ›  专栏  ›  技术社区  ›  Lucas Silveira

如何在一起使用safeAreaView时移除React Native StackNavigator的内部阴影

  •  6
  • Lucas Silveira  · 技术社区  · 7 年前

    我正在使用 import { SafeAreaView } from 'react-native'; 对于新的iPhone X开发,但我在这一领域得到了一个无聊的阴影。如何删除它?

    The image is here

    // Code
    
    import { SafeAreaView } from 'react-native';
    
    <SafeAreaView style={styles.safeArea}>
     ...
    </SafeAreaView>
    
    
    // Style
    safeArea: {
      flex: 1,
      backgroundColor: colors.background,
    },
    

    更新: 我发现这可能与StackNavigator(headerMode:“none”)存在某种冲突。当代码中没有safeAreaView时,堆栈会正确隐藏标头。

    更新2: @朱利安·马利奇,这就是我的观点。Tks公司 enter image description here

    1 回复  |  直到 7 年前
        1
  •  23
  •   Lucas Silveira    7 年前

    我使用React导航属性解决了此问题:

    卡片样式:{阴影颜色:'透明'}

    const Routes = StackNavigator({
      Identify: { screen: IdentifyRoutes },
    }, {
      headerMode: 'none',
      cardStyle: { shadowColor: 'transparent' },
    });