MCPcopy
hub / github.com/callstack/react-native-pager-view / PagerHookExample

Function PagerHookExample

example/src/PagerHookExample.tsx:8–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6import { usePagerView } from 'react-native-pager-view';
7
8export function PagerHookExample() {
9 const { AnimatedPagerView, ref, ...rest } = usePagerView({ pagesAmount: 10 });
10
11 return (
12 <SafeAreaView style={styles.container}>
13 <AnimatedPagerView
14 testID="pager-view"
15 ref={ref}
16 style={styles.PagerView}
17 initialPage={0}
18 {...rest}
19 pageMargin={10}
20 >
21 {useMemo(
22 () =>
23 rest.pages.map((_, index) => (
24 <View
25 testID="pager-view-content"
26 key={index}
27 style={{
28 flex: 1,
29 backgroundColor: '#fdc08e',
30 alignItems: 'center',
31 padding: 20,
32 }}
33 collapsable={false}
34 >
35 <LikeCount />
36 <Text
37 testID={`pageNumber${index}`}
38 >{`page number ${index}`}</Text>
39 </View>
40 )),
41 [rest.pages]
42 )}
43 </AnimatedPagerView>
44 <NavigationPanel {...rest} />
45 </SafeAreaView>
46 );
47}
48
49const styles = StyleSheet.create({
50 container: {

Callers

nothing calls this directly

Calls 1

usePagerViewFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…