forked from jobtoday/react-native-image-viewing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImageHeader.tsx
More file actions
80 lines (74 loc) · 1.55 KB
/
ImageHeader.tsx
File metadata and controls
80 lines (74 loc) · 1.55 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/**
* 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,
SafeAreaView,
View,
Text,
TouchableOpacity
} 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}>
<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>
</SafeAreaView>
);
const styles = StyleSheet.create({
root: {
backgroundColor: "#00000077"
},
container: {
flex: 1,
padding: 8,
flexDirection: "row",
justifyContent: "space-between"
},
space: {
width: 45,
height: 45
},
closeButton: {
width: 45,
height: 45,
alignItems: "center",
justifyContent: "center"
},
closeText: {
lineHeight: 25,
fontSize: 25,
paddingTop: 2,
includeFontPadding: false,
color: "#FFF"
},
text: {
maxWidth: 240,
marginTop: 12,
flex: 1,
flexWrap: "wrap",
textAlign: "center",
fontSize: 17,
lineHeight: 17,
color: "#FFF"
}
});
export default ImageHeader;