-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChanel2.js
41 lines (36 loc) · 1.14 KB
/
Chanel2.js
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
// import { View, Text, ScrollView } from "react-native";
import { View, Text } from "react-native";
import { ScrollView } from "react-native-gesture-handler";
import React from "react";
import { items } from "./Model";
import Card, { MAX_HEIGHT } from "./Card";
import Animated, {
useSharedValue,
useAnimatedStyle,
withSpring,
useAnimatedScrollHandler,
} from "react-native-reanimated";
import Card2 from "./Card2";
const Chanel2 = () => {
let y = useSharedValue(0);
let onScroll = useAnimatedScrollHandler({
onScroll: (event) => {
y.value = event.contentOffset.y;
console.log(event.contentOffset);
},
});
return (
<Animated.ScrollView
// scrollEventThrottle={16}
onScroll={onScroll}
contentContainerStyle={{ height: (items.length + 1) * MAX_HEIGHT }}
snapToInterval={MAX_HEIGHT}
decelerationRate="fast"
>
{items.map((item, index) => (
<Card2 y={y} index={index} item={item} key={index} />
))}
</Animated.ScrollView>
);
};
export default Chanel2;