The BlurView component provides blur effects on iOS (using UIVisualEffectView) and Android (using BlurView). To blur content, position the BlurView on top of the elements you want to blur using absolute positioning.
import React from "react";
import { View, Image, Text, StyleSheet } from "react-native";
import { BlurView } from "@react-native-community/blur";
export default function Menu() {
return (
<View style={styles.container}>
<Image
key={'blurryImage'}
source={{ uri: 'https://example.com/image.png' }}
style={styles.absolute}
/>
<Text style={styles.absolute}>Hi, I am some blurred text</Text>
{/* The BlurView will blur everything positioned behind it */}
<BlurView
style={styles.absolute}
blurType="light"
blurAmount={10}
reducedTransparencyFallbackColor="white"
/>
<Text>I'm the non blurred text because I got rendered on top of the BlurView</Text>
</View>
)
}
const styles = StyleSheet.create({
container: {
justifyContent: "center",
alignItems: "center"
},
absolute: {
position: "absolute",
top: 0,
left: 0,
bottom: 0,
right: 0
}
});