@react-native-ohos/clipboard 1.16.3-rc.1
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/LICENSE +21 -0
- package/README.OpenSource +11 -0
- package/README.md +13 -0
- package/RNCClipboard.podspec +37 -0
- package/dist/Clipboard.d.ts +159 -0
- package/dist/Clipboard.js +232 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/harmony/clipboard/LICENSE +21 -0
- package/harmony/clipboard/NOTICE +33 -0
- package/harmony/clipboard/OAT.xml +38 -0
- package/harmony/clipboard/README.OpenSource +11 -0
- package/harmony/clipboard/README.md +307 -0
- package/harmony/clipboard/build-profile.json5 +8 -0
- package/harmony/clipboard/hvigorfile.ts +1 -0
- package/harmony/clipboard/index.ets +25 -0
- package/harmony/clipboard/oh-package.json5 +12 -0
- package/harmony/clipboard/src/main/cpp/CMakeLists.txt +7 -0
- package/harmony/clipboard/src/main/cpp/ClipboardPackage.h +58 -0
- package/harmony/clipboard/src/main/cpp/RNCClipboardTurboModule.cpp +198 -0
- package/harmony/clipboard/src/main/cpp/RNCClipboardTurboModule.h +39 -0
- package/harmony/clipboard/src/main/ets/ClipboardPackage.ts +46 -0
- package/harmony/clipboard/src/main/ets/Logger.ts +64 -0
- package/harmony/clipboard/src/main/ets/RNCClipboardTurboModule.ts +482 -0
- package/harmony/clipboard/src/main/module.json5 +7 -0
- package/harmony/clipboard/src/main/resources/base/element/string.json +8 -0
- package/harmony/clipboard/src/main/resources/en_US/element/string.json +8 -0
- package/harmony/clipboard/src/main/resources/zh_CN/element/string.json +8 -0
- package/harmony/clipboard/ts.ts +26 -0
- package/harmony/clipboard.har +0 -0
- package/package.json +90 -0
- package/src/Clipboard.ts +211 -0
- package/src/index.ts +3 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015-present, Facebook, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"Name": "@react-native-clipboard/clipboard",
|
|
4
|
+
"License": "MIT License",
|
|
5
|
+
"License File": " LICENSE ",
|
|
6
|
+
"Version Number": "1.16.2",
|
|
7
|
+
"Owner" : "xiafeng@huawei.com",
|
|
8
|
+
"Upstream URL": "https://github.com/react-native-clipboard/clipboard",
|
|
9
|
+
"Description": "React Native Clipboard API for both iOS and Android."
|
|
10
|
+
}
|
|
11
|
+
]
|
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @react-native-ohos/clipboard
|
|
2
|
+
|
|
3
|
+
This project is based on [@react-native-clipboard/clipboard](https://github.com/react-native-clipboard/clipboard)
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
- [中文](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-clipboard-clipboard.md)
|
|
8
|
+
|
|
9
|
+
- [English](https://gitee.com/react-native-oh-library/usage-docs/blob/master/en/react-native-clipboard-clipboard.md)
|
|
10
|
+
|
|
11
|
+
## License
|
|
12
|
+
|
|
13
|
+
This library is licensed under [The MIT License (MIT)](https://github.com/react-native-clipboard/clipboard/blob/master/LICENSE)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
|
6
|
+
|
|
7
|
+
Pod::Spec.new do |s|
|
|
8
|
+
s.name = "RNCClipboard"
|
|
9
|
+
s.version = package['version']
|
|
10
|
+
s.summary = package['description']
|
|
11
|
+
s.license = package['license']
|
|
12
|
+
|
|
13
|
+
s.authors = package['author']
|
|
14
|
+
s.homepage = package['homepage']
|
|
15
|
+
|
|
16
|
+
s.source = { :git => "https://github.com/react-native-clipboard/clipboard", :tag => "v#{s.version}" }
|
|
17
|
+
s.ios.source_files = "ios/**/*.{h,m,mm}"
|
|
18
|
+
s.osx.source_files = "macos/**/*.{h,m,mm}"
|
|
19
|
+
s.visionos.source_files = "ios/**/*.{h,m,mm}"
|
|
20
|
+
|
|
21
|
+
if fabric_enabled
|
|
22
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
23
|
+
|
|
24
|
+
s.pod_target_xcconfig = {
|
|
25
|
+
'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/boost" "$(PODS_ROOT)/boost-for-react-native" "$(PODS_ROOT)/RCT-Folly"',
|
|
26
|
+
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
|
|
27
|
+
}
|
|
28
|
+
s.platforms = { ios: '11.0', tvos: '11.0', :osx => "10.14", :visionos => "1.0" }
|
|
29
|
+
s.compiler_flags = folly_compiler_flags + ' -DRCT_NEW_ARCH_ENABLED'
|
|
30
|
+
|
|
31
|
+
install_modules_dependencies(s)
|
|
32
|
+
else
|
|
33
|
+
s.platforms = { :ios => "9.0", :tvos => "9.0", :osx => "10.14", :visionos => "1.0" }
|
|
34
|
+
|
|
35
|
+
s.dependency "React-Core"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { type 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
|
+
* (iOS and 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
|
+
};
|
|
@@ -0,0 +1,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 (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
|
+
const react_native_1 = require("react-native");
|
|
28
|
+
const 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() {
|
|
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() {
|
|
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() {
|
|
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() {
|
|
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(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
|
+
* (iOS and 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() {
|
|
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(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(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() {
|
|
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() {
|
|
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() {
|
|
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() {
|
|
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() {
|
|
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(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() {
|
|
230
|
+
(0, NativeClipboardModule_1.removeAllListeners)();
|
|
231
|
+
},
|
|
232
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useClipboard = void 0;
|
|
4
|
+
const 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;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015-present, Facebook, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
OPEN SOURCE SOFTWARE NOTICE
|
|
2
|
+
|
|
3
|
+
Please note we provide an open source software notice for the third party open source software along with this software and/or this software component (in the following just “this SOFTWARE”). The open source software licenses are granted by the respective right holders.
|
|
4
|
+
|
|
5
|
+
Warranty Disclaimer
|
|
6
|
+
THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
|
|
7
|
+
|
|
8
|
+
Copyright Notice and License Texts
|
|
9
|
+
|
|
10
|
+
----------------------------------------------------------------------
|
|
11
|
+
Software: @react-native-clipboard/clipboard V1.16.2
|
|
12
|
+
|
|
13
|
+
MIT License
|
|
14
|
+
|
|
15
|
+
Copyright (c) 2015-present, Facebook, Inc.
|
|
16
|
+
|
|
17
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
18
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
19
|
+
in the Software without restriction, including without limitation the rights
|
|
20
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
21
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
22
|
+
furnished to do so, subject to the following conditions:
|
|
23
|
+
|
|
24
|
+
The above copyright notice and this permission notice shall be included in all
|
|
25
|
+
copies or substantial portions of the Software.
|
|
26
|
+
|
|
27
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
30
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
31
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
|
+
SOFTWARE.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<configuration>
|
|
3
|
+
<oatconfig>
|
|
4
|
+
<licensefile>LICENSE</licensefile>
|
|
5
|
+
<filefilterlist>
|
|
6
|
+
<filefilter name="copyrightPolicyFilter" desc="Filters for compatibility,license header policies">
|
|
7
|
+
<filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加版权头"/>
|
|
8
|
+
<filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加版权头"/>
|
|
9
|
+
<filteritem type="filename" name="*.proto" desc="资源文件,不需要添加版权头"/>
|
|
10
|
+
<filteritem type="filename" name="*.json" desc="资源文件,不需要添加版权头"/>
|
|
11
|
+
<filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
12
|
+
<filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
13
|
+
<filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
14
|
+
<filteritem type="filename" name="LICENSE" desc="工程文件,不修改版权头"/>
|
|
15
|
+
</filefilter>
|
|
16
|
+
<filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
|
|
17
|
+
<filteritem type="filename" name="hvigorfile.ts" desc="hvigor构建脚本,DevEco Studio自动生成,不需要添加许可证头"/>
|
|
18
|
+
<filteritem type="filename" name="*.json5" desc="hvigor工程配置文件,DevEco Studio自动生成,不需要添加许可证头"/>
|
|
19
|
+
<filteritem type="filename" name="LICENSE" desc="原三方库证书文件无需更改,因此添加过滤"/>
|
|
20
|
+
<filteritem type="filename" name="*.proto" desc="资源文件,不需要添加许可证头"/>
|
|
21
|
+
<filteritem type="filename" name="*.json" desc="资源文件,不需要添加许可证头"/>
|
|
22
|
+
<filteritem type="filepath" name="hvigorw" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
23
|
+
<filteritem type="filepath" name="hvigorw.bat" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
24
|
+
<filteritem type="filepath" name="hvigor/hvigor-wrapper.js" desc="工程模板,不修改版权头,以防有修改版权风险"/>
|
|
25
|
+
</filefilter>
|
|
26
|
+
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for resources files policies">
|
|
27
|
+
<filteritem type="filename" name="icon.png" desc="应用图标"/>
|
|
28
|
+
<filteritem type="filename" name="app_icon.png" desc="应用图标"/>
|
|
29
|
+
<filteritem type="filename" name="warn.png" desc="页面展示图标"/>
|
|
30
|
+
</filefilter>
|
|
31
|
+
</filefilterlist>
|
|
32
|
+
<policylist>
|
|
33
|
+
<policy name="projectPolicy" desc="">
|
|
34
|
+
<policyitem type="license" name="MIT" path="*.*" desc="license under the MIT"/>
|
|
35
|
+
</policy>
|
|
36
|
+
</policylist>
|
|
37
|
+
</oatconfig>
|
|
38
|
+
</configuration>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"Name": "@react-native-clipboard/clipboard",
|
|
4
|
+
"License": "MIT License",
|
|
5
|
+
"License File": " LICENSE ",
|
|
6
|
+
"Version Number": "1.16.2",
|
|
7
|
+
"Owner" : "xiafeng@huawei.com",
|
|
8
|
+
"Upstream URL": "https://github.com/react-native-clipboard/clipboard",
|
|
9
|
+
"Description": "React Native Clipboard API for both iOS and Android."
|
|
10
|
+
}
|
|
11
|
+
]
|