react-native-blur icon indicating copy to clipboard operation
react-native-blur copied to clipboard

BlurView does not fully respect render order

Open ErezCsillag opened this issue 2 years ago • 2 comments

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>

ErezCsillag avatar Nov 12 '22 08:11 ErezCsillag

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

shashwats-greytip avatar Nov 15 '22 18:11 shashwats-greytip

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

dutradotdev avatar Feb 09 '23 22:02 dutradotdev