-
Notifications
You must be signed in to change notification settings - Fork 463
Expand file tree
/
Copy pathNestPagerView.tsx
More file actions
112 lines (107 loc) · 2.97 KB
/
NestPagerView.tsx
File metadata and controls
112 lines (107 loc) · 2.97 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import React from 'react';
import { StyleSheet, View, SafeAreaView, Animated, Text } from 'react-native';
import PagerView from 'react-native-pager-view';
import { LikeCount } from './component/LikeCount';
import { BGCOLOR } from './utils';
const AnimatedPagerView = Animated.createAnimatedComponent(PagerView);
export function NestPagerView() {
return (
<SafeAreaView style={styles.container}>
<AnimatedPagerView
style={styles.PagerView}
initialPage={0}
layoutDirection="ltr"
pageMargin={10}
orientation="horizontal"
>
<View
key="1"
style={[styles.page, { backgroundColor: BGCOLOR[0] }]}
collapsable={false}
>
<LikeCount />
</View>
<View style={styles.page} key="2" collapsable={false}>
<Text style={styles.title}>
There has two Nest PagerView with horizontal and vertical.
</Text>
<AnimatedPagerView
style={styles.PagerView}
initialPage={0}
layoutDirection="ltr"
pageMargin={10}
// Lib does not support dynamically orientation change
orientation="horizontal"
>
<View
key="1"
style={[styles.page, { backgroundColor: BGCOLOR[1] }]}
collapsable={false}
>
<LikeCount />
<Text>Horizontal</Text>
</View>
<View
key="2"
style={[styles.page, { backgroundColor: BGCOLOR[2] }]}
collapsable={false}
>
<LikeCount />
<Text>Horizontal</Text>
</View>
</AnimatedPagerView>
<AnimatedPagerView
style={styles.PagerView}
initialPage={0}
layoutDirection="ltr"
pageMargin={10}
// Lib does not support dynamically orientation change
orientation="vertical"
>
<View
key="1"
style={[styles.page, { backgroundColor: BGCOLOR[3] }]}
collapsable={false}
>
<LikeCount />
<Text>Vertical</Text>
</View>
<View
key="2"
style={[styles.page, { backgroundColor: BGCOLOR[4] }]}
collapsable={false}
>
<LikeCount />
<Text>Vertical</Text>
</View>
</AnimatedPagerView>
</View>
<View
key="3"
style={[styles.page, { backgroundColor: BGCOLOR[3] }]}
collapsable={false}
>
<LikeCount />
</View>
</AnimatedPagerView>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
},
image: {
width: 300,
height: 200,
padding: 20,
},
PagerView: {
flex: 1,
},
page: {
flex: 1,
},
title: { fontSize: 22, paddingVertical: 10 },
});