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';
|
|
|
|
import { SafeAreaView } from 'react-navigation';
|
|
|
|
|
|
|
|
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
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
const appBarHeight = Platform.OS === 'ios' ? 44 : 56;
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
container: {
|
|
|
|
backgroundColor: Platform.OS === 'ios' ? '#F7F7F7' : '#FFF',
|
|
|
|
height: appBarHeight,
|
|
|
|
...platformContainerStyles
|
|
|
|
},
|
|
|
|
appBar: {
|
|
|
|
flex: 1
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
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 (
|
|
|
|
<SafeAreaView style={styles.container}>
|
|
|
|
<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>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|