@umituz/react-native-photo-editor 1.0.1 → 1.0.2
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 +1 -1
- package/src/PhotoEditor.tsx +16 -3
package/package.json
CHANGED
package/src/PhotoEditor.tsx
CHANGED
|
@@ -19,13 +19,19 @@ import { TextEditorSheet } from "./components/TextEditorSheet";
|
|
|
19
19
|
import { createEditorStyles } from "./styles";
|
|
20
20
|
import { usePhotoEditorUI } from "./hooks/usePhotoEditorUI";
|
|
21
21
|
|
|
22
|
+
export interface EditorActions {
|
|
23
|
+
addTextLayer: (tokens: any) => string;
|
|
24
|
+
updateLayer: (id: string, updates: any) => void;
|
|
25
|
+
getLayers: () => any[];
|
|
26
|
+
getActiveLayerId: () => string | null;
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
export interface PhotoEditorProps {
|
|
23
30
|
imageUri: string;
|
|
24
31
|
onSave?: (uri: string) => void;
|
|
25
32
|
onClose: () => void;
|
|
26
33
|
title?: string;
|
|
27
|
-
|
|
28
|
-
customTools?: React.ReactNode;
|
|
34
|
+
customTools?: React.ReactNode | ((actions: EditorActions) => React.ReactNode);
|
|
29
35
|
initialCaption?: string;
|
|
30
36
|
t: (key: string) => string;
|
|
31
37
|
}
|
|
@@ -98,7 +104,14 @@ export const PhotoEditor: React.FC<PhotoEditorProps> = ({
|
|
|
98
104
|
onLayerMove={(id, x, y) => updateLayer(id, { x, y })}
|
|
99
105
|
styles={styles}
|
|
100
106
|
/>
|
|
101
|
-
{customTools
|
|
107
|
+
{typeof customTools === "function"
|
|
108
|
+
? customTools({
|
|
109
|
+
addTextLayer,
|
|
110
|
+
updateLayer,
|
|
111
|
+
getLayers: () => layers,
|
|
112
|
+
getActiveLayerId: () => activeLayerId,
|
|
113
|
+
})
|
|
114
|
+
: customTools}
|
|
102
115
|
<FontControls
|
|
103
116
|
fontSize={fontSize}
|
|
104
117
|
selectedFont={selectedFont}
|