@react-native-clipboard/clipboard 1.11.2 → 1.13.0

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.
@@ -2,6 +2,8 @@ require 'json'
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
4
 
5
+ fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
6
+
5
7
  Pod::Spec.new do |s|
6
8
  s.name = "RNCClipboard"
7
9
  s.version = package['version']
@@ -10,11 +12,25 @@ Pod::Spec.new do |s|
10
12
 
11
13
  s.authors = package['author']
12
14
  s.homepage = package['homepage']
13
- s.platforms = { :ios => "9.0", :osx => "10.14" }
14
15
 
15
16
  s.source = { :git => "https://github.com/react-native-clipboard/clipboard", :tag => "v#{s.version}" }
16
17
  s.ios.source_files = "ios/**/*.{h,m,mm}"
17
18
  s.osx.source_files = "macos/**/*.{h,m,mm}"
18
19
 
19
- s.dependency 'React-Core'
20
+ if fabric_enabled
21
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
22
+
23
+ s.pod_target_xcconfig = {
24
+ 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/boost" "$(PODS_ROOT)/boost-for-react-native" "$(PODS_ROOT)/RCT-Folly"',
25
+ 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
26
+ }
27
+ s.platforms = { ios: '11.0', tvos: '11.0' }
28
+ s.compiler_flags = folly_compiler_flags + ' -DRCT_NEW_ARCH_ENABLED'
29
+
30
+ install_modules_dependencies(s)
31
+ else
32
+ s.platforms = { :ios => "9.0", :tvos => "9.0" }
33
+
34
+ s.dependency "React-Core"
35
+ end
20
36
  end
@@ -19,13 +19,75 @@ def getExtOrIntegerDefault(name) {
19
19
 
20
20
  apply plugin: 'com.android.library'
21
21
 
22
+ def resolveReactNativeDirectory() {
23
+ // monorepo workaround
24
+ // react-native can be hoisted or in project's own node_modules
25
+ def reactNativeFromProjectNodeModules = file("${rootProject.projectDir}/../node_modules/react-native")
26
+ if (reactNativeFromProjectNodeModules.exists()) {
27
+ return reactNativeFromProjectNodeModules
28
+ }
29
+
30
+ def reactNativeFromNodeModulesWithLibrary = file("${projectDir}/../../react-native")
31
+ if (reactNativeFromNodeModulesWithLibrary.exists()) {
32
+ return reactNativeFromNodeModulesWithLibrary
33
+ }
34
+
35
+ throw new Exception(
36
+ "[react-native-clipboard] Unable to resolve react-native location in " +
37
+ "node_modules. You should add project extension property (in app/build.gradle) " +
38
+ "`REACT_NATIVE_NODE_MODULES_DIR` with path to react-native."
39
+ )
40
+ }
41
+
42
+ def REACT_NATIVE_DIR = resolveReactNativeDirectory()
43
+
44
+ def reactProperties = new Properties()
45
+ file("$REACT_NATIVE_DIR/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
46
+
47
+ def REACT_NATIVE_VERSION = reactProperties.getProperty("VERSION_NAME")
48
+ def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION.startsWith("0.0.0-") ? 1000 : REACT_NATIVE_VERSION.split("\\.")[1].toInteger()
49
+
50
+ def isNewArchitectureEnabled() {
51
+ // To opt-in for the New Architecture, you can either:
52
+ // - Set `newArchEnabled` to true inside the `gradle.properties` file
53
+ // - Invoke gradle with `-newArchEnabled=true`
54
+ // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
55
+ return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
56
+ }
57
+
58
+ if (isNewArchitectureEnabled()) {
59
+ apply plugin: "com.facebook.react"
60
+ }
61
+
22
62
  android {
63
+ def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
64
+ if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
65
+ namespace "com.reactnativecommunity.clipboard"
66
+ }
67
+
23
68
  compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
24
69
 
70
+ // Used to override the NDK path/version on internal CI or by allowing
71
+ // users to customize the NDK path/version from their root project (e.g. for M1 support)
72
+ if (rootProject.hasProperty("ndkPath")) {
73
+ ndkPath rootProject.ext.ndkPath
74
+ }
75
+ if (rootProject.hasProperty("ndkVersion")) {
76
+ ndkVersion rootProject.ext.ndkVersion
77
+ }
78
+
25
79
  defaultConfig {
26
80
  minSdkVersion getExtOrIntegerDefault('minSdkVersion')
27
81
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
28
82
  }
83
+
84
+ sourceSets.main {
85
+ java {
86
+ if (!isNewArchitectureEnabled()) {
87
+ srcDirs += 'src/paper/java'
88
+ }
89
+ }
90
+ }
29
91
  }
30
92
 
31
93
  repositories {
@@ -35,5 +97,9 @@ repositories {
35
97
 
36
98
  dependencies {
37
99
  //noinspection GradleDynamicVersion
38
- implementation 'com.facebook.react:react-native:+'
100
+ if (isNewArchitectureEnabled() && REACT_NATIVE_MINOR_VERSION < 71) {
101
+ implementation project(":ReactAndroid")
102
+ } else {
103
+ implementation 'com.facebook.react:react-native:+'
104
+ }
39
105
  }
@@ -24,6 +24,7 @@ import com.facebook.react.bridge.ReactApplicationContext;
24
24
  import com.facebook.react.bridge.ReactContextBaseJavaModule;
25
25
  import com.facebook.react.bridge.ReactMethod;
26
26
  import com.facebook.react.bridge.Promise;
27
+ import com.facebook.react.bridge.ReadableArray;
27
28
  import com.facebook.react.module.annotations.ReactModule;
28
29
  import com.facebook.react.modules.core.DeviceEventManagerModule;
29
30
 
@@ -35,7 +36,7 @@ import java.nio.ByteBuffer;
35
36
  * A module that allows JS to get/set clipboard contents.
36
37
  */
37
38
  @ReactModule(name = ClipboardModule.NAME)
38
- public class ClipboardModule extends ReactContextBaseJavaModule {
39
+ public class ClipboardModule extends NativeClipboardModuleSpec {
39
40
 
40
41
  public static final String CLIPBOARD_TEXT_CHANGED = "RNCClipboard_TEXT_CHANGED";
41
42
  private ReactApplicationContext reactContext;
@@ -69,7 +70,7 @@ public class ClipboardModule extends ReactContextBaseJavaModule {
69
70
  ClipboardManager clipboard = getClipboardService();
70
71
  ClipData clipData = clipboard.getPrimaryClip();
71
72
  if (clipData != null && clipData.getItemCount() >= 1) {
72
- ClipData.Item firstItem = clipboard.getPrimaryClip().getItemAt(0);
73
+ ClipData.Item firstItem = clipData.getItemAt(0);
73
74
  promise.resolve("" + firstItem.getText());
74
75
  } else {
75
76
  promise.resolve("");
@@ -79,6 +80,26 @@ public class ClipboardModule extends ReactContextBaseJavaModule {
79
80
  }
80
81
  }
81
82
 
83
+ @Override
84
+ public void getStrings(Promise promise) {
85
+ promise.reject("Clipboard:getStrings", "getStrings is not supported on Android");
86
+ }
87
+
88
+ @Override
89
+ public void getImagePNG(Promise promise) {
90
+ promise.reject("Clipboard:getImagePNG", "getImagePNG is not supported on Android");
91
+ }
92
+
93
+ @Override
94
+ public void getImageJPG(Promise promise) {
95
+ promise.reject("Clipboard:getImageJPG", "getImageJPG is not supported on Android");
96
+ }
97
+
98
+ @Override
99
+ public void setImage(String content, Promise promise) {
100
+ promise.reject("Clipboard:setImage", "setImage is not supported on Android");
101
+ }
102
+
82
103
  @ReactMethod
83
104
  public void setString(String text) {
84
105
  try {
@@ -90,6 +111,11 @@ public class ClipboardModule extends ReactContextBaseJavaModule {
90
111
  }
91
112
  }
92
113
 
114
+ @Override
115
+ public void setStrings(ReadableArray content) {
116
+
117
+ }
118
+
93
119
  @ReactMethod
94
120
  public void hasString(Promise promise) {
95
121
  try {
@@ -101,6 +127,26 @@ public class ClipboardModule extends ReactContextBaseJavaModule {
101
127
  }
102
128
  }
103
129
 
130
+ @Override
131
+ public void hasImage(Promise promise) {
132
+ promise.reject("Clipboard:hasImage", "hasImage is not supported on Android");
133
+ }
134
+
135
+ @Override
136
+ public void hasURL(Promise promise) {
137
+ promise.reject("Clipboard:hasURL", "hasURL is not supported on Android");
138
+ }
139
+
140
+ @Override
141
+ public void hasNumber(Promise promise) {
142
+ promise.reject("Clipboard:hasNumber", "hasNumber is not supported on Android");
143
+ }
144
+
145
+ @Override
146
+ public void hasWebURL(Promise promise) {
147
+ promise.reject("Clipboard:hasWebURL", "hasWebURL is not supported on Android");
148
+ }
149
+
104
150
  @ReactMethod
105
151
  public void getImage(Promise promise){
106
152
  ClipboardManager clipboardManager = getClipboardService();
@@ -191,6 +237,11 @@ public class ClipboardModule extends ReactContextBaseJavaModule {
191
237
  // Keep: Required for RN built in Event Emitter Calls.
192
238
  }
193
239
 
240
+ @Override
241
+ public void removeListeners(double count) {
242
+
243
+ }
244
+
194
245
  @ReactMethod
195
246
  public void removeListeners(Integer count) {
196
247
  // Keep: Required for RN built in Event Emitter Calls.
@@ -1,16 +1,103 @@
1
1
  package com.reactnativecommunity.clipboard;
2
2
 
3
- import com.facebook.react.ReactPackage;
3
+ import androidx.annotation.Nullable;
4
+
5
+ import com.facebook.react.TurboReactPackage;
6
+ import com.facebook.react.ViewManagerOnDemandReactPackage;
7
+ import com.facebook.react.bridge.ModuleSpec;
4
8
  import com.facebook.react.bridge.NativeModule;
5
9
  import com.facebook.react.bridge.ReactApplicationContext;
10
+ import com.facebook.react.module.annotations.ReactModule;
11
+ import com.facebook.react.module.annotations.ReactModuleList;
12
+ import com.facebook.react.module.model.ReactModuleInfo;
13
+ import com.facebook.react.module.model.ReactModuleInfoProvider;
14
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
6
15
  import com.facebook.react.uimanager.ViewManager;
7
16
 
8
17
  import java.util.ArrayList;
9
18
  import java.util.Collections;
19
+ import java.util.HashMap;
10
20
  import java.util.List;
21
+ import java.util.Map;
22
+
23
+ import javax.annotation.Nonnull;
24
+
25
+ @ReactModuleList(
26
+ nativeModules = {
27
+ ClipboardModule.class,
28
+ })
29
+ public class ClipboardPackage extends TurboReactPackage implements ViewManagerOnDemandReactPackage {
30
+
31
+ /** {@inheritDoc} */
32
+ @Override
33
+ public List<String> getViewManagerNames(ReactApplicationContext reactContext) {
34
+ return null;
35
+ }
11
36
 
12
- public class ClipboardPackage implements ReactPackage {
37
+ @Override
38
+ protected List<ModuleSpec> getViewManagers(ReactApplicationContext reactContext) {
39
+ return null;
40
+ }
41
+
42
+ /** {@inheritDoc} */
43
+ @Override
44
+ public @Nullable ViewManager createViewManager(
45
+ ReactApplicationContext reactContext, String viewManagerName) {
46
+ return null;
47
+ }
13
48
 
49
+ @Override
50
+ public NativeModule getModule(String name, @Nonnull ReactApplicationContext reactContext) {
51
+ switch (name) {
52
+ case ClipboardModule.NAME:
53
+ return new ClipboardModule(reactContext);
54
+ default:
55
+ return null;
56
+ }
57
+ }
58
+
59
+ @Override
60
+ public ReactModuleInfoProvider getReactModuleInfoProvider() {
61
+ try {
62
+ Class<?> reactModuleInfoProviderClass =
63
+ Class.forName("com.reactnativecommunity.clipboard.ClipboardPackage$$ReactModuleInfoProvider");
64
+ return (ReactModuleInfoProvider) reactModuleInfoProviderClass.newInstance();
65
+ } catch (ClassNotFoundException e) {
66
+ // ReactModuleSpecProcessor does not run at build-time. Create this ReactModuleInfoProvider by
67
+ // hand.
68
+ return new ReactModuleInfoProvider() {
69
+ @Override
70
+ public Map<String, ReactModuleInfo> getReactModuleInfos() {
71
+ final Map<String, ReactModuleInfo> reactModuleInfoMap = new HashMap<>();
72
+
73
+ Class<? extends NativeModule>[] moduleList =
74
+ new Class[] {
75
+ ClipboardModule.class,
76
+ };
77
+
78
+ for (Class<? extends NativeModule> moduleClass : moduleList) {
79
+ ReactModule reactModule = moduleClass.getAnnotation(ReactModule.class);
80
+
81
+ reactModuleInfoMap.put(
82
+ reactModule.name(),
83
+ new ReactModuleInfo(
84
+ reactModule.name(),
85
+ moduleClass.getName(),
86
+ reactModule.canOverrideExistingModule(),
87
+ reactModule.needsEagerInit(),
88
+ reactModule.hasConstants(),
89
+ reactModule.isCxxModule(),
90
+ TurboModule.class.isAssignableFrom(moduleClass)));
91
+ }
92
+
93
+ return reactModuleInfoMap;
94
+ }
95
+ };
96
+ } catch (InstantiationException | IllegalAccessException e) {
97
+ throw new RuntimeException(
98
+ "No ReactModuleInfoProvider for com.reactnativecommunity.clipboard.ClipboardPackage$$ReactModuleInfoProvider", e);
99
+ }
100
+ }
14
101
  @Override
15
102
  public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
16
103
  return Collections.emptyList();
@@ -24,5 +111,4 @@ public class ClipboardPackage implements ReactPackage {
24
111
 
25
112
  return modules;
26
113
  }
27
-
28
114
  }
@@ -0,0 +1,96 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJavaSpec.js
9
+ *
10
+ * @nolint
11
+ */
12
+
13
+ package com.reactnativecommunity.clipboard;
14
+
15
+ import com.facebook.proguard.annotations.DoNotStrip;
16
+ import com.facebook.react.bridge.Promise;
17
+ import com.facebook.react.bridge.ReactApplicationContext;
18
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
19
+ import com.facebook.react.bridge.ReactMethod;
20
+ import com.facebook.react.bridge.ReactModuleWithSpec;
21
+ import com.facebook.react.bridge.ReadableArray;
22
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
23
+
24
+ public abstract class NativeClipboardModuleSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule {
25
+ public NativeClipboardModuleSpec(ReactApplicationContext reactContext) {
26
+ super(reactContext);
27
+ }
28
+
29
+ @ReactMethod
30
+ @DoNotStrip
31
+ public abstract void getString(Promise promise);
32
+
33
+ @ReactMethod
34
+ @DoNotStrip
35
+ public abstract void getStrings(Promise promise);
36
+
37
+ @ReactMethod
38
+ @DoNotStrip
39
+ public abstract void getImagePNG(Promise promise);
40
+
41
+ @ReactMethod
42
+ @DoNotStrip
43
+ public abstract void getImageJPG(Promise promise);
44
+
45
+ @ReactMethod
46
+ @DoNotStrip
47
+ public abstract void setImage(String content, Promise promise);
48
+
49
+ @ReactMethod
50
+ @DoNotStrip
51
+ public abstract void getImage(Promise promise);
52
+
53
+ @ReactMethod
54
+ @DoNotStrip
55
+ public abstract void setString(String content);
56
+
57
+ @ReactMethod
58
+ @DoNotStrip
59
+ public abstract void setStrings(ReadableArray content);
60
+
61
+ @ReactMethod
62
+ @DoNotStrip
63
+ public abstract void hasString(Promise promise);
64
+
65
+ @ReactMethod
66
+ @DoNotStrip
67
+ public abstract void hasImage(Promise promise);
68
+
69
+ @ReactMethod
70
+ @DoNotStrip
71
+ public abstract void hasURL(Promise promise);
72
+
73
+ @ReactMethod
74
+ @DoNotStrip
75
+ public abstract void hasNumber(Promise promise);
76
+
77
+ @ReactMethod
78
+ @DoNotStrip
79
+ public abstract void hasWebURL(Promise promise);
80
+
81
+ @ReactMethod
82
+ @DoNotStrip
83
+ public abstract void setListener();
84
+
85
+ @ReactMethod
86
+ @DoNotStrip
87
+ public abstract void removeListener();
88
+
89
+ @ReactMethod
90
+ @DoNotStrip
91
+ public abstract void addListener(String eventName);
92
+
93
+ @ReactMethod
94
+ @DoNotStrip
95
+ public abstract void removeListeners(double count);
96
+ }
@@ -90,7 +90,7 @@ export declare const Clipboard: {
90
90
  * }
91
91
  * ```
92
92
  */
93
- hasString(): any;
93
+ hasString(): Promise<boolean>;
94
94
  /**
95
95
  * Returns whether the clipboard has an image or is empty.
96
96
  * This method returns a `Promise`, so you can use following code to check clipboard content
@@ -100,7 +100,7 @@ export declare const Clipboard: {
100
100
  * }
101
101
  * ```
102
102
  */
103
- hasImage(): any;
103
+ hasImage(): Promise<boolean>;
104
104
  /**
105
105
  * (iOS Only)
106
106
  * Returns whether the clipboard has a URL content. Can check
@@ -112,7 +112,7 @@ export declare const Clipboard: {
112
112
  * }
113
113
  * ```
114
114
  */
115
- hasURL(): any;
115
+ hasURL(): Promise<boolean> | undefined;
116
116
  /**
117
117
  * (iOS 14+ Only)
118
118
  * Returns whether the clipboard has a Number(UIPasteboardDetectionPatternNumber) content. Can check
@@ -124,7 +124,7 @@ export declare const Clipboard: {
124
124
  * }
125
125
  * ```
126
126
  */
127
- hasNumber(): any;
127
+ hasNumber(): Promise<boolean> | undefined;
128
128
  /**
129
129
  * (iOS 14+ Only)
130
130
  * Returns whether the clipboard has a WebURL(UIPasteboardDetectionPatternProbableWebURL) content. Can check
@@ -136,7 +136,7 @@ export declare const Clipboard: {
136
136
  * }
137
137
  * ```
138
138
  */
139
- hasWebURL(): any;
139
+ hasWebURL(): Promise<boolean> | undefined;
140
140
  /**
141
141
  * (iOS and Android Only)
142
142
  * Adds a listener to get notifications when the clipboard has changed.
package/dist/Clipboard.js CHANGED
@@ -21,7 +21,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.Clipboard = void 0;
23
23
  var react_native_1 = require("react-native");
24
- var NativeClipboard_1 = __importStar(require("./NativeClipboard"));
24
+ var NativeClipboardModule_1 = __importStar(require("./NativeClipboardModule"));
25
25
  /**
26
26
  * `Clipboard` gives you an interface for setting and getting content from Clipboard on both iOS and Android
27
27
  */
@@ -35,7 +35,7 @@ exports.Clipboard = {
35
35
  * ```
36
36
  */
37
37
  getString: function () {
38
- return NativeClipboard_1.default.getString();
38
+ return NativeClipboardModule_1.default.getString();
39
39
  },
40
40
  /**
41
41
  * (iOS Only)
@@ -47,7 +47,7 @@ exports.Clipboard = {
47
47
  * ```
48
48
  */
49
49
  getStrings: function () {
50
- return NativeClipboard_1.default.getStrings();
50
+ return NativeClipboardModule_1.default.getStrings();
51
51
  },
52
52
  /**
53
53
  * Get clipboard image as PNG in base64, this method returns a `Promise`, so you can use following code to get clipboard content
@@ -58,7 +58,7 @@ exports.Clipboard = {
58
58
  * ```
59
59
  */
60
60
  getImagePNG: function () {
61
- return NativeClipboard_1.default.getImagePNG();
61
+ return NativeClipboardModule_1.default.getImagePNG();
62
62
  },
63
63
  /**
64
64
  * Get clipboard image as JPG in base64, this method returns a `Promise`, so you can use following code to get clipboard content
@@ -69,7 +69,7 @@ exports.Clipboard = {
69
69
  * ```
70
70
  */
71
71
  getImageJPG: function () {
72
- return NativeClipboard_1.default.getImageJPG();
72
+ return NativeClipboardModule_1.default.getImageJPG();
73
73
  },
74
74
  /**
75
75
  * (iOS Only)
@@ -85,7 +85,7 @@ exports.Clipboard = {
85
85
  if (react_native_1.Platform.OS !== 'ios') {
86
86
  return;
87
87
  }
88
- NativeClipboard_1.default.setImage(content);
88
+ NativeClipboardModule_1.default.setImage(content);
89
89
  },
90
90
  /**
91
91
  * (Android Only)
@@ -97,7 +97,7 @@ exports.Clipboard = {
97
97
  * ```
98
98
  */
99
99
  getImage: function () {
100
- return NativeClipboard_1.default.getImage();
100
+ return NativeClipboardModule_1.default.getImage();
101
101
  },
102
102
  /**
103
103
  * Set content of string type. You can use following code to set clipboard content
@@ -109,7 +109,7 @@ exports.Clipboard = {
109
109
  * @param the content to be stored in the clipboard.
110
110
  */
111
111
  setString: function (content) {
112
- NativeClipboard_1.default.setString(content);
112
+ NativeClipboardModule_1.default.setString(content);
113
113
  },
114
114
  /**
115
115
  * Set content of string array type. You can use following code to set clipboard content
@@ -121,7 +121,7 @@ exports.Clipboard = {
121
121
  * @param the content to be stored in the clipboard.
122
122
  */
123
123
  setStrings: function (content) {
124
- NativeClipboard_1.default.setStrings(content);
124
+ NativeClipboardModule_1.default.setStrings(content);
125
125
  },
126
126
  /**
127
127
  * Returns whether the clipboard has content or is empty.
@@ -133,7 +133,7 @@ exports.Clipboard = {
133
133
  * ```
134
134
  */
135
135
  hasString: function () {
136
- return NativeClipboard_1.default.hasString();
136
+ return NativeClipboardModule_1.default.hasString();
137
137
  },
138
138
  /**
139
139
  * Returns whether the clipboard has an image or is empty.
@@ -145,7 +145,7 @@ exports.Clipboard = {
145
145
  * ```
146
146
  */
147
147
  hasImage: function () {
148
- return NativeClipboard_1.default.hasImage();
148
+ return NativeClipboardModule_1.default.hasImage();
149
149
  },
150
150
  /**
151
151
  * (iOS Only)
@@ -162,7 +162,7 @@ exports.Clipboard = {
162
162
  if (react_native_1.Platform.OS !== 'ios') {
163
163
  return;
164
164
  }
165
- return NativeClipboard_1.default.hasURL();
165
+ return NativeClipboardModule_1.default.hasURL();
166
166
  },
167
167
  /**
168
168
  * (iOS 14+ Only)
@@ -179,7 +179,7 @@ exports.Clipboard = {
179
179
  if (react_native_1.Platform.OS !== 'ios') {
180
180
  return;
181
181
  }
182
- return NativeClipboard_1.default.hasNumber();
182
+ return NativeClipboardModule_1.default.hasNumber();
183
183
  },
184
184
  /**
185
185
  * (iOS 14+ Only)
@@ -196,7 +196,7 @@ exports.Clipboard = {
196
196
  if (react_native_1.Platform.OS !== 'ios') {
197
197
  return;
198
198
  }
199
- return NativeClipboard_1.default.hasWebURL();
199
+ return NativeClipboardModule_1.default.hasWebURL();
200
200
  },
201
201
  /**
202
202
  * (iOS and Android Only)
@@ -209,7 +209,7 @@ exports.Clipboard = {
209
209
  * ```
210
210
  */
211
211
  addListener: function (callback) {
212
- return (0, NativeClipboard_1.addListener)(callback);
212
+ return (0, NativeClipboardModule_1.addListener)(callback);
213
213
  },
214
214
  /**
215
215
  * (iOS and Android Only)
@@ -219,6 +219,6 @@ exports.Clipboard = {
219
219
  * ```
220
220
  */
221
221
  removeAllListeners: function () {
222
- (0, NativeClipboard_1.removeAllListeners)();
222
+ (0, NativeClipboardModule_1.removeAllListeners)();
223
223
  },
224
224
  };
@@ -1,5 +1,22 @@
1
1
  import { EmitterSubscription } from 'react-native';
2
- declare const _default: any;
2
+ import type { TurboModule } from 'react-native';
3
+ export interface Spec extends TurboModule {
4
+ getConstants: () => {};
5
+ getString: () => Promise<string>;
6
+ getStrings: () => Promise<string[]>;
7
+ setString: (content: string) => void;
8
+ hasString: () => Promise<boolean>;
9
+ hasNumber: () => Promise<boolean>;
10
+ getImagePNG: () => Promise<string>;
11
+ getImageJPG: () => Promise<string>;
12
+ setImage: (content: string) => void;
13
+ getImage: () => Promise<string>;
14
+ setStrings: (content: string[]) => void;
15
+ hasImage: () => Promise<boolean>;
16
+ hasURL: () => Promise<boolean>;
17
+ hasWebURL: () => Promise<boolean>;
18
+ }
19
+ declare const _default: Spec;
3
20
  export default _default;
4
21
  declare const addListener: (callback: () => void) => EmitterSubscription;
5
22
  declare const removeAllListeners: () => void;
@@ -2,15 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.removeAllListeners = exports.addListener = void 0;
4
4
  var react_native_1 = require("react-native");
5
- // Separated file for Native Clipboard to be ready to switch to Turbo Module when it becomes public
6
- // TODO: uncomment when Turbo module is available
7
- // export interface Spec extends TurboModule {
8
- // +getConstants: () => {||};
9
- // +getString: () => Promise<string>;
10
- // +setString: (content: string) => void;
11
- // +hasString: () => Promise<boolean>;
12
- // }
13
- exports.default = react_native_1.NativeModules.RNCClipboard;
5
+ exports.default = react_native_1.TurboModuleRegistry.get('RNCClipboard');
14
6
  var EVENT_NAME = 'RNCClipboard_TEXT_CHANGED';
15
7
  var eventEmitter = new react_native_1.NativeEventEmitter(react_native_1.NativeModules.RNCClipboard);
16
8
  var listenerCount = eventEmitter.listenerCount;