最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - React Native with Expo BlurView on Android - Persistent Overlay - Stack Overflow

programmeradmin0浏览0评论

I'm developing a React Native app using Expo and experiencing issues with a component I created to show a loader using Expo BlurView.

Basically, when I add the experimentalBlurMethod="dimezisBlurView" to test on Android, a transparent overlay is covering the entire screen, making dark gray colors look like light gray instead. Other than that, everything works as expect, when loading state is true, the component shows up with blur, the only downside is this overlay covering the entire screen.

I've tried:

  • Conditional rendering
  • Adjusting BlurView intensity
  • Adding pointerEvents="none"

Expected behavior:

  • Blur overlay appears during loading
  • Overlay completely disappears when loading is false
import React from 'react';
import { View, ActivityIndicator, StyleSheet } from 'react-native';
import { BlurView } from 'expo-blur';
import Colors from '@/constants/Colors';

const LoadingOverlay = ({ loading }: { loading?: boolean }) => {
  if (!loading) return null;

  return (
    <View style={styles.container}>
      <BlurView intensity={20} style={styles.blurView} experimentalBlurMethod="dimezisBlurView">
        <View style={styles.loadingBox}>
          <ActivityIndicator size="large" color={Colors.PRIMARY} />
        </View>
      </BlurView>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    ...StyleSheet.absoluteFillObject,
    zIndex: 999,
  },
  blurView: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  loadingBox: {
    backgroundColor: Colors.WHITE,
    padding: 20,
    borderRadius: 20,
  },
});

export default LoadingOverlay;

Can anyone help resolve this BlurView rendering issue?

发布评论

评论列表(0)

  1. 暂无评论