-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainer.js
More file actions
35 lines (29 loc) · 761 Bytes
/
Container.js
File metadata and controls
35 lines (29 loc) · 761 Bytes
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
//import from system
import { View, StyleSheet, StatusBar, } from 'react-native';
import React, { Component, PropTypes } from 'react';
//import from app
import { style } from './src/constants/AppStyle.js';
import { STATUS_BAR_COLOR } from './src/constants/AppColor.js';
//define propTypes
const propTypes = {
children: PropTypes.node,
color: PropTypes.string,
};
class Container extends Component {
getColor() {
if (this.props.color) {
return this.props.color;
}
return STATUS_BAR_COLOR;
}
render() {
return (
<View style={style.container_with_flex_1}>
<StatusBar backgroundColor={this.getColor()} barStyle='light-content' />
{this.props.children}
</View>
);
}
}
Container.propTypes = propTypes;
export default Container;