小编sno*_*itz的帖子

带图像背景的 SafeAreaView

我目前正在尝试SafeAreaView支持 iPhone X 渲染功能。问题是,我使用了ImageBackground来自react-native 的组件包含了一个图像。

有没有办法将图像也渲染为状态栏的背景?

当前代码:

<SafeAreaView style={{flex: 1}}>
  <StyleProvider style={getTheme(variables)}>
    <Container>
      <ImageBackground source={landingpageBg} style={styles.imageContainer}>
        <View
          style={{
            flex: 1,
            justifyContent: "center",
            alignItems: "center",
            backgroundColor: "transparent"
          }}
        >
          <H3 style={styles.text}>Hello World</H3>
          <View style={{ marginTop: 8 }} />
          <Button
            style={styles.buttonColor}
            onPress={() => this.pressButton()}
          >
            <Text>Let's Go!</Text>
          </Button>
        </View>
      </ImageBackground>
    </Container>
  </StyleProvider>
</SafeAreaView>
Run Code Online (Sandbox Code Playgroud)

目前的样子

react-native iphone-x

7
推荐指数
1
解决办法
6812
查看次数

标签 统计

iphone-x ×1

react-native ×1