@react-native-ohos/clipboard 1.13.3-rc.1 → 1.13.3-rc.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.
@@ -1,159 +1,159 @@
1
- import { EmitterSubscription } from 'react-native';
2
- /**
3
- * `Clipboard` gives you an interface for setting and getting content from Clipboard on both iOS and Android
4
- */
5
- export declare const Clipboard: {
6
- /**
7
- * Get content of string type, this method returns a `Promise`, so you can use following code to get clipboard content
8
- * ```javascript
9
- * async _getContent() {
10
- * var content = await Clipboard.getString();
11
- * }
12
- * ```
13
- */
14
- getString(): Promise<string>;
15
- /**
16
- * (iOS Only)
17
- * Get contents of string array type, this method returns a `Promise`, so you can use following code to get clipboard content
18
- * ```javascript
19
- * async _getContent() {
20
- * var content = await Clipboard.getStrings();
21
- * }
22
- * ```
23
- */
24
- getStrings(): Promise<string[]>;
25
- /**
26
- * Get clipboard image as PNG in base64, this method returns a `Promise`, so you can use following code to get clipboard content
27
- * ```javascript
28
- * async _getContent() {
29
- * var content = await Clipboard.getImagePNG();
30
- * }
31
- * ```
32
- */
33
- getImagePNG(): Promise<string>;
34
- /**
35
- * Get clipboard image as JPG in base64, this method returns a `Promise`, so you can use following code to get clipboard content
36
- * ```javascript
37
- * async _getContent() {
38
- * var content = await Clipboard.getImageJPG();
39
- * }
40
- * ```
41
- */
42
- getImageJPG(): Promise<string>;
43
- /**
44
- * (iOS Only)
45
- * Set content of base64 image type. You can use following code to set clipboard content
46
- * ```javascript
47
- * _setContent() {
48
- * Clipboard.setImage(...);
49
- * }
50
- * ```
51
- * @param the content to be stored in the clipboard.
52
- */
53
- setImage(content: string): void;
54
- /**
55
- * (Android Only)
56
- * Get clipboard image in base64, this method returns a `Promise`, so you can use following code to get clipboard content
57
- * ```javascript
58
- * async _getContent() {
59
- * var content = await Clipboard.getImage();
60
- * }
61
- * ```
62
- */
63
- getImage(): Promise<string>;
64
- /**
65
- * Set content of string type. You can use following code to set clipboard content
66
- * ```javascript
67
- * _setContent() {
68
- * Clipboard.setString('hello world');
69
- * }
70
- * ```
71
- * @param the content to be stored in the clipboard.
72
- */
73
- setString(content: string): void;
74
- /**
75
- * Set content of string array type. You can use following code to set clipboard content
76
- * ```javascript
77
- * _setContent() {
78
- * Clipboard.setStrings(['hello world', 'second string']);
79
- * }
80
- * ```
81
- * @param the content to be stored in the clipboard.
82
- */
83
- setStrings(content: string[]): void;
84
- /**
85
- * Returns whether the clipboard has content or is empty.
86
- * This method returns a `Promise`, so you can use following code to get clipboard content
87
- * ```javascript
88
- * async _hasContent() {
89
- * var hasContent = await Clipboard.hasString();
90
- * }
91
- * ```
92
- */
93
- hasString(): Promise<boolean>;
94
- /**
95
- * Returns whether the clipboard has an image or is empty.
96
- * This method returns a `Promise`, so you can use following code to check clipboard content
97
- * ```javascript
98
- * async _hasContent() {
99
- * var hasContent = await Clipboard.hasImage();
100
- * }
101
- * ```
102
- */
103
- hasImage(): Promise<boolean>;
104
- /**
105
- * (iOS Only)
106
- * Returns whether the clipboard has a URL content. Can check
107
- * if there is a URL content in clipboard without triggering PasteBoard notification for iOS 14+
108
- * This method returns a `Promise`, so you can use following code to check for url content in clipboard.
109
- * ```javascript
110
- * async _hasURL() {
111
- * var hasURL = await Clipboard.hasURL();
112
- * }
113
- * ```
114
- */
115
- hasURL(): Promise<boolean> | undefined;
116
- /**
117
- * (iOS 14+ Only)
118
- * Returns whether the clipboard has a Number(UIPasteboardDetectionPatternNumber) content. Can check
119
- * if there is a Number content in clipboard without triggering PasteBoard notification for iOS 14+
120
- * This method returns a `Promise`, so you can use following code to check for Number content in clipboard.
121
- * ```javascript
122
- * async _hasNumber() {
123
- * var hasNumber = await Clipboard.hasNumber();
124
- * }
125
- * ```
126
- */
127
- hasNumber(): Promise<boolean> | undefined;
128
- /**
129
- * (iOS 14+ Only)
130
- * Returns whether the clipboard has a WebURL(UIPasteboardDetectionPatternProbableWebURL) content. Can check
131
- * if there is a WebURL content in clipboard without triggering PasteBoard notification for iOS 14+
132
- * This method returns a `Promise`, so you can use following code to check for WebURL content in clipboard.
133
- * ```javascript
134
- * async _hasWebURL() {
135
- * var hasWebURL = await Clipboard.hasWebURL();
136
- * }
137
- * ```
138
- */
139
- hasWebURL(): Promise<boolean> | undefined;
140
- /**
141
- * (iOS and Android Only)
142
- * Adds a listener to get notifications when the clipboard has changed.
143
- * If this is the first listener, turns on clipboard notifications on the native side.
144
- * It returns EmitterSubscription where you can call "remove" to remove listener
145
- * ```javascript
146
- * const listener = () => console.log("changed!");
147
- * Clipboard.addListener(listener);
148
- * ```
149
- */
150
- addListener(callback: () => void): EmitterSubscription;
151
- /**
152
- * (iOS and Android Only)
153
- * Removes all previously registered listeners and turns off notifications on the native side.
154
- * ```javascript
155
- * Clipboard.removeAllListeners();
156
- * ```
157
- */
158
- removeAllListeners(): void;
159
- };
1
+ import { EmitterSubscription } from 'react-native';
2
+ /**
3
+ * `Clipboard` gives you an interface for setting and getting content from Clipboard on both iOS and Android
4
+ */
5
+ export declare const Clipboard: {
6
+ /**
7
+ * Get content of string type, this method returns a `Promise`, so you can use following code to get clipboard content
8
+ * ```javascript
9
+ * async _getContent() {
10
+ * var content = await Clipboard.getString();
11
+ * }
12
+ * ```
13
+ */
14
+ getString(): Promise<string>;
15
+ /**
16
+ * (iOS Only)
17
+ * Get contents of string array type, this method returns a `Promise`, so you can use following code to get clipboard content
18
+ * ```javascript
19
+ * async _getContent() {
20
+ * var content = await Clipboard.getStrings();
21
+ * }
22
+ * ```
23
+ */
24
+ getStrings(): Promise<string[]>;
25
+ /**
26
+ * Get clipboard image as PNG in base64, this method returns a `Promise`, so you can use following code to get clipboard content
27
+ * ```javascript
28
+ * async _getContent() {
29
+ * var content = await Clipboard.getImagePNG();
30
+ * }
31
+ * ```
32
+ */
33
+ getImagePNG(): Promise<string>;
34
+ /**
35
+ * Get clipboard image as JPG in base64, this method returns a `Promise`, so you can use following code to get clipboard content
36
+ * ```javascript
37
+ * async _getContent() {
38
+ * var content = await Clipboard.getImageJPG();
39
+ * }
40
+ * ```
41
+ */
42
+ getImageJPG(): Promise<string>;
43
+ /**
44
+ * (iOS Only)
45
+ * Set content of base64 image type. You can use following code to set clipboard content
46
+ * ```javascript
47
+ * _setContent() {
48
+ * Clipboard.setImage(...);
49
+ * }
50
+ * ```
51
+ * @param the content to be stored in the clipboard.
52
+ */
53
+ setImage(content: string): void;
54
+ /**
55
+ * (Android Only)
56
+ * Get clipboard image in base64, this method returns a `Promise`, so you can use following code to get clipboard content
57
+ * ```javascript
58
+ * async _getContent() {
59
+ * var content = await Clipboard.getImage();
60
+ * }
61
+ * ```
62
+ */
63
+ getImage(): Promise<string>;
64
+ /**
65
+ * Set content of string type. You can use following code to set clipboard content
66
+ * ```javascript
67
+ * _setContent() {
68
+ * Clipboard.setString('hello world');
69
+ * }
70
+ * ```
71
+ * @param the content to be stored in the clipboard.
72
+ */
73
+ setString(content: string): void;
74
+ /**
75
+ * Set content of string array type. You can use following code to set clipboard content
76
+ * ```javascript
77
+ * _setContent() {
78
+ * Clipboard.setStrings(['hello world', 'second string']);
79
+ * }
80
+ * ```
81
+ * @param the content to be stored in the clipboard.
82
+ */
83
+ setStrings(content: string[]): void;
84
+ /**
85
+ * Returns whether the clipboard has content or is empty.
86
+ * This method returns a `Promise`, so you can use following code to get clipboard content
87
+ * ```javascript
88
+ * async _hasContent() {
89
+ * var hasContent = await Clipboard.hasString();
90
+ * }
91
+ * ```
92
+ */
93
+ hasString(): any;
94
+ /**
95
+ * Returns whether the clipboard has an image or is empty.
96
+ * This method returns a `Promise`, so you can use following code to check clipboard content
97
+ * ```javascript
98
+ * async _hasContent() {
99
+ * var hasContent = await Clipboard.hasImage();
100
+ * }
101
+ * ```
102
+ */
103
+ hasImage(): any;
104
+ /**
105
+ * (iOS Only)
106
+ * Returns whether the clipboard has a URL content. Can check
107
+ * if there is a URL content in clipboard without triggering PasteBoard notification for iOS 14+
108
+ * This method returns a `Promise`, so you can use following code to check for url content in clipboard.
109
+ * ```javascript
110
+ * async _hasURL() {
111
+ * var hasURL = await Clipboard.hasURL();
112
+ * }
113
+ * ```
114
+ */
115
+ hasURL(): any;
116
+ /**
117
+ * (iOS 14+ Only)
118
+ * Returns whether the clipboard has a Number(UIPasteboardDetectionPatternNumber) content. Can check
119
+ * if there is a Number content in clipboard without triggering PasteBoard notification for iOS 14+
120
+ * This method returns a `Promise`, so you can use following code to check for Number content in clipboard.
121
+ * ```javascript
122
+ * async _hasNumber() {
123
+ * var hasNumber = await Clipboard.hasNumber();
124
+ * }
125
+ * ```
126
+ */
127
+ hasNumber(): any;
128
+ /**
129
+ * (iOS 14+ Only)
130
+ * Returns whether the clipboard has a WebURL(UIPasteboardDetectionPatternProbableWebURL) content. Can check
131
+ * if there is a WebURL content in clipboard without triggering PasteBoard notification for iOS 14+
132
+ * This method returns a `Promise`, so you can use following code to check for WebURL content in clipboard.
133
+ * ```javascript
134
+ * async _hasWebURL() {
135
+ * var hasWebURL = await Clipboard.hasWebURL();
136
+ * }
137
+ * ```
138
+ */
139
+ hasWebURL(): any;
140
+ /**
141
+ * (iOS and Android Only)
142
+ * Adds a listener to get notifications when the clipboard has changed.
143
+ * If this is the first listener, turns on clipboard notifications on the native side.
144
+ * It returns EmitterSubscription where you can call "remove" to remove listener
145
+ * ```javascript
146
+ * const listener = () => console.log("changed!");
147
+ * Clipboard.addListener(listener);
148
+ * ```
149
+ */
150
+ addListener(callback: () => void): EmitterSubscription;
151
+ /**
152
+ * (iOS and Android Only)
153
+ * Removes all previously registered listeners and turns off notifications on the native side.
154
+ * ```javascript
155
+ * Clipboard.removeAllListeners();
156
+ * ```
157
+ */
158
+ removeAllListeners(): void;
159
+ };
package/dist/Clipboard.js CHANGED
@@ -1,232 +1,242 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.Clipboard = void 0;
27
- var react_native_1 = require("react-native");
28
- var NativeClipboardModule_1 = __importStar(require("@react-native-clipboard/clipboard/src/NativeClipboardModule"));
29
- /**
30
- * `Clipboard` gives you an interface for setting and getting content from Clipboard on both iOS and Android
31
- */
32
- exports.Clipboard = {
33
- /**
34
- * Get content of string type, this method returns a `Promise`, so you can use following code to get clipboard content
35
- * ```javascript
36
- * async _getContent() {
37
- * var content = await Clipboard.getString();
38
- * }
39
- * ```
40
- */
41
- getString: function () {
42
- return NativeClipboardModule_1.default.getString();
43
- },
44
- /**
45
- * (iOS Only)
46
- * Get contents of string array type, this method returns a `Promise`, so you can use following code to get clipboard content
47
- * ```javascript
48
- * async _getContent() {
49
- * var content = await Clipboard.getStrings();
50
- * }
51
- * ```
52
- */
53
- getStrings: function () {
54
- return NativeClipboardModule_1.default.getStrings();
55
- },
56
- /**
57
- * Get clipboard image as PNG in base64, this method returns a `Promise`, so you can use following code to get clipboard content
58
- * ```javascript
59
- * async _getContent() {
60
- * var content = await Clipboard.getImagePNG();
61
- * }
62
- * ```
63
- */
64
- getImagePNG: function () {
65
- return NativeClipboardModule_1.default.getImagePNG();
66
- },
67
- /**
68
- * Get clipboard image as JPG in base64, this method returns a `Promise`, so you can use following code to get clipboard content
69
- * ```javascript
70
- * async _getContent() {
71
- * var content = await Clipboard.getImageJPG();
72
- * }
73
- * ```
74
- */
75
- getImageJPG: function () {
76
- return NativeClipboardModule_1.default.getImageJPG();
77
- },
78
- /**
79
- * (iOS Only)
80
- * Set content of base64 image type. You can use following code to set clipboard content
81
- * ```javascript
82
- * _setContent() {
83
- * Clipboard.setImage(...);
84
- * }
85
- * ```
86
- * @param the content to be stored in the clipboard.
87
- */
88
- setImage: function (content) {
89
- // @ts-ignore
90
- if (react_native_1.Platform.OS == 'ios' || react_native_1.Platform.OS == 'harmony') {
91
- NativeClipboardModule_1.default.setImage(content);
92
- }
93
- return;
94
- },
95
- /**
96
- * (Android Only)
97
- * Get clipboard image in base64, this method returns a `Promise`, so you can use following code to get clipboard content
98
- * ```javascript
99
- * async _getContent() {
100
- * var content = await Clipboard.getImage();
101
- * }
102
- * ```
103
- */
104
- getImage: function () {
105
- return NativeClipboardModule_1.default.getImage();
106
- },
107
- /**
108
- * Set content of string type. You can use following code to set clipboard content
109
- * ```javascript
110
- * _setContent() {
111
- * Clipboard.setString('hello world');
112
- * }
113
- * ```
114
- * @param the content to be stored in the clipboard.
115
- */
116
- setString: function (content) {
117
- NativeClipboardModule_1.default.setString(content);
118
- },
119
- /**
120
- * Set content of string array type. You can use following code to set clipboard content
121
- * ```javascript
122
- * _setContent() {
123
- * Clipboard.setStrings(['hello world', 'second string']);
124
- * }
125
- * ```
126
- * @param the content to be stored in the clipboard.
127
- */
128
- setStrings: function (content) {
129
- NativeClipboardModule_1.default.setStrings(content);
130
- },
131
- /**
132
- * Returns whether the clipboard has content or is empty.
133
- * This method returns a `Promise`, so you can use following code to get clipboard content
134
- * ```javascript
135
- * async _hasContent() {
136
- * var hasContent = await Clipboard.hasString();
137
- * }
138
- * ```
139
- */
140
- hasString: function () {
141
- return NativeClipboardModule_1.default.hasString();
142
- },
143
- /**
144
- * Returns whether the clipboard has an image or is empty.
145
- * This method returns a `Promise`, so you can use following code to check clipboard content
146
- * ```javascript
147
- * async _hasContent() {
148
- * var hasContent = await Clipboard.hasImage();
149
- * }
150
- * ```
151
- */
152
- hasImage: function () {
153
- return NativeClipboardModule_1.default.hasImage();
154
- },
155
- /**
156
- * (iOS Only)
157
- * Returns whether the clipboard has a URL content. Can check
158
- * if there is a URL content in clipboard without triggering PasteBoard notification for iOS 14+
159
- * This method returns a `Promise`, so you can use following code to check for url content in clipboard.
160
- * ```javascript
161
- * async _hasURL() {
162
- * var hasURL = await Clipboard.hasURL();
163
- * }
164
- * ```
165
- */
166
- hasURL: function () {
167
- // @ts-ignore
168
- if (react_native_1.Platform.OS == 'ios' || react_native_1.Platform.OS == 'harmony') {
169
- return NativeClipboardModule_1.default.hasURL();
170
- }
171
- return;
172
- },
173
- /**
174
- * (iOS 14+ Only)
175
- * Returns whether the clipboard has a Number(UIPasteboardDetectionPatternNumber) content. Can check
176
- * if there is a Number content in clipboard without triggering PasteBoard notification for iOS 14+
177
- * This method returns a `Promise`, so you can use following code to check for Number content in clipboard.
178
- * ```javascript
179
- * async _hasNumber() {
180
- * var hasNumber = await Clipboard.hasNumber();
181
- * }
182
- * ```
183
- */
184
- hasNumber: function () {
185
- // @ts-ignore
186
- if (react_native_1.Platform.OS == 'ios' || react_native_1.Platform.OS == 'harmony') {
187
- return NativeClipboardModule_1.default.hasNumber();
188
- }
189
- return;
190
- },
191
- /**
192
- * (iOS 14+ Only)
193
- * Returns whether the clipboard has a WebURL(UIPasteboardDetectionPatternProbableWebURL) content. Can check
194
- * if there is a WebURL content in clipboard without triggering PasteBoard notification for iOS 14+
195
- * This method returns a `Promise`, so you can use following code to check for WebURL content in clipboard.
196
- * ```javascript
197
- * async _hasWebURL() {
198
- * var hasWebURL = await Clipboard.hasWebURL();
199
- * }
200
- * ```
201
- */
202
- hasWebURL: function () {
203
- // @ts-ignore
204
- if (react_native_1.Platform.OS == 'ios' || react_native_1.Platform.OS == 'harmony') {
205
- return NativeClipboardModule_1.default.hasWebURL();
206
- }
207
- return;
208
- },
209
- /**
210
- * (iOS and Android Only)
211
- * Adds a listener to get notifications when the clipboard has changed.
212
- * If this is the first listener, turns on clipboard notifications on the native side.
213
- * It returns EmitterSubscription where you can call "remove" to remove listener
214
- * ```javascript
215
- * const listener = () => console.log("changed!");
216
- * Clipboard.addListener(listener);
217
- * ```
218
- */
219
- addListener: function (callback) {
220
- return (0, NativeClipboardModule_1.addListener)(callback);
221
- },
222
- /**
223
- * (iOS and Android Only)
224
- * Removes all previously registered listeners and turns off notifications on the native side.
225
- * ```javascript
226
- * Clipboard.removeAllListeners();
227
- * ```
228
- */
229
- removeAllListeners: function () {
230
- (0, NativeClipboardModule_1.removeAllListeners)();
231
- },
232
- };
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Clipboard = void 0;
37
+ var react_native_1 = require("react-native");
38
+ var NativeClipboardModule_1 = __importStar(require("@react-native-clipboard/clipboard/src/NativeClipboardModule"));
39
+ /**
40
+ * `Clipboard` gives you an interface for setting and getting content from Clipboard on both iOS and Android
41
+ */
42
+ exports.Clipboard = {
43
+ /**
44
+ * Get content of string type, this method returns a `Promise`, so you can use following code to get clipboard content
45
+ * ```javascript
46
+ * async _getContent() {
47
+ * var content = await Clipboard.getString();
48
+ * }
49
+ * ```
50
+ */
51
+ getString: function () {
52
+ return NativeClipboardModule_1.default.getString();
53
+ },
54
+ /**
55
+ * (iOS Only)
56
+ * Get contents of string array type, this method returns a `Promise`, so you can use following code to get clipboard content
57
+ * ```javascript
58
+ * async _getContent() {
59
+ * var content = await Clipboard.getStrings();
60
+ * }
61
+ * ```
62
+ */
63
+ getStrings: function () {
64
+ return NativeClipboardModule_1.default.getStrings();
65
+ },
66
+ /**
67
+ * Get clipboard image as PNG in base64, this method returns a `Promise`, so you can use following code to get clipboard content
68
+ * ```javascript
69
+ * async _getContent() {
70
+ * var content = await Clipboard.getImagePNG();
71
+ * }
72
+ * ```
73
+ */
74
+ getImagePNG: function () {
75
+ return NativeClipboardModule_1.default.getImagePNG();
76
+ },
77
+ /**
78
+ * Get clipboard image as JPG in base64, this method returns a `Promise`, so you can use following code to get clipboard content
79
+ * ```javascript
80
+ * async _getContent() {
81
+ * var content = await Clipboard.getImageJPG();
82
+ * }
83
+ * ```
84
+ */
85
+ getImageJPG: function () {
86
+ return NativeClipboardModule_1.default.getImageJPG();
87
+ },
88
+ /**
89
+ * (iOS Only)
90
+ * Set content of base64 image type. You can use following code to set clipboard content
91
+ * ```javascript
92
+ * _setContent() {
93
+ * Clipboard.setImage(...);
94
+ * }
95
+ * ```
96
+ * @param the content to be stored in the clipboard.
97
+ */
98
+ setImage: function (content) {
99
+ // @ts-ignore
100
+ if (react_native_1.Platform.OS == 'ios' || react_native_1.Platform.OS == 'harmony') {
101
+ NativeClipboardModule_1.default.setImage(content);
102
+ }
103
+ return;
104
+ },
105
+ /**
106
+ * (Android Only)
107
+ * Get clipboard image in base64, this method returns a `Promise`, so you can use following code to get clipboard content
108
+ * ```javascript
109
+ * async _getContent() {
110
+ * var content = await Clipboard.getImage();
111
+ * }
112
+ * ```
113
+ */
114
+ getImage: function () {
115
+ return NativeClipboardModule_1.default.getImage();
116
+ },
117
+ /**
118
+ * Set content of string type. You can use following code to set clipboard content
119
+ * ```javascript
120
+ * _setContent() {
121
+ * Clipboard.setString('hello world');
122
+ * }
123
+ * ```
124
+ * @param the content to be stored in the clipboard.
125
+ */
126
+ setString: function (content) {
127
+ NativeClipboardModule_1.default.setString(content);
128
+ },
129
+ /**
130
+ * Set content of string array type. You can use following code to set clipboard content
131
+ * ```javascript
132
+ * _setContent() {
133
+ * Clipboard.setStrings(['hello world', 'second string']);
134
+ * }
135
+ * ```
136
+ * @param the content to be stored in the clipboard.
137
+ */
138
+ setStrings: function (content) {
139
+ NativeClipboardModule_1.default.setStrings(content);
140
+ },
141
+ /**
142
+ * Returns whether the clipboard has content or is empty.
143
+ * This method returns a `Promise`, so you can use following code to get clipboard content
144
+ * ```javascript
145
+ * async _hasContent() {
146
+ * var hasContent = await Clipboard.hasString();
147
+ * }
148
+ * ```
149
+ */
150
+ hasString: function () {
151
+ return NativeClipboardModule_1.default.hasString();
152
+ },
153
+ /**
154
+ * Returns whether the clipboard has an image or is empty.
155
+ * This method returns a `Promise`, so you can use following code to check clipboard content
156
+ * ```javascript
157
+ * async _hasContent() {
158
+ * var hasContent = await Clipboard.hasImage();
159
+ * }
160
+ * ```
161
+ */
162
+ hasImage: function () {
163
+ return NativeClipboardModule_1.default.hasImage();
164
+ },
165
+ /**
166
+ * (iOS Only)
167
+ * Returns whether the clipboard has a URL content. Can check
168
+ * if there is a URL content in clipboard without triggering PasteBoard notification for iOS 14+
169
+ * This method returns a `Promise`, so you can use following code to check for url content in clipboard.
170
+ * ```javascript
171
+ * async _hasURL() {
172
+ * var hasURL = await Clipboard.hasURL();
173
+ * }
174
+ * ```
175
+ */
176
+ hasURL: function () {
177
+ // @ts-ignore
178
+ if (react_native_1.Platform.OS == 'ios' || react_native_1.Platform.OS == 'harmony') {
179
+ return NativeClipboardModule_1.default.hasURL();
180
+ }
181
+ return;
182
+ },
183
+ /**
184
+ * (iOS 14+ Only)
185
+ * Returns whether the clipboard has a Number(UIPasteboardDetectionPatternNumber) content. Can check
186
+ * if there is a Number content in clipboard without triggering PasteBoard notification for iOS 14+
187
+ * This method returns a `Promise`, so you can use following code to check for Number content in clipboard.
188
+ * ```javascript
189
+ * async _hasNumber() {
190
+ * var hasNumber = await Clipboard.hasNumber();
191
+ * }
192
+ * ```
193
+ */
194
+ hasNumber: function () {
195
+ // @ts-ignore
196
+ if (react_native_1.Platform.OS == 'ios' || react_native_1.Platform.OS == 'harmony') {
197
+ return NativeClipboardModule_1.default.hasNumber();
198
+ }
199
+ return;
200
+ },
201
+ /**
202
+ * (iOS 14+ Only)
203
+ * Returns whether the clipboard has a WebURL(UIPasteboardDetectionPatternProbableWebURL) content. Can check
204
+ * if there is a WebURL content in clipboard without triggering PasteBoard notification for iOS 14+
205
+ * This method returns a `Promise`, so you can use following code to check for WebURL content in clipboard.
206
+ * ```javascript
207
+ * async _hasWebURL() {
208
+ * var hasWebURL = await Clipboard.hasWebURL();
209
+ * }
210
+ * ```
211
+ */
212
+ hasWebURL: function () {
213
+ // @ts-ignore
214
+ if (react_native_1.Platform.OS == 'ios' || react_native_1.Platform.OS == 'harmony') {
215
+ return NativeClipboardModule_1.default.hasWebURL();
216
+ }
217
+ return;
218
+ },
219
+ /**
220
+ * (iOS and Android Only)
221
+ * Adds a listener to get notifications when the clipboard has changed.
222
+ * If this is the first listener, turns on clipboard notifications on the native side.
223
+ * It returns EmitterSubscription where you can call "remove" to remove listener
224
+ * ```javascript
225
+ * const listener = () => console.log("changed!");
226
+ * Clipboard.addListener(listener);
227
+ * ```
228
+ */
229
+ addListener: function (callback) {
230
+ return (0, NativeClipboardModule_1.addListener)(callback);
231
+ },
232
+ /**
233
+ * (iOS and Android Only)
234
+ * Removes all previously registered listeners and turns off notifications on the native side.
235
+ * ```javascript
236
+ * Clipboard.removeAllListeners();
237
+ * ```
238
+ */
239
+ removeAllListeners: function () {
240
+ (0, NativeClipboardModule_1.removeAllListeners)();
241
+ },
242
+ };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { Clipboard } from './Clipboard';
2
- export { useClipboard } from '@react-native-clipboard/clipboard/src/useClipboard';
3
- export default Clipboard;
1
+ import { Clipboard } from './Clipboard';
2
+ export { useClipboard } from '@react-native-clipboard/clipboard/src/useClipboard';
3
+ export default Clipboard;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useClipboard = void 0;
4
- var Clipboard_1 = require("./Clipboard");
5
- var useClipboard_1 = require("@react-native-clipboard/clipboard/src/useClipboard");
6
- Object.defineProperty(exports, "useClipboard", { enumerable: true, get: function () { return useClipboard_1.useClipboard; } });
7
- exports.default = Clipboard_1.Clipboard;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useClipboard = void 0;
4
+ var Clipboard_1 = require("./Clipboard");
5
+ var useClipboard_1 = require("@react-native-clipboard/clipboard/src/useClipboard");
6
+ Object.defineProperty(exports, "useClipboard", { enumerable: true, get: function () { return useClipboard_1.useClipboard; } });
7
+ exports.default = Clipboard_1.Clipboard;
@@ -3,7 +3,7 @@
3
3
  "types": "",
4
4
  "devDependencies": {},
5
5
  "name": "@react-native-ohos/clipboard",
6
- "version": "1.13.3-rc.1",
6
+ "version": "1.13.3-rc.2",
7
7
  "description": "",
8
8
  "main": "index.ets",
9
9
  "dependencies": {
Binary file
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@react-native-ohos/clipboard",
3
- "version": "1.13.3-rc.1",
3
+ "version": "1.13.3-rc.2",
4
4
  "description": "React Native Clipboard API",
5
5
  "harmony": {
6
- "alias": "react-native-clipboard/clipboard",
6
+ "alias": "@react-native-clipboard/clipboard",
7
7
  "autolinking": {
8
8
  "etsPackageClassName": "ClipboardPackage",
9
9
  "cppPackageClassName": "ClipboardPackage",