@umituz/react-native-image 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-image",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Image manipulation and viewing for React Native apps - resize, crop, rotate, flip, compress, gallery viewer",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GalleryHeader Component
|
|
3
|
-
* Header for ImageGallery with edit and close
|
|
3
|
+
* Header for ImageGallery with optional edit button and close button
|
|
4
4
|
*
|
|
5
5
|
* This component should be implemented by the consumer app
|
|
6
6
|
* using their own design system and safe area handling.
|
|
@@ -10,16 +10,20 @@ import React from 'react';
|
|
|
10
10
|
import { View, TouchableOpacity, StyleSheet, Text } from 'react-native';
|
|
11
11
|
|
|
12
12
|
interface GalleryHeaderProps {
|
|
13
|
-
onEdit
|
|
13
|
+
onEdit?: () => void;
|
|
14
14
|
onClose: () => void;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export function GalleryHeader({ onEdit, onClose }: GalleryHeaderProps) {
|
|
18
18
|
return (
|
|
19
19
|
<View style={styles.container}>
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
20
|
+
{onEdit ? (
|
|
21
|
+
<TouchableOpacity style={styles.button} onPress={onEdit}>
|
|
22
|
+
<Text style={styles.buttonText}>Edit</Text>
|
|
23
|
+
</TouchableOpacity>
|
|
24
|
+
) : (
|
|
25
|
+
<View style={styles.spacer} />
|
|
26
|
+
)}
|
|
23
27
|
|
|
24
28
|
<TouchableOpacity style={styles.button} onPress={onClose}>
|
|
25
29
|
<Text style={styles.buttonText}>✕</Text>
|
|
@@ -42,6 +46,9 @@ const styles = StyleSheet.create({
|
|
|
42
46
|
alignItems: 'center',
|
|
43
47
|
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
44
48
|
},
|
|
49
|
+
spacer: {
|
|
50
|
+
width: 48,
|
|
51
|
+
},
|
|
45
52
|
button: {
|
|
46
53
|
flexDirection: 'row',
|
|
47
54
|
alignItems: 'center',
|
|
@@ -78,10 +78,9 @@ export const ImageGallery: React.FC<ImageGalleryProps> = ({
|
|
|
78
78
|
);
|
|
79
79
|
|
|
80
80
|
const headerComponent = useCallback(() => {
|
|
81
|
-
if (!enableEditing) return null;
|
|
82
81
|
return (
|
|
83
82
|
<GalleryHeader
|
|
84
|
-
onEdit={handleEdit}
|
|
83
|
+
onEdit={enableEditing ? handleEdit : undefined}
|
|
85
84
|
onClose={onDismiss}
|
|
86
85
|
/>
|
|
87
86
|
);
|