Files

81 lines
1.6 KiB
TypeScript
Raw Permalink Normal View History

2019-11-28 15:03:46 +01:00
/**
* Copyright (c) JOB TODAY S.A. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import React from "react";
import {
StyleSheet,
2020-03-03 16:43:48 +01:00
SafeAreaView,
View,
2019-11-28 15:03:46 +01:00
Text,
2020-03-03 16:43:48 +01:00
TouchableOpacity
2019-11-28 15:03:46 +01:00
} from "react-native";
type Props = {
title?: string;
onRequestClose: () => void;
};
const HIT_SLOP = { top: 16, left: 16, bottom: 16, right: 16 };
const ImageHeader = ({ title, onRequestClose }: Props) => (
<SafeAreaView style={styles.root}>
2020-03-03 16:43:48 +01:00
<View style={styles.container}>
<View style={styles.space} />
{title && <Text style={styles.text}>{title}</Text>}
<TouchableOpacity
style={styles.closeButton}
onPress={onRequestClose}
hitSlop={HIT_SLOP}
>
<Text style={styles.closeText}></Text>
</TouchableOpacity>
</View>
2019-11-28 15:03:46 +01:00
</SafeAreaView>
);
const styles = StyleSheet.create({
root: {
2020-03-03 16:43:48 +01:00
backgroundColor: "#00000077"
},
container: {
flex: 1,
padding: 8,
2019-11-28 15:03:46 +01:00
flexDirection: "row",
justifyContent: "space-between"
},
space: {
2020-03-03 16:43:48 +01:00
width: 45,
height: 45
2019-11-28 15:03:46 +01:00
},
closeButton: {
2020-03-03 16:43:48 +01:00
width: 45,
height: 45,
alignItems: "center",
justifyContent: "center"
2019-11-28 15:03:46 +01:00
},
closeText: {
2020-03-03 16:43:48 +01:00
lineHeight: 25,
fontSize: 25,
paddingTop: 2,
includeFontPadding: false,
2019-11-28 15:03:46 +01:00
color: "#FFF"
},
text: {
2020-03-03 16:43:48 +01:00
maxWidth: 240,
marginTop: 12,
2019-11-28 15:03:46 +01:00
flex: 1,
flexWrap: "wrap",
textAlign: "center",
fontSize: 17,
2020-03-03 16:43:48 +01:00
lineHeight: 17,
2019-11-28 15:03:46 +01:00
color: "#FFF"
}
});
export default ImageHeader;