import { BlurTint, BlurView } from 'expo-blur'; import React, { useCallback, memo, useEffect } from 'react'; import { View, StyleSheet, Text, Image } from 'react-native'; import Animated, { useSharedValue, withRepeat, withTiming } from 'react-native-reanimated'; import useResettingState from '../../utilities/useResettingState'; import Slider from './Slider'; const AnimatedBlurView = Animated.createAnimatedComponent(BlurView); export default memo((props: { tint: BlurTint }) => { const animatedIntensity = useSharedValue(0); const manualIntensity = useSharedValue(0); const [manualIntensityIsActive, setManualIntensityIsActive] = useResettingState(false, 3000); const handleSliderChange = useCallback((value: number) => { setManualIntensityIsActive(true); manualIntensity.value = value; }, []); useEffect(() => { animatedIntensity.value = withRepeat(withTiming(100, { duration: 2000 }), -1, true); }, []); return ( This text is blurred {props.tint} ); }); const styles = StyleSheet.create({ container: { alignItems: 'center', justifyContent: 'center', padding: 6, }, innerContainer: { alignItems: 'center', justifyContent: 'center', }, image: { width: 250, height: 250, }, blurredText: { position: 'absolute', padding: 10, backgroundColor: 'rgb(120,20,20)', color: 'white', fontWeight: 'bold', fontSize: 20, borderRadius: 5, }, blurView: { ...StyleSheet.absoluteFillObject, alignItems: 'center', paddingTop: 20, }, nonBlurredText: { paddingHorizontal: 10, paddingVertical: 4, backgroundColor: 'rgb(120,20,20)', color: 'white', fontWeight: 'bold', fontSize: 18, }, slider: { position: 'absolute', bottom: 10, }, });