@react-native-kakao/share 0.2.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/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 mym0404
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md ADDED
File without changes
@@ -0,0 +1,41 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5
+
6
+ Pod::Spec.new do |s|
7
+ s.name = "RNCKakaoShare"
8
+ s.version = package["version"]
9
+ s.summary = package["description"]
10
+ s.homepage = package["homepage"]
11
+ s.license = package["license"]
12
+ s.authors = package["author"]
13
+
14
+ s.platforms = { :ios => min_ios_version_supported }
15
+ s.source = { :git => "https://github.com/mj-studio-library/react-native-kakao.git", :tag => "#{s.version}" }
16
+
17
+ s.source_files = "ios/**/*.{h,m,mm}"
18
+
19
+ # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
20
+ # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
21
+ if respond_to?(:install_modules_dependencies, true)
22
+ install_modules_dependencies(s)
23
+ else
24
+ s.dependency "React-Core"
25
+
26
+ # Don't install the dependencies when we run `pod install` in the old architecture.
27
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
28
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
29
+ s.pod_target_xcconfig = {
30
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
31
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
32
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
33
+ }
34
+ s.dependency "React-Codegen"
35
+ s.dependency "RCT-Folly"
36
+ s.dependency "RCTRequired"
37
+ s.dependency "RCTTypeSafety"
38
+ s.dependency "ReactCommon/turbomodule/core"
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,120 @@
1
+ buildscript {
2
+ // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
+ def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["KakaoShare_kotlinVersion"]
4
+
5
+ repositories {
6
+ google()
7
+ mavenCentral()
8
+ }
9
+
10
+ dependencies {
11
+ classpath "com.android.tools.build:gradle:7.2.1"
12
+ // noinspection DifferentKotlinGradleVersion
13
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14
+ }
15
+ }
16
+
17
+ def isNewArchitectureEnabled() {
18
+ return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
19
+ }
20
+
21
+ apply plugin: "com.android.library"
22
+ apply plugin: "kotlin-android"
23
+
24
+ if (isNewArchitectureEnabled()) {
25
+ apply plugin: "com.facebook.react"
26
+ }
27
+
28
+ def getExtOrDefault(name) {
29
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["KakaoShare_" + name]
30
+ }
31
+
32
+ def getExtOrIntegerDefault(name) {
33
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["KakaoShare_" + name]).toInteger()
34
+ }
35
+
36
+ def supportsNamespace() {
37
+ def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
38
+ def major = parsed[0].toInteger()
39
+ def minor = parsed[1].toInteger()
40
+
41
+ // Namespace support was added in 7.3.0
42
+ return (major == 7 && minor >= 3) || major >= 8
43
+ }
44
+
45
+ android {
46
+ if (supportsNamespace()) {
47
+ namespace "com.kakaoshare"
48
+
49
+ sourceSets {
50
+ main {
51
+ manifest.srcFile "src/main/AndroidManifestNew.xml"
52
+ }
53
+ }
54
+ }
55
+
56
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
57
+
58
+ defaultConfig {
59
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
60
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
61
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
62
+
63
+ }
64
+
65
+ buildFeatures {
66
+ buildConfig true
67
+ }
68
+
69
+ buildTypes {
70
+ release {
71
+ minifyEnabled false
72
+ }
73
+ }
74
+
75
+ lintOptions {
76
+ disable "GradleCompatible"
77
+ }
78
+
79
+ compileOptions {
80
+ sourceCompatibility JavaVersion.VERSION_1_8
81
+ targetCompatibility JavaVersion.VERSION_1_8
82
+ }
83
+
84
+ sourceSets {
85
+ main {
86
+ if (isNewArchitectureEnabled()) {
87
+ java.srcDirs += [
88
+ "src/newarch",
89
+ // This is needed to build Kotlin project with NewArch enabled
90
+ "${project.buildDir}/generated/source/codegen/java"
91
+ ]
92
+ } else {
93
+ java.srcDirs += ["src/oldarch"]
94
+ }
95
+ }
96
+ }
97
+ }
98
+
99
+ repositories {
100
+ mavenCentral()
101
+ google()
102
+ }
103
+
104
+ def kotlin_version = getExtOrDefault("kotlinVersion")
105
+
106
+ dependencies {
107
+ // For < 0.71, this will be from the local maven repo
108
+ // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
109
+ //noinspection GradleDynamicVersion
110
+ implementation "com.facebook.react:react-native:+"
111
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
112
+ }
113
+
114
+ if (isNewArchitectureEnabled()) {
115
+ react {
116
+ jsRootDir = file("../src/")
117
+ libraryName = "KakaoShare"
118
+ codegenJavaPackageName = "com.kakaoshare"
119
+ }
120
+ }
@@ -0,0 +1,5 @@
1
+ KakaoShare_kotlinVersion=1.7.0
2
+ KakaoShare_minSdkVersion=21
3
+ KakaoShare_targetSdkVersion=31
4
+ KakaoShare_compileSdkVersion=31
5
+ KakaoShare_ndkversion=21.4.7075529
@@ -0,0 +1,3 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.kakaoshare">
3
+ </manifest>
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,24 @@
1
+ package com.kakaoshare
2
+
3
+ import com.facebook.react.bridge.ReactApplicationContext
4
+ import com.facebook.react.bridge.ReactMethod
5
+ import com.facebook.react.bridge.Promise
6
+
7
+ class KakaoShareModule internal constructor(context: ReactApplicationContext) :
8
+ KakaoShareSpec(context) {
9
+
10
+ override fun getName(): String {
11
+ return NAME
12
+ }
13
+
14
+ // Example method
15
+ // See https://reactnative.dev/docs/native-modules-android
16
+ @ReactMethod
17
+ override fun multiply(a: Double, b: Double, promise: Promise) {
18
+ promise.resolve(a * b)
19
+ }
20
+
21
+ companion object {
22
+ const val NAME = "KakaoShare"
23
+ }
24
+ }
@@ -0,0 +1,35 @@
1
+ package com.kakaoshare
2
+
3
+ import com.facebook.react.TurboReactPackage
4
+ import com.facebook.react.bridge.ReactApplicationContext
5
+ import com.facebook.react.bridge.NativeModule
6
+ import com.facebook.react.module.model.ReactModuleInfoProvider
7
+ import com.facebook.react.module.model.ReactModuleInfo
8
+ import java.util.HashMap
9
+
10
+ class KakaoSharePackage : TurboReactPackage() {
11
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
12
+ return if (name == KakaoShareModule.NAME) {
13
+ KakaoShareModule(reactContext)
14
+ } else {
15
+ null
16
+ }
17
+ }
18
+
19
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
20
+ return ReactModuleInfoProvider {
21
+ val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
22
+ val isTurboModule: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
23
+ moduleInfos[KakaoShareModule.NAME] = ReactModuleInfo(
24
+ KakaoShareModule.NAME,
25
+ KakaoShareModule.NAME,
26
+ false, // canOverrideExistingModule
27
+ false, // needsEagerInit
28
+ true, // hasConstants
29
+ false, // isCxxModule
30
+ isTurboModule // isTurboModule
31
+ )
32
+ moduleInfos
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,12 @@
1
+
2
+ #ifdef RCT_NEW_ARCH_ENABLED
3
+ #import "RNCKakaoShareSpec.h"
4
+
5
+ @interface RNCKakaoShare : NSObject <NativeKakaoShareSpec>
6
+ #else
7
+ #import <React/RCTBridgeModule.h>
8
+
9
+ @interface RNCKakaoShare : NSObject <RCTBridgeModule>
10
+ #endif
11
+
12
+ @end
@@ -0,0 +1,30 @@
1
+ #import "RNCKakaoShare.h"
2
+
3
+ @implementation RNCKakaoShare
4
+ RCT_EXPORT_MODULE()
5
+
6
+ // Example method
7
+ // See // https://reactnative.dev/docs/native-modules-ios
8
+ RCT_EXPORT_METHOD(multiply
9
+ : (double)a b
10
+ : (double)b resolve
11
+ : (RCTPromiseResolveBlock)resolve reject
12
+ : (RCTPromiseRejectBlock)reject) {
13
+ NSNumber* result = @(a * b);
14
+
15
+ resolve(result);
16
+ }
17
+
18
+ - (NSNumber*)add:(double)a b:(double)b {
19
+ return @(a + b);
20
+ }
21
+
22
+ // Don't compile this code when we build for the old architecture.
23
+ #ifdef RCT_NEW_ARCH_ENABLED
24
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
25
+ (const facebook::react::ObjCTurboModule::InitParams&)params {
26
+ return std::make_shared<facebook::react::NativeKakaoShareSpecJSI>(params);
27
+ }
28
+ #endif
29
+
30
+ @end
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.add = add;
7
+ exports.multiply = multiply;
8
+ var _reactNative = require("react-native");
9
+ const LINKING_ERROR = `The package '@react-native-kakao/share' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
10
+ ios: "- You have run 'pod install'\n",
11
+ default: ''
12
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
13
+
14
+ // @ts-expect-error
15
+ const isTurboModuleEnabled = global.__turboModuleProxy != null;
16
+ const KakaoShareModule = isTurboModuleEnabled ? require('./spec/NativeKakaoShare').default : _reactNative.NativeModules.KakaoShare;
17
+ const KakaoShare = KakaoShareModule ? KakaoShareModule : new Proxy({}, {
18
+ get() {
19
+ throw new Error(LINKING_ERROR);
20
+ }
21
+ });
22
+ function multiply(a, b) {
23
+ return KakaoShare.multiply(a, b);
24
+ }
25
+ function add(a, b) {
26
+ return KakaoShare.add(a, b);
27
+ }
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","isTurboModuleEnabled","global","__turboModuleProxy","KakaoShareModule","NativeModules","KakaoShare","Proxy","get","Error","multiply","a","b","add"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GAChB,oFAAmF,GACpFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,kBAAkB,IAAI,IAAI;AAE9D,MAAMC,gBAAgB,GAAGH,oBAAoB,GACzCN,OAAO,CAAC,yBAAyB,CAAC,CAACK,OAAO,GAC1CK,0BAAa,CAACC,UAAU;AAE5B,MAAMA,UAAU,GAAGF,gBAAgB,GAC/BA,gBAAgB,GAChB,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACb,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEE,SAASc,QAAQA,CAACC,CAAS,EAAEC,CAAS,EAAmB;EAC9D,OAAON,UAAU,CAACI,QAAQ,CAACC,CAAC,EAAEC,CAAC,CAAC;AAClC;AAEO,SAASC,GAAGA,CAACF,CAAS,EAAEC,CAAS,EAAU;EAChD,OAAON,UAAU,CAACO,GAAG,CAACF,CAAC,EAAEC,CAAC,CAAC;AAC7B","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing('RNCKakaoShare');
9
+ //# sourceMappingURL=NativeKakaoShare.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../src","sources":["spec/NativeKakaoShare.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAQpCC,gCAAmB,CAACC,YAAY,CAAO,eAAe,CAAC","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+ const LINKING_ERROR = `The package '@react-native-kakao/share' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
3
+ ios: "- You have run 'pod install'\n",
4
+ default: ''
5
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
6
+
7
+ // @ts-expect-error
8
+ const isTurboModuleEnabled = global.__turboModuleProxy != null;
9
+ const KakaoShareModule = isTurboModuleEnabled ? require('./spec/NativeKakaoShare').default : NativeModules.KakaoShare;
10
+ const KakaoShare = KakaoShareModule ? KakaoShareModule : new Proxy({}, {
11
+ get() {
12
+ throw new Error(LINKING_ERROR);
13
+ }
14
+ });
15
+ export function multiply(a, b) {
16
+ return KakaoShare.multiply(a, b);
17
+ }
18
+ export function add(a, b) {
19
+ return KakaoShare.add(a, b);
20
+ }
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","isTurboModuleEnabled","global","__turboModuleProxy","KakaoShareModule","require","KakaoShare","Proxy","get","Error","multiply","a","b","add"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GAChB,oFAAmF,GACpFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;;AAEjC;AACA,MAAMC,oBAAoB,GAAGC,MAAM,CAACC,kBAAkB,IAAI,IAAI;AAE9D,MAAMC,gBAAgB,GAAGH,oBAAoB,GACzCI,OAAO,CAAC,yBAAyB,CAAC,CAACL,OAAO,GAC1CL,aAAa,CAACW,UAAU;AAE5B,MAAMA,UAAU,GAAGF,gBAAgB,GAC/BA,gBAAgB,GAChB,IAAIG,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACZ,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,OAAO,SAASa,QAAQA,CAACC,CAAS,EAAEC,CAAS,EAAmB;EAC9D,OAAON,UAAU,CAACI,QAAQ,CAACC,CAAC,EAAEC,CAAC,CAAC;AAClC;AAEA,OAAO,SAASC,GAAGA,CAACF,CAAS,EAAEC,CAAS,EAAU;EAChD,OAAON,UAAU,CAACO,GAAG,CAACF,CAAC,EAAEC,CAAC,CAAC;AAC7B","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import { TurboModuleRegistry } from 'react-native';
2
+ export default TurboModuleRegistry.getEnforcing('RNCKakaoShare');
3
+ //# sourceMappingURL=NativeKakaoShare.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../src","sources":["spec/NativeKakaoShare.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAQlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,eAAe,CAAC","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ export declare function multiply(a: number, b: number): Promise<number>;
2
+ export declare function add(a: number, b: number): number;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AA0BA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE9D;AAED,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAEhD"}
@@ -0,0 +1,9 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import type { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
3
+ export interface Spec extends TurboModule {
4
+ multiply(a: number, b: number): Promise<number>;
5
+ add(a: Int32, b: Int32): Int32;
6
+ }
7
+ declare const _default: Spec;
8
+ export default _default;
9
+ //# sourceMappingURL=NativeKakaoShare.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeKakaoShare.d.ts","sourceRoot":"","sources":["../../../../src/spec/NativeKakaoShare.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAEvE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;CAChC;;AAED,wBAAuE"}
package/package.json ADDED
@@ -0,0 +1,104 @@
1
+ {
2
+ "name": "@react-native-kakao/share",
3
+ "description": "React Native Kakao Share SDK",
4
+ "version": "0.2.0",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/src/index.d.ts",
8
+ "react-native": "src/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "src",
12
+ "lib",
13
+ "android",
14
+ "ios",
15
+ "cpp",
16
+ "*.podspec",
17
+ "!ios/build",
18
+ "!android/build",
19
+ "!android/gradle",
20
+ "!android/gradlew",
21
+ "!android/gradlew.bat",
22
+ "!android/local.properties",
23
+ "!**/__tests__",
24
+ "!**/__fixtures__",
25
+ "!**/__mocks__",
26
+ "!**/.*"
27
+ ],
28
+ "author": "MJ Studio <mym0404@gmail.com> (https://github.com/mym0404)",
29
+ "homepage": "https://github.com/mj-studio-library/react-native-kakao.git",
30
+ "scripts": {
31
+ "test": "jest",
32
+ "prepare": "husky",
33
+ "release": "./script/release.sh",
34
+ "codegen:android": "cd ../../example/android && ./gradlew generateCodegenArtifactsFromSchema",
35
+ "codegen:ios": "node ../../example/node_modules/react-native/scripts/generate-codegen-artifacts.js --path example/ --outputPath ../../example/ios",
36
+ "codegen": "yarn codegen:android && yarn codegen:ios",
37
+ "prepack": "bob build",
38
+ "clean": "del-cli android/ lib"
39
+ },
40
+ "keywords": [
41
+ "react-native",
42
+ "kakao",
43
+ "kakao-sdk",
44
+ "typescript",
45
+ "javascript",
46
+ "react",
47
+ "expo",
48
+ "kakao-share"
49
+ ],
50
+ "repository": {
51
+ "type": "git",
52
+ "url": "https://github.com/mj-studio-library/react-native-kakao.git",
53
+ "directory": "packages/share"
54
+ },
55
+ "license": "MIT",
56
+ "publishConfig": {
57
+ "registry": "https://registry.npmjs.org/",
58
+ "access": "public"
59
+ },
60
+ "devDependencies": {
61
+ "@types/jest": "^29.5.5",
62
+ "@types/react": "^18.2.44",
63
+ "del-cli": "^5.1.0",
64
+ "jest": "^29.7.0",
65
+ "react": "18.2.0",
66
+ "react-native": "0.73.7",
67
+ "react-native-builder-bob": "^0.20.0",
68
+ "typescript": "5.1.6"
69
+ },
70
+ "peerDependencies": {
71
+ "react": "*",
72
+ "react-native": "*"
73
+ },
74
+ "workspaces": [
75
+ "example",
76
+ "packages/*"
77
+ ],
78
+ "jest": {
79
+ "preset": "react-native",
80
+ "modulePathIgnorePatterns": [
81
+ "<rootDir>/lib/"
82
+ ]
83
+ },
84
+ "react-native-builder-bob": {
85
+ "source": "src",
86
+ "output": "lib",
87
+ "targets": [
88
+ "commonjs",
89
+ "module",
90
+ [
91
+ "typescript",
92
+ {
93
+ "project": "tsconfig.build.json"
94
+ }
95
+ ]
96
+ ]
97
+ },
98
+ "codegenConfig": {
99
+ "name": "RNCKakaoShareSpec",
100
+ "type": "all",
101
+ "jsSrcsDir": "src"
102
+ },
103
+ "gitHead": "83de7d0f888da6767c066fd3a5cfcc01a4e5827f"
104
+ }
package/src/index.tsx ADDED
@@ -0,0 +1,33 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+
3
+ const LINKING_ERROR =
4
+ `The package '@react-native-kakao/share' doesn't seem to be linked. Make sure: \n\n` +
5
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
6
+ '- You rebuilt the app after installing the package\n' +
7
+ '- You are not using Expo Go\n';
8
+
9
+ // @ts-expect-error
10
+ const isTurboModuleEnabled = global.__turboModuleProxy != null;
11
+
12
+ const KakaoShareModule = isTurboModuleEnabled
13
+ ? require('./spec/NativeKakaoShare').default
14
+ : NativeModules.KakaoShare;
15
+
16
+ const KakaoShare = KakaoShareModule
17
+ ? KakaoShareModule
18
+ : new Proxy(
19
+ {},
20
+ {
21
+ get() {
22
+ throw new Error(LINKING_ERROR);
23
+ },
24
+ }
25
+ );
26
+
27
+ export function multiply(a: number, b: number): Promise<number> {
28
+ return KakaoShare.multiply(a, b);
29
+ }
30
+
31
+ export function add(a: number, b: number): number {
32
+ return KakaoShare.add(a, b);
33
+ }
@@ -0,0 +1,10 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+ import type { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
4
+
5
+ export interface Spec extends TurboModule {
6
+ multiply(a: number, b: number): Promise<number>;
7
+ add(a: Int32, b: Int32): Int32;
8
+ }
9
+
10
+ export default TurboModuleRegistry.getEnforcing<Spec>('RNCKakaoShare');