-
Notifications
You must be signed in to change notification settings - Fork 4.7k
/
PagerViewScreen.tsx
48 lines (45 loc) · 1.1 KB
/
PagerViewScreen.tsx
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
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import PagerView from 'react-native-pager-view';
export default function PagerViewScreen() {
return (
<PagerView
style={styles.container}
initialPage={0}
onPageSelected={(_) => {
console.log('New page!');
}}>
<View key="1" style={styles.page}>
<Text style={styles.text}>First page</Text>
<Text style={styles.description}>Swipe this to scroll to the next page</Text>
</View>
<View key="2" style={styles.page}>
<Text style={styles.text}>Second page</Text>
<Text style={styles.description}>Swipe this to scroll back</Text>
</View>
</PagerView>
);
}
PagerViewScreen.navigationOptions = {
title: 'PagerView Example',
gesturesEnabled: false,
};
const styles = StyleSheet.create({
container: {
flex: 1,
},
page: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
text: {
fontSize: 20,
fontWeight: 'bold',
},
description: {
fontSize: 16,
color: '#888',
},
});