@react-native-clipboard/clipboard 1.16.2 → 1.17.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.
package/Package.swift ADDED
@@ -0,0 +1,54 @@
1
+ // swift-tools-version: 6.0
2
+ // Built through React Native's SwiftPM autolinker, which links this package at
3
+ // <app>/build/generated/autolinking/libs/RNCClipboard. The relative package paths
4
+ // resolve from there to the app's React Native xcframeworks and codegen output.
5
+ // This file has no scaffolder marker, so `react-native spm scaffold` leaves it alone.
6
+
7
+ import Foundation
8
+ import PackageDescription
9
+
10
+ // The target path is the package root, and SwiftPM scans all of it for implicit
11
+ // resources: example/'s .xib/.lproj, or any in node_modules/, would demand a
12
+ // defaultLocalization. So exclude every root entry the target does not use.
13
+ // Listing the entries, not naming them, works in a repo checkout and in an npm
14
+ // install alike; excluding a missing path makes SwiftPM warn.
15
+ // SwiftPM caches this manifest's result and does not see the listing change.
16
+ // When a root entry appears or disappears after the first resolve (for
17
+ // example node_modules/ from `yarn install` or `rm -rf`), reset the package
18
+ // cache: in Xcode, File > Packages > Reset Package Caches; for `swift build`,
19
+ // delete ~/Library/Caches/org.swift.swiftpm/manifests.
20
+ let usedRootEntries: Set<String> = ["ios", "include", "Package.swift"]
21
+ let unusedRootEntries = try! FileManager.default.contentsOfDirectory(atPath: Context.packageDirectory)
22
+ .filter { !usedRootEntries.contains($0) }
23
+ .sorted()
24
+
25
+ let package = Package(
26
+ name: "RNCClipboard",
27
+ platforms: [.iOS("15.1")],
28
+ products: [
29
+ .library(name: "RNCClipboard", targets: ["RNCClipboard"]),
30
+ ],
31
+ dependencies: [
32
+ .package(name: "ReactNative", path: "../../../../xcframeworks"),
33
+ .package(name: "React-GeneratedCode", path: "../../../ios"),
34
+ ],
35
+ targets: [
36
+ .target(
37
+ name: "RNCClipboard",
38
+ dependencies: [.product(name: "ReactHeaders", package: "ReactNative"), .product(name: "ReactNativeHeaders", package: "ReactNative"), .product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"), .product(name: "ReactAppHeaders", package: "React-GeneratedCode")],
39
+ path: ".",
40
+ exclude: ["ios/RNCClipboard.xcodeproj"] + unusedRootEntries,
41
+ sources: ["ios"],
42
+ // Not "ios": SwiftPM rejects ios/RNCClipboard.h as an umbrella header while
43
+ // RNCClipboard.xcodeproj sits next to it. The shim also gives dependents the
44
+ // CocoaPods spelling <RNCClipboard/RNCClipboard.h>.
45
+ publicHeadersPath: "include",
46
+ // CocoaPods gets RCT_NEW_ARCH_ENABLED from install_modules_dependencies;
47
+ // without it RNCClipboard compiles as a legacy bridge module.
48
+ cSettings: [.define("RCT_NEW_ARCH_ENABLED", to: "1")],
49
+ cxxSettings: [.define("RCT_NEW_ARCH_ENABLED", to: "1"), .define("DEBUG", .when(configuration: .debug)), .define("NDEBUG", .when(configuration: .release))],
50
+ linkerSettings: [.linkedFramework("UIKit"), .linkedFramework("Foundation"), .linkedFramework("CoreServices"), .linkedFramework("MobileCoreServices")]
51
+ ),
52
+ ],
53
+ cxxLanguageStandard: .cxx20
54
+ )
@@ -17,6 +17,7 @@ Pod::Spec.new do |s|
17
17
  s.ios.source_files = "ios/**/*.{h,m,mm}"
18
18
  s.osx.source_files = "macos/**/*.{h,m,mm}"
19
19
  s.visionos.source_files = "ios/**/*.{h,m,mm}"
20
+ s.frameworks = 'CoreServices'
20
21
 
21
22
  if fabric_enabled
22
23
  folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
@@ -31,7 +31,7 @@ public class ClipboardPackage extends TurboReactPackage implements ViewManagerOn
31
31
  /** {@inheritDoc} */
32
32
  @Override
33
33
  public List<String> getViewManagerNames(ReactApplicationContext reactContext) {
34
- return null;
34
+ return Collections.emptyList();
35
35
  }
36
36
 
37
37
  @Override
@@ -0,0 +1 @@
1
+ #import "../../ios/RNCClipboard.h"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-clipboard/clipboard",
3
- "version": "1.16.2",
3
+ "version": "1.17.0",
4
4
  "description": "React Native Clipboard API for macOS, iOS, Android, and Windows",
5
5
  "keywords": [
6
6
  "Clipboard",
@@ -23,6 +23,8 @@
23
23
  "files": [
24
24
  "dist",
25
25
  "RNCClipboard.podspec",
26
+ "Package.swift",
27
+ "include",
26
28
  "ios",
27
29
  "macos",
28
30
  "android",
@@ -43,7 +45,8 @@
43
45
  "lint": "biome lint --write .",
44
46
  "prepare": "npm run build",
45
47
  "test": "jest",
46
- "type-check": "tsc --noEmit"
48
+ "type-check": "tsc --noEmit",
49
+ "release": "release-it"
47
50
  },
48
51
  "jest": {
49
52
  "preset": "react-native"
@@ -54,6 +57,7 @@
54
57
  "@callstack/react-native-visionos": "^0.76.0",
55
58
  "@react-native/babel-preset": "^0.75.0",
56
59
  "@react-native/metro-config": "^0.75.0",
60
+ "@release-it/conventional-changelog": "^12.0.2",
57
61
  "@rnx-kit/align-deps": "^2.4.1",
58
62
  "@rnx-kit/metro-config": "^2.0.0",
59
63
  "@types/react": "^18.2.0",
@@ -66,6 +70,7 @@
66
70
  "react-native-test-app": "^4.0.5",
67
71
  "react-native-windows": "^0.75.0",
68
72
  "react-test-renderer": "^18.2.0",
73
+ "release-it": "^21.1.2",
69
74
  "typescript": "^4.4.3"
70
75
  },
71
76
  "peerDependencies": {
@@ -85,6 +90,24 @@
85
90
  "publishConfig": {
86
91
  "access": "public"
87
92
  },
93
+ "release-it": {
94
+ "git": {
95
+ "commitMessage": "chore: release ${version}",
96
+ "tagName": "v${version}"
97
+ },
98
+ "npm": {
99
+ "publish": true,
100
+ "skipChecks": true
101
+ },
102
+ "github": {
103
+ "release": true
104
+ },
105
+ "plugins": {
106
+ "@release-it/conventional-changelog": {
107
+ "preset": "conventionalcommits"
108
+ }
109
+ }
110
+ },
88
111
  "codegenConfig": {
89
112
  "name": "rnclipboard",
90
113
  "type": "modules",
@@ -108,5 +131,8 @@
108
131
  "namespace": "Clipboard",
109
132
  "template": "cpp-lib"
110
133
  }
134
+ },
135
+ "swiftpmConfig": {
136
+ "name": "RNCClipboard"
111
137
  }
112
138
  }
@@ -1,23 +0,0 @@
1
- import type { EmitterSubscription } from 'react-native';
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;
20
- export default _default;
21
- declare const addListener: (callback: () => void) => EmitterSubscription;
22
- declare const removeAllListeners: () => void;
23
- export { addListener, removeAllListeners };
@@ -1,43 +0,0 @@
1
-
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.removeAllListeners = exports.addListener = void 0;
4
- const react_native_1 = require("react-native");
5
- exports.default = react_native_1.TurboModuleRegistry.get('RNCClipboard');
6
- const EVENT_NAME = 'RNCClipboard_TEXT_CHANGED';
7
- const eventEmitter = new react_native_1.NativeEventEmitter(react_native_1.NativeModules.RNCClipboard);
8
- let listenerCount = eventEmitter.listenerCount;
9
- // listenerCount is only available from RN 0.64
10
- // Older versions only have `listeners`
11
- if (!listenerCount) {
12
- listenerCount = (eventType) => {
13
- // @ts-ignore
14
- return eventEmitter.listeners(eventType).length;
15
- };
16
- }
17
- else {
18
- listenerCount = eventEmitter.listenerCount.bind(eventEmitter);
19
- }
20
- const addListener = (callback) => {
21
- if (listenerCount(EVENT_NAME) === 0) {
22
- react_native_1.NativeModules.RNCClipboard.setListener();
23
- }
24
- const res = eventEmitter.addListener(EVENT_NAME, callback);
25
- // Path the remove call to also remove the native listener
26
- // if we no longer have listeners
27
- // @ts-ignore
28
- res._remove = res.remove;
29
- res.remove = function () {
30
- // @ts-ignore
31
- this._remove();
32
- if (listenerCount(EVENT_NAME) === 0) {
33
- react_native_1.NativeModules.RNCClipboard.removeListener();
34
- }
35
- };
36
- return res;
37
- };
38
- exports.addListener = addListener;
39
- const removeAllListeners = () => {
40
- eventEmitter.removeAllListeners(EVENT_NAME);
41
- react_native_1.NativeModules.RNCClipboard.removeListener();
42
- };
43
- exports.removeAllListeners = removeAllListeners;