forked from callstack/react-native-paper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSurfaceExample.js
54 lines (46 loc) · 1.03 KB
/
SurfaceExample.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
42
43
44
45
46
47
48
49
50
51
52
53
54
/* @flow */
import * as React from 'react';
import { ScrollView, StyleSheet } from 'react-native';
import { Text, Surface, withTheme, type Theme } from 'react-native-paper';
type Props = {
theme: Theme,
};
class SurfaceExample extends React.Component<Props> {
static title = 'Surface';
render() {
const {
theme: {
colors: { background },
},
} = this.props;
return (
<ScrollView
style={[styles.container, { backgroundColor: background }]}
contentContainerStyle={styles.content}
>
{[1, 2, 4, 6, 12].map(i => (
<Surface key={i} style={[styles.surface, { elevation: i }]}>
<Text>{i}</Text>
</Surface>
))}
</ScrollView>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
content: {
padding: 24,
alignItems: 'center',
},
surface: {
margin: 24,
height: 80,
width: 80,
alignItems: 'center',
justifyContent: 'center',
},
});
export default withTheme(SurfaceExample);