Kureev / react-native-blur

React Native Blur component
MIT License
3.74k stars 555 forks source link

BlurView does not fully respect render order #506

Open ErezCsillag opened 1 year ago

ErezCsillag commented 1 year ago

Hey, it seems like the BlurView also "mixes" the colors of none blurred components and creates some sort of color fog around it In the attached pictures you can clearly see the bluish fog caused by it.

I am testing this on an android emulator.

This is my BlurView

 const CustomBlurView = () => (
    <BlurView
      blurType="light"
      overlayColor="transparent"
      blurAmount={25}
      blurRadius={25}
      style={styles.blur}
    />
  );

const styles = StyleSheet.create({
  blur: {
    position: 'absolute',
    top: 0,
    left: 0,
    bottom: 0,
    right: 0,
  },
  icon: {
    overflow: 'hidden',
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'center',
    borderRadius: 8,
    height: 40,
    width: 40,
  }
})

With SVG & Without SVG

qemu-system-x86_64_2022-11-12_10-18-46 qemu-system-x86_64_2022-11-12_10-18-55

<View style={styles.icon}>
  <CustomBlurView />

  <Svg width={24} height={24} fill="none">
    ...
  </Svg>
</View>

With SVG inside the blur view (Cant center it no matter the style...)

qemu-system-x86_64_2022-11-12_21-57-21

<CustomBlurView style={styles.blurView}>
    <Svg .... />
</CustomBlurView>
shashwats-greytip commented 1 year ago

Did you find any solution for that? One way is to provide position as absolute but, in that blur bleeds out in android

dutradotdev commented 1 year ago

@shashwatgreytip take a look at my solution: https://gist.github.com/dutradotdev/50c82763fc621ab3c1bd5ba02180ce0d