2017-12-05 19:57:44 +00:00
|
|
|
import React from 'react';
|
2017-12-08 19:13:21 +00:00
|
|
|
import { View, StyleSheet, Platform } from 'react-native';
|
2017-12-05 19:57:44 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2018-06-13 01:29:18 +00:00
|
|
|
import { SafeAreaView } from 'react-navigation';
|
2017-12-05 19:57:44 +00:00
|
|
|
|
|
|
|
let platformContainerStyles;
|
|
|
|
if (Platform.OS === 'ios') {
|
|
|
|
platformContainerStyles = {
|
|
|
|
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
|
|
borderBottomColor: 'rgba(0, 0, 0, .3)'
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
platformContainerStyles = {
|
|
|
|
shadowColor: 'black',
|
|
|
|
shadowOpacity: 0.1,
|
|
|
|
shadowRadius: StyleSheet.hairlineWidth,
|
|
|
|
shadowOffset: {
|
|
|
|
height: StyleSheet.hairlineWidth
|
|
|
|
},
|
|
|
|
elevation: 4
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-04-10 13:03:54 +00:00
|
|
|
const height = Platform.OS === 'ios' ? 44 : 56;
|
|
|
|
const backgroundColor = Platform.OS === 'ios' ? '#F7F7F7' : '#FFF';
|
2017-12-05 19:57:44 +00:00
|
|
|
const styles = StyleSheet.create({
|
|
|
|
container: {
|
2018-04-10 13:03:54 +00:00
|
|
|
backgroundColor,
|
2017-12-05 19:57:44 +00:00
|
|
|
...platformContainerStyles
|
|
|
|
},
|
|
|
|
appBar: {
|
2018-04-10 13:03:54 +00:00
|
|
|
height,
|
|
|
|
backgroundColor
|
2017-12-05 19:57:44 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-02-08 14:08:50 +00:00
|
|
|
export default class Header extends React.PureComponent {
|
2017-12-05 19:57:44 +00:00
|
|
|
static propTypes = {
|
2017-12-08 19:13:21 +00:00
|
|
|
subview: PropTypes.object.isRequired
|
2017-12-05 19:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2018-04-10 13:03:54 +00:00
|
|
|
<SafeAreaView forceInset={{ bottom: 'never' }} style={styles.container}>
|
2017-12-05 19:57:44 +00:00
|
|
|
<View style={styles.appBar}>
|
2017-12-08 19:13:21 +00:00
|
|
|
{this.props.subview}
|
2017-12-05 19:57:44 +00:00
|
|
|
</View>
|
|
|
|
</SafeAreaView>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|