react-native-attachment-kit 1.0.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/CHANGELOG.md +19 -0
- package/README.md +327 -0
- package/android/CMakeLists.txt +31 -0
- package/android/build.gradle +121 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/libs/rnattachmentkit-release.aar +0 -0
- package/android/src/newarch/java/com/rnattachmentkit/RNAttachmentKitModule.kt +1159 -0
- package/android/src/newarch/java/com/rnattachmentkit/RNAttachmentKitPackage.kt +37 -0
- package/android/src/oldarch/java/com/rnattachmentkit/NativeRNAttachmentKitSpec.kt +19 -0
- package/android/src/oldarch/java/com/rnattachmentkit/RNAttachmentKitModule.kt +1142 -0
- package/android/src/oldarch/java/com/rnattachmentkit/RNAttachmentKitPackage.kt +19 -0
- package/ios/README.md +213 -0
- package/ios/RNAttachmentKit.m +132 -0
- package/ios/RNAttachmentKit.swift +1787 -0
- package/ios/RNAttachmentKit.xcframework/Info.plist +44 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Assets.car +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Base.lproj/LaunchScreen.storyboardc/01J-lp-oVM-view-Ze5-6b-2t3.nib +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Base.lproj/LaunchScreen.storyboardc/Info.plist +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Base.lproj/LaunchScreen.storyboardc/UIViewController-01J-lp-oVM.nib +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Headers/RNAttachmentKit-Swift.h +581 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Info.plist +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios.abi.json +34376 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios.private.swiftinterface +517 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios.swiftinterface +517 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Modules/module.modulemap +3 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Pretendard-SemiBold.otf +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/RNAttachmentKit +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_crop_reflect~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_crop_reflect~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_crop_rotate~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_crop_rotate~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_delete~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_delete~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_forward~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_forward~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_reward~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_reward~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_crop~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_crop~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_drawing~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_drawing~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_effect~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_effect~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_emoji~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_emoji~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_eraser~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_eraser~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_mosaic~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_mosaic~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_text~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_text~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/_CodeSignature/CodeRequirements +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/_CodeSignature/CodeResources +498 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/_CodeSignature/CodeSignature +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Assets.car +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Base.lproj/LaunchScreen.storyboardc/01J-lp-oVM-view-Ze5-6b-2t3.nib +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Base.lproj/LaunchScreen.storyboardc/Info.plist +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Base.lproj/LaunchScreen.storyboardc/UIViewController-01J-lp-oVM.nib +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Headers/RNAttachmentKit-Swift.h +1158 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Info.plist +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.abi.json +34376 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +517 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +517 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +34376 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +517 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +517 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/module.modulemap +3 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Pretendard-SemiBold.otf +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/RNAttachmentKit +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_crop_reflect~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_crop_reflect~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_crop_rotate~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_crop_rotate~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_delete~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_delete~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_forward~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_forward~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_reward~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_reward~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_crop~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_crop~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_drawing~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_drawing~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_effect~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_effect~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_emoji~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_emoji~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_eraser~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_eraser~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_mosaic~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_mosaic~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_text~dark.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_text~light.webp +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/_CodeSignature/CodeRequirements +0 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/_CodeSignature/CodeResources +553 -0
- package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/_CodeSignature/CodeSignature +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/AppIcon.appiconset/Contents.json +13 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/Contents.json +6 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_back.imageset/Contents.json +24 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_back.imageset/ic_back_dark.png +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_back.imageset/ic_back_normal.png +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_drawing_delete.imageset/Contents.json +56 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_drawing_delete.imageset/delete_dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_drawing_delete.imageset/delete_normal.webp +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_drawing_forward.imageset/Contents.json +56 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_drawing_forward.imageset/forward_dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_drawing_forward.imageset/forward_normal.webp +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_drawing_reward.imageset/Contents.json +56 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_drawing_reward.imageset/reward_dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_drawing_reward.imageset/reward_normal.webp +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_editor_crop.imageset/Contents.json +52 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_editor_crop.imageset/crop_dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_editor_crop.imageset/crop_normal.webp +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_editor_drawing.imageset/Contents.json +52 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_editor_drawing.imageset/drawing_dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_editor_drawing.imageset/drawing_normal.webp +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_editor_effect.imageset/Contents.json +52 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_editor_effect.imageset/effect_dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_editor_effect.imageset/effect_normal.webp +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_editor_emoji.imageset/Contents.json +52 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_editor_emoji.imageset/emoji_dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_editor_emoji.imageset/emoji_normal.webp +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_editor_text.imageset/Contents.json +52 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_editor_text.imageset/text_dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/ic_editor_text.imageset/text_norml.webp +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/rotate_icon.imageset/Contents.json +32 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/rotate_icon.imageset/rotate_dark.png +0 -0
- package/ios/RNAttachmentKitAssets/Assets.xcassets/rotate_icon.imageset/rotate_normal.png +0 -0
- package/ios/RNAttachmentKitAssets/Fonts/Pretendard-SemiBold.otf +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_crop_reflect~dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_crop_reflect~light.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_crop_rotate~dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_crop_rotate~light.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_drawing_delete~dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_drawing_delete~light.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_drawing_forward~dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_drawing_forward~light.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_drawing_reward~dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_drawing_reward~light.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_crop~dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_crop~light.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_drawing~dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_drawing~light.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_effect~dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_effect~light.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_emoji~dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_emoji~light.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_eraser~dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_eraser~light.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_mosaic~dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_mosaic~light.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_text~dark.webp +0 -0
- package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_text~light.webp +0 -0
- package/package.json +68 -0
- package/react-native-attachment-kit.podspec +51 -0
- package/react-native.config.js +14 -0
- package/src/NativeAttachmentKit.ts +26 -0
- package/src/index.d.ts +56 -0
- package/src/index.ts +359 -0
- package/src/types.ts +317 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { TurboModule } from "react-native"
|
|
2
|
+
import { TurboModuleRegistry } from "react-native"
|
|
3
|
+
|
|
4
|
+
export interface Spec extends TurboModule {
|
|
5
|
+
init(licenseKey: string): Promise<boolean>;
|
|
6
|
+
openGallery(options: Object): Promise<Object[]>;
|
|
7
|
+
openEditor(options: Object): Promise<Object>;
|
|
8
|
+
openViewer(options: Object): Promise<void>;
|
|
9
|
+
closeGallery(): Promise<boolean>;
|
|
10
|
+
|
|
11
|
+
// RCTEventEmitter 필수 규격 (Turbo Module에서 이벤트 방출 시 필수)
|
|
12
|
+
addListener(eventName: string): void;
|
|
13
|
+
removeListeners(count: number): void;
|
|
14
|
+
|
|
15
|
+
updateSourceRect(options: Object): Promise<void>;
|
|
16
|
+
|
|
17
|
+
getDefaultAnimationConfig(): Promise<Object>;
|
|
18
|
+
|
|
19
|
+
// 미디어 갤러리 (사진 모아보기)
|
|
20
|
+
openMediaGallery(options: Object): Promise<Object>;
|
|
21
|
+
closeMediaGallery(galleryId: string): Promise<void>;
|
|
22
|
+
appendGalleryItems(payload: Object): Promise<void>;
|
|
23
|
+
removeGalleryItems(payload: Object): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default TurboModuleRegistry.getEnforcing<Spec>("RNAttachmentKit");
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export interface ImageResult {
|
|
2
|
+
uri: string
|
|
3
|
+
width: number
|
|
4
|
+
height: number
|
|
5
|
+
type: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface GalleryOptions {
|
|
9
|
+
maxSelection?: number
|
|
10
|
+
mediaType?: "photo" | "video" | "all"
|
|
11
|
+
quality?: number
|
|
12
|
+
allItemsText?: string
|
|
13
|
+
selectedItemsText?: string
|
|
14
|
+
doneButtonText?: string
|
|
15
|
+
recentsAlbumText?: string
|
|
16
|
+
languageCode?: string
|
|
17
|
+
autoCloseOnSelect?: boolean
|
|
18
|
+
/**
|
|
19
|
+
* 선택 방식.
|
|
20
|
+
* - 'single': 한 장 즉시 선택형 (기존 maxSelection 0/1 동작 — 탭하면 바로 반환, 편집 ON 이면 탭 → 편집 → 전송)
|
|
21
|
+
* - 'multi' : 체크(번호 배지) → (필요하면 편집) → 완료. maxSelection 이 1 이어도 멀티와 똑같이 동작하고,
|
|
22
|
+
* 1장일 때 다른 사진을 고르면 기존 선택과 교체됩니다. autoCloseOnSelect 는 무시되며 maxSelection 생략/1 미만이면 1장.
|
|
23
|
+
* 생략 시 기존 규칙으로 판단: autoCloseOnSelect 또는 maxSelection <= 1 → 단일, 그 외 멀티 (하위 호환)
|
|
24
|
+
*/
|
|
25
|
+
selectionMode?: "single" | "multi"
|
|
26
|
+
enableEditor?: boolean // 단일 이미지 선택 시 편집기 활성화 여부
|
|
27
|
+
themeColor?: string // 테마 컬러 지정 (ex: "#FFEB3B")
|
|
28
|
+
onSelectionChange?: (event: SelectionChangeEvent) => void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface SelectionChangeEvent {
|
|
32
|
+
selectedCount: number
|
|
33
|
+
maxSelection: number
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface RNAttachmentKit {
|
|
37
|
+
init(licenseKey: string): Promise<boolean>;
|
|
38
|
+
openGallery(options?: GalleryOptions): Promise<ImageResult[]>;
|
|
39
|
+
openEditor(options: EditorOptions): Promise<ImageResult>;
|
|
40
|
+
closeGallery(): Promise<boolean>
|
|
41
|
+
addSelectionChangeListener(listener: (event: SelectionChangeEvent) => void): () => void
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Returns true if using Turbo Module (New Architecture)
|
|
46
|
+
*/
|
|
47
|
+
export const isUsingTurboModule: boolean
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Returns true if using Legacy Native Module (Old Architecture)
|
|
51
|
+
*/
|
|
52
|
+
export const isUsingLegacyModule: boolean
|
|
53
|
+
|
|
54
|
+
declare const AttachmentKit: RNAttachmentKit
|
|
55
|
+
|
|
56
|
+
export default AttachmentKit
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import { NativeModules, Platform, TurboModuleRegistry, NativeEventEmitter } from "react-native"
|
|
2
|
+
import type { ImageResult, GalleryOptions, EditorOptions, SelectionChangeEvent, ViewerOptions, MediaGalleryOptions, MediaGalleryAppendPayload, MediaGalleryRemovePayload } from "./types"
|
|
3
|
+
|
|
4
|
+
const LINKING_ERROR = `The package 'react-native-attachment-kit' 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"
|
|
5
|
+
|
|
6
|
+
// Try to get Turbo Module first (New Architecture)
|
|
7
|
+
let NativeAttachmentKit: any = null
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
// @ts-ignore - TurboModuleRegistry might not be available
|
|
11
|
+
NativeAttachmentKit = TurboModuleRegistry?.get?.("RNAttachmentKit")
|
|
12
|
+
} catch (e) {
|
|
13
|
+
// Turbo Module not available
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let _defaultThemeColor = "#10b981";
|
|
17
|
+
let _defaultLanguageCode = "en";
|
|
18
|
+
|
|
19
|
+
/** 모듈이 번역을 내장한 언어 코드 (ISO 639-1, 59개) */
|
|
20
|
+
export const SUPPORTED_LANGUAGE_CODES: readonly string[] = ["af", "ar", "be", "bg", "bn", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "fa", "fi", "fr", "ga", "gl", "gu", "he", "hi", "hr", "ht", "hu", "id", "is", "it", "ja", "ka", "kn", "ko", "lt", "lv", "mk", "mr", "ms", "mt", "nl", "no", "pl", "pt", "ro", "ru", "sk", "sl", "sq", "sv", "sw", "ta", "te", "th", "tl", "tr", "uk", "ur", "vi", "zh"]
|
|
21
|
+
const LANGUAGE_ALIASES: Record<string, string> = { iw: "he", in: "id", nb: "no", nn: "no", fil: "tl" }
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* "pt-BR", "zh_Hant", "EN", "iw" 같은 값을 모듈 지원 언어 코드로 정규화합니다.
|
|
25
|
+
* 지원하지 않는 언어면 "en" 을 돌려줍니다.
|
|
26
|
+
*/
|
|
27
|
+
export function normalizeLanguageCode(code?: string | null): string {
|
|
28
|
+
if (!code) return "en"
|
|
29
|
+
const base = String(code).trim().toLowerCase().split(/[-_]/)[0]
|
|
30
|
+
const mapped = LANGUAGE_ALIASES[base] ?? base
|
|
31
|
+
return SUPPORTED_LANGUAGE_CODES.includes(mapped) ? mapped : "en"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface InitOptions {
|
|
35
|
+
languageCode?: string;
|
|
36
|
+
themeColor?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Fallback to Legacy Native Module (Old Architecture)
|
|
40
|
+
const LegacyModule = NativeModules.RNAttachmentKit
|
|
41
|
+
|
|
42
|
+
// Use Turbo Module if available, otherwise use Legacy Module
|
|
43
|
+
const RNAttachmentKitModule = NativeAttachmentKit || LegacyModule
|
|
44
|
+
|
|
45
|
+
if (!RNAttachmentKitModule) {
|
|
46
|
+
throw new Error(LINKING_ERROR)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Create event emitter
|
|
50
|
+
const eventEmitter = new NativeEventEmitter(RNAttachmentKitModule)
|
|
51
|
+
|
|
52
|
+
export type { SelectionChangeEvent } from "./types"
|
|
53
|
+
export type { MediaGalleryItem, MediaGalleryOptions, MediaGalleryGridSize, MediaGalleryGridSizeChangedEvent, MediaGalleryTheme, MediaGalleryViewerOptions, MediaGalleryDeleteOption, MediaGalleryItemDeletedEvent, MediaGalleryNeedPageEvent, MediaGalleryClosedEvent, MediaGalleryAppendPayload, MediaGalleryRemovePayload } from "./types"
|
|
54
|
+
|
|
55
|
+
export interface RNAttachmentKit {
|
|
56
|
+
init(licenseKey: string, options?: InitOptions): Promise<boolean>
|
|
57
|
+
openGallery(options?: GalleryOptions): Promise<ImageResult[]>
|
|
58
|
+
openEditor(options: EditorOptions): Promise<ImageResult>
|
|
59
|
+
openViewer(options: ViewerOptions): Promise<void>
|
|
60
|
+
updateSourceRect(rect: import("./types").SourceRect): Promise<void>
|
|
61
|
+
closeGallery(): Promise<boolean>
|
|
62
|
+
addSelectionChangeListener(listener: (event: SelectionChangeEvent) => void): () => void
|
|
63
|
+
getDefaultAnimationConfig(): Promise<{ galleryOpen: number, galleryClose: number, editorOpen: number, editorClose: number, viewerOpen: number, viewerClose: number }>
|
|
64
|
+
injectImageCache(urlString: string, localPath: string): Promise<boolean>
|
|
65
|
+
/** 네이티브 미디어 갤러리(사진 모아보기)를 지원하는 네이티브 빌드인지 (옛 빌드면 false → 앱 RN 화면으로 폴백) */
|
|
66
|
+
isMediaGallerySupported(): boolean
|
|
67
|
+
/** 네이티브 미디어 갤러리 열기. 화면이 뜨면 resolve (닫힘은 onClosed) */
|
|
68
|
+
openMediaGallery(options: MediaGalleryOptions): Promise<{ galleryId: string }>
|
|
69
|
+
closeMediaGallery(galleryId: string): Promise<void>
|
|
70
|
+
/** (B) JS 공급: onNeedPage 에 대한 응답 */
|
|
71
|
+
appendGalleryItems(payload: MediaGalleryAppendPayload): Promise<void>
|
|
72
|
+
/** 앱이 다른 경로로 지운 묶음을 갤러리·뷰어에서 제거 */
|
|
73
|
+
removeGalleryItems(payload: MediaGalleryRemovePayload): Promise<void>
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const AttachmentKit: RNAttachmentKit = {
|
|
77
|
+
init: async (licenseKey: string, options?: InitOptions): Promise<boolean> => {
|
|
78
|
+
if (options?.themeColor) {
|
|
79
|
+
_defaultThemeColor = options.themeColor;
|
|
80
|
+
}
|
|
81
|
+
if (options?.languageCode) {
|
|
82
|
+
_defaultLanguageCode = normalizeLanguageCode(options.languageCode);
|
|
83
|
+
}
|
|
84
|
+
if (!RNAttachmentKitModule) {
|
|
85
|
+
throw new Error(LINKING_ERROR)
|
|
86
|
+
}
|
|
87
|
+
return RNAttachmentKitModule.init(licenseKey)
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
openGallery: async (options: GalleryOptions = {}): Promise<ImageResult[]> => {
|
|
91
|
+
if (!RNAttachmentKitModule) {
|
|
92
|
+
throw new Error(LINKING_ERROR)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// 콜백 이벤트 임시 리스너 등록
|
|
96
|
+
let subscriptionSelChange: any = null
|
|
97
|
+
let subscriptionImgProcessed: any = null
|
|
98
|
+
|
|
99
|
+
if (options.onSelectionChange) {
|
|
100
|
+
subscriptionSelChange = eventEmitter.addListener("onSelectionChange", options.onSelectionChange)
|
|
101
|
+
}
|
|
102
|
+
if (options.onImageProcessed) {
|
|
103
|
+
subscriptionImgProcessed = eventEmitter.addListener("onImageProcessed", options.onImageProcessed)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
try {
|
|
107
|
+
// 이벤트 콜백은 네이티브로 전달하지 않음
|
|
108
|
+
const { onSelectionChange, onImageProcessed, ...restOptions } = options
|
|
109
|
+
const nativeOptions = {
|
|
110
|
+
themeColor: _defaultThemeColor,
|
|
111
|
+
languageCode: _defaultLanguageCode,
|
|
112
|
+
...restOptions,
|
|
113
|
+
}
|
|
114
|
+
nativeOptions.languageCode = normalizeLanguageCode(nativeOptions.languageCode)
|
|
115
|
+
const result = await RNAttachmentKitModule.openGallery(nativeOptions)
|
|
116
|
+
return result
|
|
117
|
+
} finally {
|
|
118
|
+
// 갤러리가 닫히면 onSelectionChange 리스너 제거
|
|
119
|
+
if (subscriptionSelChange) {
|
|
120
|
+
subscriptionSelChange.remove()
|
|
121
|
+
}
|
|
122
|
+
// asyncProcessing 모드가 아닐 때만 onImageProcessed 리스너 제거 (async 모드에선 백그라운드 처리를 위해 유지해야 함)
|
|
123
|
+
// 호출부에서 수동으로 제거하거나, 최종 완료 시 정리하는 구조가 필요할 수 있음
|
|
124
|
+
if (!options.asyncProcessing && subscriptionImgProcessed) {
|
|
125
|
+
subscriptionImgProcessed.remove()
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
openEditor: async (options: EditorOptions): Promise<ImageResult> => {
|
|
131
|
+
if (!RNAttachmentKitModule) {
|
|
132
|
+
throw new Error(LINKING_ERROR)
|
|
133
|
+
}
|
|
134
|
+
const mergedOptions = {
|
|
135
|
+
themeColor: _defaultThemeColor,
|
|
136
|
+
languageCode: _defaultLanguageCode,
|
|
137
|
+
...options,
|
|
138
|
+
}
|
|
139
|
+
mergedOptions.languageCode = normalizeLanguageCode(mergedOptions.languageCode)
|
|
140
|
+
return RNAttachmentKitModule.openEditor(mergedOptions)
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
openViewer: async (options: ViewerOptions): Promise<void> => {
|
|
144
|
+
if (!RNAttachmentKitModule) {
|
|
145
|
+
throw new Error(LINKING_ERROR)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
let subscriptionPageSelected: any = null
|
|
149
|
+
if (options.onPageSelected) {
|
|
150
|
+
subscriptionPageSelected = eventEmitter.addListener("onPageSelected", (event: any) => {
|
|
151
|
+
if (options.onPageSelected && event && typeof event.index === 'number') {
|
|
152
|
+
options.onPageSelected(event.index)
|
|
153
|
+
}
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
let subscriptionViewerOpened: any = null
|
|
158
|
+
// iOS 네이티브 쪽에는 "onViewerOpened" 이벤트가 구현되어 있지 않습니다(Android 전용 —
|
|
159
|
+
// 오버레이 뷰어의 열기 애니메이션 완료 시점을 알려주는 이벤트). iOS에서 무조건 구독을
|
|
160
|
+
// 시도하면 RCTEventEmitter가 "onViewerOpened is not a supported event type" 경고를 던지므로,
|
|
161
|
+
// Android에서만 등록합니다.
|
|
162
|
+
if (options.onViewerOpened && Platform.OS === "android") {
|
|
163
|
+
subscriptionViewerOpened = eventEmitter.addListener("onViewerOpened", () => {
|
|
164
|
+
try {
|
|
165
|
+
if (options.onViewerOpened) {
|
|
166
|
+
options.onViewerOpened()
|
|
167
|
+
}
|
|
168
|
+
} catch (e) {
|
|
169
|
+
console.error("[RNAttachmentKit] options.onViewerOpened() threw:", e)
|
|
170
|
+
}
|
|
171
|
+
if (subscriptionViewerOpened) {
|
|
172
|
+
subscriptionViewerOpened.remove()
|
|
173
|
+
}
|
|
174
|
+
})
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
let subscriptionViewerWillClose: any = null
|
|
178
|
+
let deviceSubscriptionViewerWillClose: any = null
|
|
179
|
+
|
|
180
|
+
let subscriptionImageDeleted: any = null
|
|
181
|
+
if (options.onImageDeleted) {
|
|
182
|
+
subscriptionImageDeleted = eventEmitter.addListener("onImageDeleted", (event: any) => {
|
|
183
|
+
if (options.onImageDeleted && event && typeof event.index === 'number') {
|
|
184
|
+
// patch405: deleteOptions 중 사용자가 고른 항목의 key (선택지를 안 넘겼으면 undefined)
|
|
185
|
+
options.onImageDeleted({
|
|
186
|
+
index: event.index,
|
|
187
|
+
url: event.url,
|
|
188
|
+
option: typeof event.option === 'string' && event.option.length > 0 ? event.option : undefined,
|
|
189
|
+
})
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (options.onViewerWillClose) {
|
|
195
|
+
const closeHandler = () => {
|
|
196
|
+
if (options.onViewerWillClose) {
|
|
197
|
+
options.onViewerWillClose()
|
|
198
|
+
}
|
|
199
|
+
if (subscriptionPageSelected) {
|
|
200
|
+
subscriptionPageSelected.remove()
|
|
201
|
+
}
|
|
202
|
+
if (subscriptionViewerOpened) {
|
|
203
|
+
subscriptionViewerOpened.remove()
|
|
204
|
+
}
|
|
205
|
+
if (subscriptionViewerWillClose) {
|
|
206
|
+
subscriptionViewerWillClose.remove()
|
|
207
|
+
}
|
|
208
|
+
if (deviceSubscriptionViewerWillClose) {
|
|
209
|
+
deviceSubscriptionViewerWillClose.remove()
|
|
210
|
+
}
|
|
211
|
+
if (subscriptionImageDeleted) {
|
|
212
|
+
subscriptionImageDeleted.remove()
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
subscriptionViewerWillClose = eventEmitter.addListener("onViewerWillClose", closeHandler);
|
|
217
|
+
|
|
218
|
+
if (Platform.OS === "android") {
|
|
219
|
+
const { DeviceEventEmitter } = require("react-native");
|
|
220
|
+
deviceSubscriptionViewerWillClose = DeviceEventEmitter.addListener("onViewerWillClose", closeHandler);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
try {
|
|
225
|
+
const { onPageSelected, onViewerWillClose, onViewerOpened, onImageDeleted, ...restOptions } = options
|
|
226
|
+
const mergedOptions = {
|
|
227
|
+
themeColor: _defaultThemeColor,
|
|
228
|
+
languageCode: _defaultLanguageCode,
|
|
229
|
+
...restOptions,
|
|
230
|
+
}
|
|
231
|
+
mergedOptions.languageCode = normalizeLanguageCode(mergedOptions.languageCode)
|
|
232
|
+
return await RNAttachmentKitModule.openViewer(mergedOptions)
|
|
233
|
+
} finally {
|
|
234
|
+
// Listeners are now removed inside the onViewerWillClose callback
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
updateSourceRect: async (rect: import("./types").SourceRect): Promise<void> => {
|
|
239
|
+
if (!RNAttachmentKitModule) {
|
|
240
|
+
throw new Error(LINKING_ERROR)
|
|
241
|
+
}
|
|
242
|
+
return RNAttachmentKitModule.updateSourceRect(rect)
|
|
243
|
+
},
|
|
244
|
+
|
|
245
|
+
closeGallery: async (): Promise<boolean> => {
|
|
246
|
+
if (!RNAttachmentKitModule) {
|
|
247
|
+
throw new Error(LINKING_ERROR)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return RNAttachmentKitModule.closeGallery()
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
addSelectionChangeListener: (listener: (event: SelectionChangeEvent) => void) => {
|
|
254
|
+
const subscription = eventEmitter.addListener("onSelectionChange", listener)
|
|
255
|
+
|
|
256
|
+
// Return cleanup function
|
|
257
|
+
return () => {
|
|
258
|
+
subscription.remove()
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
getDefaultAnimationConfig: async (): Promise<{ galleryOpen: number, galleryClose: number, editorOpen: number, editorClose: number, viewerOpen: number, viewerClose: number }> => {
|
|
263
|
+
if (!RNAttachmentKitModule) {
|
|
264
|
+
throw new Error(LINKING_ERROR)
|
|
265
|
+
}
|
|
266
|
+
return RNAttachmentKitModule.getDefaultAnimationConfig()
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
injectImageCache: async (urlString: string, localPath: string): Promise<boolean> => {
|
|
270
|
+
if (!RNAttachmentKitModule) {
|
|
271
|
+
throw new Error(LINKING_ERROR)
|
|
272
|
+
}
|
|
273
|
+
if (RNAttachmentKitModule.injectImageCache) {
|
|
274
|
+
return RNAttachmentKitModule.injectImageCache(urlString, localPath)
|
|
275
|
+
}
|
|
276
|
+
return false;
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
isMediaGallerySupported: (): boolean => {
|
|
280
|
+
return !!RNAttachmentKitModule && typeof RNAttachmentKitModule.openMediaGallery === "function"
|
|
281
|
+
},
|
|
282
|
+
|
|
283
|
+
openMediaGallery: async (options: MediaGalleryOptions): Promise<{ galleryId: string }> => {
|
|
284
|
+
if (!RNAttachmentKitModule) {
|
|
285
|
+
throw new Error(LINKING_ERROR)
|
|
286
|
+
}
|
|
287
|
+
if (typeof RNAttachmentKitModule.openMediaGallery !== "function") {
|
|
288
|
+
throw new Error("[RNAttachmentKit] openMediaGallery is not available in this native build")
|
|
289
|
+
}
|
|
290
|
+
const { onItemDeleted, onNeedPage, onClosed, onGridSizeChanged, ...rest } = options
|
|
291
|
+
// 이벤트를 열기 전에 구독해야 하므로 galleryId 는 JS 에서 정함
|
|
292
|
+
const galleryId = rest.galleryId || `mg_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`
|
|
293
|
+
const subs: { remove: () => void }[] = []
|
|
294
|
+
const removeAll = () => {
|
|
295
|
+
while (subs.length) {
|
|
296
|
+
try { subs.pop()?.remove() } catch (e) { /* noop */ }
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
if (onItemDeleted) {
|
|
300
|
+
subs.push(eventEmitter.addListener("onGalleryItemDeleted", (e: any) => {
|
|
301
|
+
if (e && e.galleryId === galleryId) onItemDeleted(e)
|
|
302
|
+
}))
|
|
303
|
+
}
|
|
304
|
+
if (onNeedPage) {
|
|
305
|
+
subs.push(eventEmitter.addListener("onGalleryNeedPage", (e: any) => {
|
|
306
|
+
if (e && e.galleryId === galleryId) onNeedPage({ galleryId, cursor: e.cursor ?? null })
|
|
307
|
+
}))
|
|
308
|
+
}
|
|
309
|
+
if (onGridSizeChanged) {
|
|
310
|
+
subs.push(eventEmitter.addListener("onGalleryGridSizeChanged", (e: any) => {
|
|
311
|
+
if (e && e.galleryId === galleryId) onGridSizeChanged({ galleryId, gridSize: e.gridSize })
|
|
312
|
+
}))
|
|
313
|
+
}
|
|
314
|
+
subs.push(eventEmitter.addListener("onGalleryClosed", (e: any) => {
|
|
315
|
+
if (!e || e.galleryId !== galleryId) return
|
|
316
|
+
removeAll()
|
|
317
|
+
try {
|
|
318
|
+
onClosed?.({ galleryId })
|
|
319
|
+
} catch (err) {
|
|
320
|
+
console.error("[RNAttachmentKit] options.onClosed() threw:", err)
|
|
321
|
+
}
|
|
322
|
+
}))
|
|
323
|
+
const nativeOptions: Record<string, any> = {
|
|
324
|
+
languageCode: _defaultLanguageCode,
|
|
325
|
+
...rest,
|
|
326
|
+
galleryId,
|
|
327
|
+
}
|
|
328
|
+
nativeOptions.languageCode = normalizeLanguageCode(nativeOptions.languageCode)
|
|
329
|
+
nativeOptions.viewer = { themeColor: _defaultThemeColor, ...(rest.viewer || {}) }
|
|
330
|
+
try {
|
|
331
|
+
const result = await RNAttachmentKitModule.openMediaGallery(nativeOptions)
|
|
332
|
+
return { galleryId: (result && result.galleryId) || galleryId }
|
|
333
|
+
} catch (e) {
|
|
334
|
+
removeAll()
|
|
335
|
+
throw e
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
|
|
339
|
+
closeMediaGallery: async (galleryId: string): Promise<void> => {
|
|
340
|
+
if (!RNAttachmentKitModule || typeof RNAttachmentKitModule.closeMediaGallery !== "function") return
|
|
341
|
+
return RNAttachmentKitModule.closeMediaGallery(galleryId)
|
|
342
|
+
},
|
|
343
|
+
|
|
344
|
+
appendGalleryItems: async (payload: MediaGalleryAppendPayload): Promise<void> => {
|
|
345
|
+
if (!RNAttachmentKitModule || typeof RNAttachmentKitModule.appendGalleryItems !== "function") return
|
|
346
|
+
return RNAttachmentKitModule.appendGalleryItems(payload)
|
|
347
|
+
},
|
|
348
|
+
|
|
349
|
+
removeGalleryItems: async (payload: MediaGalleryRemovePayload): Promise<void> => {
|
|
350
|
+
if (!RNAttachmentKitModule || typeof RNAttachmentKitModule.removeGalleryItems !== "function") return
|
|
351
|
+
return RNAttachmentKitModule.removeGalleryItems(payload)
|
|
352
|
+
},
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// Export info about which architecture is being used
|
|
356
|
+
export const isUsingTurboModule = !!NativeAttachmentKit
|
|
357
|
+
export const isUsingLegacyModule = !!LegacyModule && !NativeAttachmentKit
|
|
358
|
+
|
|
359
|
+
export default AttachmentKit
|