mirror of
https://github.com/zhigang1992/react-native-paper.git
synced 2026-06-11 08:13:29 +08:00
56 lines
1.1 KiB
JavaScript
56 lines
1.1 KiB
JavaScript
/* @flow */
|
|
|
|
import * as React from 'react';
|
|
import { ScrollView, StyleSheet } from 'react-native';
|
|
import { Text, Surface, withTheme } from 'react-native-paper';
|
|
import type { Theme } from 'react-native-paper/types';
|
|
|
|
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);
|