Please help me!
My code:
import { ScrollView, View, Text, Button } from 'react-native';
import Animated, {
useSharedValue,
useAnimatedStyle,
useAnimatedScrollHandler,
interpolate,
} from 'react-native-reanimated';
export default function SomeComponent({ children }) {
const translationY = useSharedValue(0);
const scrollHandler = useAnimatedScrollHandler((event) => {
translationY.value = event.contentOffset.y;
// console.log(translationY.value)
});
const stylez = useAnimatedStyle(() => {
// console.log(translationY.value)
const scale = interpolate(translationY.value,
[-100, 0],
[2, 1],
{ extrapolateRight: Extrapolation.CLAMP }
);
return {
transform: [{ scale: scale }],
};
});
return (
<View>
<Animated.Text style={[styles.box, stylez]}>
{translationY.value}
</Animated.Text>
<Animated.ScrollView
onScroll={scrollHandler}
scrollEventThrottle={16}
>
{children}
</Animated.ScrollView>
</View>
);
}
const styles = {
box: {
position: 'absolute',
width: 360,
height: 150,
zIndex: 1000,
backgroundColor: 'green'
}
}