1
- import { Configuration } from './configuration' ;
1
+ import { Component } from 'react' ;
2
+ import { Configuration } from './configuration' ;
2
3
3
4
declare class PESDK {
4
5
/**
5
6
* Modally present a photo editor.
6
7
* @note EXIF meta data is only preserved in the edited image if and only if the source
7
8
* image is loaded from a local `file://` resource.
8
9
*
9
- * @param {string | {uri: string} | number } imageSource The source of the image to be edited.
10
+ * @param {string | {uri: string} | number } image The source of the image to be edited.
10
11
* Can be either an URI (local, remote, data resource, or any other registered scheme for the
11
12
* React Native image loader), an object with a member `uri`, or an asset reference which can
12
- * be optained by, e.g., `require('./image.png')` as `number`.
13
+ * be optained by, e.g., `require('./image.png')` as `number`. If this parameter is `null`,
14
+ * the `serialization` parameter must not be `null` and it must contain an embedded source image.
13
15
* @param {Configuration } configuration The configuration used to initialize the editor.
14
16
* @param {object } serialization The serialization used to initialize the editor. This
15
17
* restores a previous state of the editor by re-applying all modifications to the loaded
@@ -22,7 +24,7 @@ declare class PESDK {
22
24
* `null` is returned instead.
23
25
*/
24
26
static openEditor (
25
- imageSource : string | { uri : string } | number ,
27
+ image : string | { uri : string } | number ,
26
28
configuration : Configuration ,
27
29
serialization : object
28
30
) : Promise < { image : string , hasChanges : boolean , serialization : object } >
@@ -49,5 +51,76 @@ declare class PESDK {
49
51
) : Configuration
50
52
}
51
53
52
- export { PESDK } ;
54
+ /**
55
+ * Props for the `PhotoEditorModal` component.
56
+ */
57
+ interface PhotoEditorModalProps {
58
+ /**
59
+ * This prop determines whether your modal is visible.
60
+ */
61
+ visible : boolean ;
62
+
63
+ /**
64
+ * This prop determines the source of the image to be edited.
65
+ * Can be either an URI (local, remote, data resource, or any other registered scheme for the
66
+ * React Native image loader), an object with a member `uri`, or an asset reference which can
67
+ * be optained by, e.g., `require('./image.png')` as `number`.
68
+ *
69
+ * If this prop is `null`, the `serialization` prop must not be `null` and it must contain an
70
+ * embedded source image.
71
+ *
72
+ * @note EXIF meta data is only preserved in the edited image if and only if the source
73
+ * image is loaded from a local `file://` resource.
74
+ */
75
+ image ?: string | { uri : string } | number ;
76
+
77
+ /**
78
+ * This prop determines the configuration used to initialize the editor.
79
+ */
80
+ configuration ?: Configuration ;
81
+
82
+ /**
83
+ * This prop determines the serialization used to initialize the editor. This
84
+ * restores a previous state of the editor by re-applying all modifications to the loaded
85
+ * image.
86
+ */
87
+ serialization ?: object ;
88
+
89
+ /**
90
+ * This prop determines the callback function that will be called when the user exported an image.
91
+ *
92
+ * The object passed to this callback includes the edited `image`, an indicator (`hasChanges`) whether
93
+ * the input image was modified at all, and all modifications (`serialization`) applied to the input image
94
+ * if `export.serialization.enabled` of the `configuration` prop was set.
95
+ */
96
+ onExport : ( { image : string , hasChanges : boolean , serialization : object } ) => void ;
97
+
98
+ /**
99
+ * This prop determines the callback function that will be called when the user dissmisses the editor without
100
+ * exporting an image.
101
+ */
102
+ onCancel ?: ( ) => void ;
103
+
104
+ /**
105
+ * This prop determines the callback function that will be called when an error occurs.
106
+ */
107
+ onError ?: ( error : Error ) => void ;
108
+ }
109
+
110
+ /**
111
+ * State for the `PhotoEditorModal` component.
112
+ */
113
+ interface PhotoEditorModalState {
114
+ /**
115
+ * This state determines whether the modal is visible.
116
+ */
117
+ visible : boolean ;
118
+ }
119
+
120
+ /**
121
+ * A component that wraps the `PESDK.openEditor` function to modally present a photo editor.
122
+ */
123
+ declare class PhotoEditorModal extends Component < PhotoEditorModalProps , PhotoEditorModalState > { }
124
+
125
+ export { PESDK , PhotoEditorModal } ;
53
126
export * from './configuration' ;
0 commit comments