A customizable tint blur effect component for React Native that creates smooth gradient blur overlays. Perfect for creating modern iOS-style blurred backgrounds with gradient masks.
- π¨ Gradient Blur Effects: Create smooth blur transitions in any direction
- π§ Highly Customizable: Control blur intensity, tint, gradient locations, and directions
- π± iOS Optimized: Uses native iOS blur effects with expo-blur
- π― Easy to Use: Simple API with sensible defaults
- πͺ Flexible Styling: Supports custom styles and props for all underlying components
npm install react-native-tint-blurThis package requires the following peer dependencies:
npm install expo-blur expo-linear-gradient @react-native-masked-view/masked-viewFor Expo projects:
expo install expo-blur expo-linear-gradient @react-native-masked-view/masked-viewimport React from 'react';
import { View, Text, ImageBackground } from 'react-native';
import TintBlur from 'react-native-tint-blur';
const App = () => {
return (
<View style={{ flex: 1 }}>
<ImageBackground
source={{ uri: 'https://example.com/your-image.jpg' }}
style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}
>
<Text style={{ fontSize: 24, color: 'white' }}>
Content behind blur
</Text>
{/* Bottom gradient blur overlay */}
<TintBlur
direction="bottom"
intensity={30}
tint="dark"
style={{ height: 200 }}
/>
</ImageBackground>
</View>
);
};
export default App;import React from 'react';
import { View, Text, ImageBackground, StyleSheet } from 'react-native';
import TintBlur from 'react-native-tint-blur';
const AdvancedExample = () => {
return (
<View style={styles.container}>
<ImageBackground
source={{ uri: 'https://example.com/background.jpg' }}
style={styles.background}
>
{/* Content */}
<View style={styles.content}>
<Text style={styles.title}>Beautiful Blur Effect</Text>
<Text style={styles.subtitle}>Smooth gradient transitions</Text>
</View>
{/* Top blur overlay */}
<TintBlur
direction="top"
intensity={25}
tint="light"
locations={[0, 0.4]}
style={styles.topBlur}
/>
{/* Bottom blur overlay */}
<TintBlur
direction="bottom"
intensity={35}
tint="dark"
locations={[0, 0.6]}
style={styles.bottomBlur}
/>
</ImageBackground>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
},
background: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
content: {
alignItems: 'center',
zIndex: 1,
},
title: {
fontSize: 32,
fontWeight: 'bold',
color: 'white',
textAlign: 'center',
marginBottom: 8,
},
subtitle: {
fontSize: 18,
color: 'rgba(255, 255, 255, 0.8)',
textAlign: 'center',
},
topBlur: {
height: 150,
top: 0,
},
bottomBlur: {
height: 200,
bottom: 0,
top: 'auto',
},
});
export default AdvancedExample;| Prop | Type | Default | Description |
|---|---|---|---|
direction |
'top' | 'bottom' | 'left' | 'right' |
'bottom' |
Direction of the gradient blur effect |
locations |
number[] |
[0, 0.25] |
Array of numbers defining gradient stop locations (0-1) |
intensity |
number |
25 |
Blur intensity (0-100) |
tint |
'light' | 'dark' | 'default' |
'light' |
Blur tint style |
style |
ViewStyle |
{} |
Custom styles for the container |
blurProps |
BlurViewProps |
{} |
Additional props passed to the BlurView component |
maskedViewProps |
MaskedViewProps |
{} |
Additional props passed to the MaskedView component |
linearGradientProps |
LinearGradientProps |
{} |
Additional props passed to the LinearGradient component |
'bottom': Blur fades from bottom to top (transparent β opaque)'top': Blur fades from top to bottom (transparent β opaque)'left': Blur fades from left to right (transparent β opaque)'right': Blur fades from right to left (transparent β opaque)
'light': Light blur effect with bright appearance'dark': Dark blur effect with dark appearance'default': System default blur appearance
- β iOS: Full support with native blur effects
- β Android: Currently not supported (returns empty component)
Note: This component is designed specifically for iOS and uses native iOS blur effects. Android support may be added in future versions.
<TintBlur
direction="bottom"
intensity={30}
tint="light"
style={{ height: 100, bottom: 0 }}
/><TintBlur
direction="top"
intensity={25}
tint="dark"
style={{ height: 80, top: 0 }}
/><TintBlur
direction="bottom"
locations={[0, 0.3, 0.7, 1]}
intensity={40}
style={{ height: 200 }}
/>-
Positioning: The component uses
position: 'absolute'by default. Usestyleprop to customize positioning. -
Z-Index: Make sure to set appropriate
zIndexvalues to layer the blur effect correctly. -
Performance: Higher intensity values may impact performance on older devices.
-
Gradient Locations: Use
locationsarray to fine-tune where the blur starts and ends.
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see the LICENSE file for details.
Created by hydralerne