@react-native-community/blur 不适用于世博会?

Крі*_*ріс 7 react-native expo

我正在使用 Expo,我正在使用<BlurView />.. @react-native-community/blur,它引发了我的错误Invariant Violation: requireNativeComponent: "BlurView" was not found in the UIManager.。世博会不支持吗@react-native-community/blur

展会版本:40.0.0 模拟器:Android

其他注意事项:

我确实尝试过expo-blur,但它并没有像我预期的那样模糊..所以这就是我使用@react-native-community/blur.

    <ImageBackground source={background} style={styles.imageContainer}>
      <SafeAreaView style={styles.container}>
        <StatusBar backgroundColor={THEME.WHITE} barStyle='dark-content' />
        <BlurView style={styles.formContainer}>
          <View style={{ marginBottom: 15 }}>
            <Input
              leftIcon={
                <Icon
                  color={THEME.GREY_6}
                  name='email'
                  type={ICON.MaterialCommunityIcons}
                  variant={VARIANT.MEDIUM}
                />
              }
              placeholder='Email'
              onChangeText={(e) => onChangeEmail(e)}
            />
          </View>
          <View>
            <Input
              leftIcon={
                <Icon
                  color={THEME.GREY_6}
                  name='onepassword'
                  type={ICON.MaterialCommunityIcons}
                  variant={VARIANT.MEDIUM}
                />
              }
              placeholder='Password'
              onChangeText={(e) => onChangeEmail(e)}
            />
          </View>
          <View style={styles.forgotPassContainer}>
            <Text style={styles.text}>Forgot Password?</Text>
          </View>
          <View style={styles.loginButton}>
            <Button label='Login' onPress={handleLogin} />
          </View>
          <View
            style={{
              padding: 15,
              alignItems: 'center',
              borderTopWidth: 0.2,
              marginTop: 15,
            }}
          >
            <Text style={styles.text}>Sign Up</Text>
          </View>
        </BlurView>
      </SafeAreaView>
    </ImageBackground>
Run Code Online (Sandbox Code Playgroud)

我想要实现的目标是使formContainer背景变得模糊。

小智 0

试试这个代码。我使用的是expo-blur的 BlurView

<View style={{flex: 1}}>
   <BlurView tint="dark" intensity={100} style={{ position: 'absolute', height:'100%', width:'100%,}} />
   <View style={{flex: 1}}>
      //content here
   </View>
</View>
Run Code Online (Sandbox Code Playgroud)

  • Expo Blur 视图在 Android 上并不能真正工作,它只是创建了一个小的不透明度背景,它不会模糊背景,你知道还有其他可以给出预期结果的包吗? (2认同)