diff options
| author | jules <jules@carbonpictures.com> | 2017-06-02 15:42:34 +0000 |
|---|---|---|
| committer | jules <jules@carbonpictures.com> | 2017-06-02 15:42:34 +0000 |
| commit | 5f26431f03228a85273e7f7d51abd6098ea9f2a5 (patch) | |
| tree | 6a709972cbb0babd68aaa10fe277b2c843fd7451 /client/src/lib/components/container.js | |
| parent | 291fe3eedd9a460fc44d2ea3ea81c7d79f2dfbcf (diff) | |
| parent | dd70fa81a205304cb48bbc0494ad34c16d496ff2 (diff) | |
merge
Diffstat (limited to 'client/src/lib/components/container.js')
| -rw-r--r-- | client/src/lib/components/container.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/client/src/lib/components/container.js b/client/src/lib/components/container.js new file mode 100644 index 0000000..fe6fd5e --- /dev/null +++ b/client/src/lib/components/container.js @@ -0,0 +1,50 @@ +import React, { Component } from 'react'; +import { + StyleSheet, + View +} from 'react-native'; + +import Heading from '../components/heading' + +export default class Container extends Component { + constructor() { + super() + } + render() { + const { heading, style, bodyStyle, headingOnPress, ...props } = this.props + let headingEl; + if (heading) { + headingEl = ( + <Heading style={styles.heading} onPress={headingOnPress}> + {heading.toUpperCase()} + </Heading> + ) + } + else { + headingEl = null + } + return ( + <View style={[styles.container, style]} {...props}> + {headingEl} + <View style={[styles.body, bodyStyle]}> + {this.props.children} + </View> + </View> + ) + } +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + justifyContent: 'flex-start', + }, + heading: { + }, + body: { + flex: 1, + justifyContent: 'flex-start', + alignItems: 'flex-start', + paddingLeft: 10, + } +}) |
