Skip to content

Commit

Permalink
chore: configure project
Browse files Browse the repository at this point in the history
  • Loading branch information
mym0404 committed Apr 19, 2024
1 parent 1e51b7c commit 2a80537
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 14 deletions.
2 changes: 1 addition & 1 deletion example/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';

import { StyleSheet, View, Text } from 'react-native';
import { multiply } from 'kakao-share';
import { multiply } from '@mj-studio/react-native-kakao-share';

export default function App() {
const [result, setResult] = React.useState<number | undefined>();
Expand Down
19 changes: 9 additions & 10 deletions ios/KakaoShare.mm
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@ @implementation KakaoShare

// Example method
// See // https://reactnative.dev/docs/native-modules-ios
RCT_EXPORT_METHOD(multiply:(double)a
b:(double)b
resolve:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject)
{
NSNumber *result = @(a * b);
RCT_EXPORT_METHOD(multiply
: (double)a b
: (double)b resolve
: (RCTPromiseResolveBlock)resolve reject
: (RCTPromiseRejectBlock)reject) {
NSNumber* result = @(a * b);

resolve(result);
resolve(result);
}

// Don't compile this code when we build for the old architecture.
#ifdef RCT_NEW_ARCH_ENABLED
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
(const facebook::react::ObjCTurboModule::InitParams &)params
{
return std::make_shared<facebook::react::NativeKakaoShareSpecJSI>(params);
(const facebook::react::ObjCTurboModule::InitParams&)params {
return std::make_shared<facebook::react::NativeKakaoShareSpecJSI>(params);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@mj-studio/react-native-kakao-share",
"version": "0.1.0",
"description": "리액트 네이티브 카카오 공유 SDK",
"description": "리액트 네이티브 카카오 공유하기 SDK",
"main": "lib/commonjs/index",
"module": "lib/module/index",
"types": "lib/typescript/src/index.d.ts",
Expand Down
10 changes: 10 additions & 0 deletions script/clang-format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

if which clang-format >/dev/null; then
find ios -type f \( -name "*.h" -o -name "*.cpp" -o -name "*.m" -o -name "*.mm" \) -print0 | while read -d $'\0' file; do
echo "⭐️clang-format $file"
clang-format -i "$file"
done
else
echo "warning: clang-format not installed, download from https://clang.llvm.org/docs/ClangFormat.html (or run brew install clang-format)"
fi
14 changes: 14 additions & 0 deletions script/clang-lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

if which clang-format >/dev/null; then
find ios -type f \( -name "*.h" -o -name "*.cpp" -o -name "*.m" -o -name "*.mm" \) -print0 | while read -d $'\0' file; do
echo "⭐️clang-lint $file"
clang-format --dry-run -Werror "$file"
if [[ $? = 1 ]]; then
echo "❌ clang lint failed on '$file'"
exit 1
fi
done
else
echo "warning: clang-format not installed, download from https://clang.llvm.org/docs/ClangFormat.html (or run brew install clang-format)"
fi
5 changes: 5 additions & 0 deletions script/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
git pull origin main
yarn t
yarn codegen
export $(grep -v '^#' .env | xargs) && release-it --ci
2 changes: 1 addition & 1 deletion src/NativeKakaoShare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export interface Spec extends TurboModule {
multiply(a: number, b: number): Promise<number>;
}

export default TurboModuleRegistry.getEnforcing<Spec>('KakaoShare');
export default TurboModuleRegistry.getEnforcing<Spec>('RNCKakaoShare');
2 changes: 1 addition & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NativeModules, Platform } from 'react-native';

const LINKING_ERROR =
`The package 'kakao-share' doesn't seem to be linked. Make sure: \n\n` +
`The package '@mj-studio/react-native-kakao-share' doesn't seem to be linked. Make sure: \n\n` +
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
'- You rebuilt the app after installing the package\n' +
'- You are not using Expo Go\n';
Expand Down

0 comments on commit 2a80537

Please sign in to comment.