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
|
import React, { Component } from 'react';
import {
StyleSheet,
View,
ScrollView
} from 'react-native';
import Heading from '../components/heading'
export default class ScrollableContainer extends Component {
constructor(props) {
super()
}
render() {
const { heading, 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} {...props}>
<ScrollView ref={(ref) => this.scrollView = ref} contentContainerStyle={[styles.body, bodyStyle]}>
{headingEl}
{this.props.children}
<div style={{height: 40}}> </div>
</ScrollView>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
width: '100vw',
flex: 1,
justifyContent: 'flex-start',
},
heading: {
},
body: {
alignItems: 'center',
},
})
|