Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To Make Partial Blur Effect in React Native

I'm trying to create a 'focus' effect on images in React Native, but I'm unable to create this effect using Blur and Overlay.

Does anyone know how it might be done .. ?

Here's an example of what I had in mind:

enter image description here

like image 220
EladA Avatar asked Dec 12 '25 19:12

EladA


1 Answers

use MaskedView from @react-native-masked-view/masked-view along with BlurView from @react-native-community/blur to get this result

snack link

result: image

code:


export default function App() {
  const { width, height } = useWindowDimensions();
  return (
    <View style={styles.container}>
      <MakedView
        style={{ width, height, alignItems: 'center' }}
        maskElement={
          <BlurView
            tint="dark"
            intensity={54}
            style={{
              width,
              height,
              backgroundColor: 'transparent',
              alignItems: 'center',
              justifyContent: 'center',
            }}>
            <View
              style={{
                width: 200,
                height: 200,
                borderRadius: 100,
                backgroundColor: '#fff',
              }}></View>
          </BlurView>
        }>
        <Image
          style={{ width, height, backgroundColor: 'transparent' }}
          source={{
            uri: 'https://miro.medium.com/max/1200/1*mk1-6aYaf_Bes1E3Imhc0A.jpeg',
          }}
        />
      </MakedView>
    </View>
  );
}
like image 143
Ashwith Saldanha Avatar answered Dec 15 '25 23:12

Ashwith Saldanha