1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
import type { PropsWithChildren, ReactElement } from 'react';
import { StyleSheet, Text, View, useColorScheme } from 'react-native';
import Animated, {
interpolate,
useAnimatedRef,
useAnimatedStyle,
useScrollViewOffset,
} from 'react-native-reanimated';
import { ThemedView } from '@/components/ThemedView';
import { ThemedText } from './ThemedText';
const HEADER_HEIGHT = 250;
type Props = PropsWithChildren<{
}>;
export default function ParallaxScrollView({
children,
}: Props) {
const scrollRef = useAnimatedRef<Animated.ScrollView>();
return (
<ThemedView style={styles.container}>
<Animated.ScrollView ref={scrollRef} scrollEventThrottle={16}>
<View style={styles.nav}>
<ThemedText type="title">CAS4</ThemedText>
</View>
<ThemedView style={styles.content}>{children}</ThemedView>
</Animated.ScrollView>
</ThemedView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
nav: {
backgroundColor: 'rgba(10, 10, 10, .5)',
paddingTop: 50,
padding: 10,
},
header: {
height: 250,
overflow: 'hidden',
},
content: {
flex: 1,
padding: 32,
gap: 16,
overflow: 'hidden',
},
});
|