MCPcopy Index your code
hub / github.com/callstack/react-native-pager-view / PaperExample

Class PaperExample

example/src/PaperExample.tsx:25–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23};
24
25class PaperExample extends React.Component<any, State> {
26 viewPager = React.createRef<PagerView>();
27
28 constructor(props: any) {
29 super(props);
30
31 const pages = [];
32 for (let i = 0; i < PAGES; i++) {
33 pages.push(createPage(i));
34 }
35
36 this.state = {
37 page: 0,
38 animationsAreEnabled: true,
39 scrollEnabled: true,
40 progress: {
41 position: 0,
42 offset: 0,
43 },
44 pages: pages,
45 scrollState: 'idle',
46 dotsVisible: false,
47 };
48 }
49
50 onPageSelected = (e: any) => {
51 this.setState({ page: e.nativeEvent.position });
52 };
53
54 onPageScroll = (e: any) => {
55 this.setState({
56 progress: {
57 position: e.nativeEvent.position,
58 offset: e.nativeEvent.offset,
59 },
60 });
61 };
62
63 onPageScrollStateChanged = (e: any) => {
64 this.setState({ scrollState: e.nativeEvent.pageScrollState });
65 };
66
67 addPage = () => {
68 this.setState((prevState) => ({
69 pages: [...prevState.pages, createPage(prevState.pages.length)],
70 }));
71 };
72
73 removeLastPage = () => {
74 this.setState((prevState) => ({
75 pages: prevState.pages.slice(0, prevState.pages.length - 1),
76 }));
77 };
78 move = (delta: number) => {
79 const page = this.state.page + delta;
80 this.go(page);
81 };
82

Callers

nothing calls this directly

Calls 1

createPageFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…