react-native-attachment-kit 1.0.1 → 1.0.5

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.
Files changed (145) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/README.md +356 -213
  3. package/android/build.gradle +3 -0
  4. package/android/src/main/libs/rnattachmentkit-release.aar +0 -0
  5. package/android/src/newarch/java/com/rnattachmentkit/RNAttachmentKitModule.kt +308 -10
  6. package/android/src/oldarch/java/com/rnattachmentkit/RNAttachmentKitModule.kt +311 -9
  7. package/ios/RNAttachmentKit.m +44 -0
  8. package/ios/RNAttachmentKit.swift +307 -23
  9. package/ios/RNAttachmentKit.xcframework/Info.plist +5 -5
  10. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Assets.car +0 -0
  11. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Headers/RNAttachmentKit-Swift.h +30 -0
  12. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios.abi.json +20349 -13021
  13. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios.private.swiftinterface +118 -1
  14. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  15. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios.swiftinterface +118 -1
  16. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/RNAttachmentKit +0 -0
  17. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_crop_reflect~dark.webp +0 -0
  18. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_crop_reflect~light.webp +0 -0
  19. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_crop_rotate~dark.webp +0 -0
  20. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_crop_rotate~light.webp +0 -0
  21. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_delete~dark.webp +0 -0
  22. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_delete~light.webp +0 -0
  23. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_forward~dark.webp +0 -0
  24. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_forward~light.webp +0 -0
  25. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_reward~dark.webp +0 -0
  26. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_reward~light.webp +0 -0
  27. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_back~dark.webp +0 -0
  28. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_back~light.webp +0 -0
  29. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_blur~dark.webp +0 -0
  30. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_blur~light.webp +0 -0
  31. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_check_small~dark.webp +0 -0
  32. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_check_small~light.webp +0 -0
  33. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_check~dark.webp +0 -0
  34. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_check~light.webp +0 -0
  35. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_close~dark.webp +0 -0
  36. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_close~light.webp +0 -0
  37. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_crop~dark.webp +0 -0
  38. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_crop~light.webp +0 -0
  39. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_drawing~dark.webp +0 -0
  40. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_drawing~light.webp +0 -0
  41. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_effect~dark.webp +0 -0
  42. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_effect~light.webp +0 -0
  43. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_emoji~dark.webp +0 -0
  44. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_emoji~light.webp +0 -0
  45. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_eraser~dark.webp +0 -0
  46. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_eraser~light.webp +0 -0
  47. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_mosaic~dark.webp +0 -0
  48. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_mosaic~light.webp +0 -0
  49. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_text~dark.webp +0 -0
  50. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_editor_text~light.webp +0 -0
  51. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_text_add~dark.webp +0 -0
  52. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/ToolbarIcons/ic_text_add~light.webp +0 -0
  53. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/_CodeSignature/CodeDirectory +0 -0
  54. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/_CodeSignature/CodeResources +194 -62
  55. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/_CodeSignature/CodeSignature +0 -0
  56. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Assets.car +0 -0
  57. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Headers/RNAttachmentKit-Swift.h +60 -0
  58. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.abi.json +20349 -13021
  59. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +118 -1
  60. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  61. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +118 -1
  62. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +20349 -13021
  63. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +118 -1
  64. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  65. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +118 -1
  66. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/RNAttachmentKit +0 -0
  67. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_crop_reflect~dark.webp +0 -0
  68. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_crop_reflect~light.webp +0 -0
  69. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_crop_rotate~dark.webp +0 -0
  70. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_crop_rotate~light.webp +0 -0
  71. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_delete~dark.webp +0 -0
  72. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_delete~light.webp +0 -0
  73. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_forward~dark.webp +0 -0
  74. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_forward~light.webp +0 -0
  75. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_reward~dark.webp +0 -0
  76. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_drawing_reward~light.webp +0 -0
  77. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_back~dark.webp +0 -0
  78. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_back~light.webp +0 -0
  79. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_blur~dark.webp +0 -0
  80. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_blur~light.webp +0 -0
  81. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_check_small~dark.webp +0 -0
  82. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_check_small~light.webp +0 -0
  83. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_check~dark.webp +0 -0
  84. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_check~light.webp +0 -0
  85. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_close~dark.webp +0 -0
  86. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_close~light.webp +0 -0
  87. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_crop~dark.webp +0 -0
  88. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_crop~light.webp +0 -0
  89. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_drawing~dark.webp +0 -0
  90. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_drawing~light.webp +0 -0
  91. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_effect~dark.webp +0 -0
  92. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_effect~light.webp +0 -0
  93. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_emoji~dark.webp +0 -0
  94. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_emoji~light.webp +0 -0
  95. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_eraser~dark.webp +0 -0
  96. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_eraser~light.webp +0 -0
  97. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_mosaic~dark.webp +0 -0
  98. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_mosaic~light.webp +0 -0
  99. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_text~dark.webp +0 -0
  100. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_editor_text~light.webp +0 -0
  101. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_text_add~dark.webp +0 -0
  102. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/ToolbarIcons/ic_text_add~light.webp +0 -0
  103. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/_CodeSignature/CodeDirectory +0 -0
  104. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/_CodeSignature/CodeResources +204 -72
  105. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_crop_reflect~dark.webp +0 -0
  106. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_crop_reflect~light.webp +0 -0
  107. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_crop_rotate~dark.webp +0 -0
  108. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_crop_rotate~light.webp +0 -0
  109. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_drawing_delete~dark.webp +0 -0
  110. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_drawing_delete~light.webp +0 -0
  111. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_drawing_forward~dark.webp +0 -0
  112. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_drawing_forward~light.webp +0 -0
  113. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_drawing_reward~dark.webp +0 -0
  114. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_drawing_reward~light.webp +0 -0
  115. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_back~dark.webp +0 -0
  116. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_back~light.webp +0 -0
  117. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_blur~dark.webp +0 -0
  118. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_blur~light.webp +0 -0
  119. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_check_small~dark.webp +0 -0
  120. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_check_small~light.webp +0 -0
  121. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_check~dark.webp +0 -0
  122. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_check~light.webp +0 -0
  123. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_close~dark.webp +0 -0
  124. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_close~light.webp +0 -0
  125. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_crop~dark.webp +0 -0
  126. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_crop~light.webp +0 -0
  127. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_drawing~dark.webp +0 -0
  128. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_drawing~light.webp +0 -0
  129. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_effect~dark.webp +0 -0
  130. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_effect~light.webp +0 -0
  131. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_emoji~dark.webp +0 -0
  132. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_emoji~light.webp +0 -0
  133. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_eraser~dark.webp +0 -0
  134. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_eraser~light.webp +0 -0
  135. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_mosaic~dark.webp +0 -0
  136. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_mosaic~light.webp +0 -0
  137. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_text~dark.webp +0 -0
  138. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_editor_text~light.webp +0 -0
  139. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_text_add~dark.webp +0 -0
  140. package/ios/RNAttachmentKitAssets/ToolbarIcons/ic_text_add~light.webp +0 -0
  141. package/package.json +1 -1
  142. package/src/NativeAttachmentKit.ts +10 -0
  143. package/src/index.d.ts +5 -56
  144. package/src/index.ts +188 -35
  145. package/src/types.ts +207 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-attachment-kit",
3
- "version": "1.0.1",
3
+ "version": "1.0.5",
4
4
  "description": "Native attachment kit for React Native — gallery picker, editor, image viewer and media gallery (Turbo Module)",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -16,6 +16,16 @@ export interface Spec extends TurboModule {
16
16
 
17
17
  getDefaultAnimationConfig(): Promise<Object>;
18
18
 
19
+ // 지도 뷰어 (위치 메시지)
20
+ openMapViewer(options: Object): Promise<void>;
21
+ updateMapViewerSourceRect(rect: Object): Promise<void>;
22
+ // 위치 메시지 지도 썸네일 (이 기기에서 그려 캐시)
23
+ renderLocationThumbnail(options: Object): Promise<Object>;
24
+ clearLocationThumbnailCache(): Promise<void>;
25
+ // 좌표 → 주소 (기기 지오코더, 디스크 캐시)
26
+ reverseGeocode(options: Object): Promise<Object>;
27
+ clearReverseGeocodeCache(): Promise<void>;
28
+
19
29
  // 미디어 갤러리 (사진 모아보기)
20
30
  openMediaGallery(options: Object): Promise<Object>;
21
31
  closeMediaGallery(galleryId: string): Promise<void>;
package/src/index.d.ts CHANGED
@@ -1,56 +1,5 @@
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
1
+ // package.json 의 "types" 는 src/index.ts 를 가리키므로 이 파일은 소비자에게 쓰이지 않습니다.
2
+ // 예전엔 손으로 관리하던 복사본이 index.ts / types.ts 와 어긋나 있었기 때문에, 이제는 실제 export 를 그대로 재노출만 합니다.
3
+ export * from "./types"
4
+ export { default } from "./index"
5
+ export * from "./index"
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { NativeModules, Platform, TurboModuleRegistry, NativeEventEmitter } from "react-native"
1
+ import { NativeModules, Platform, TurboModuleRegistry, NativeEventEmitter, DeviceEventEmitter } from "react-native"
2
2
  import type { ImageResult, GalleryOptions, EditorOptions, SelectionChangeEvent, ViewerOptions, MediaGalleryOptions, MediaGalleryAppendPayload, MediaGalleryRemovePayload, Appearance } from "./types"
3
3
 
4
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"
@@ -15,6 +15,8 @@ try {
15
15
 
16
16
  let _defaultThemeColor = "#10b981";
17
17
  let _defaultLanguageCode = "en";
18
+ /** setDefaults/init 에 넘긴 언어 코드 그대로 (예: "zh-Hans", "pt-BR") — 주소(역지오코딩)는 UI 언어 목록으로 줄이지 않음 */
19
+ let _rawLanguageCode: string | null = null;
18
20
  let _defaultAppearance: Appearance = "system";
19
21
 
20
22
  /** "light" | "dark" 외의 값(생략·오타 포함)은 "system" */
@@ -64,7 +66,27 @@ if (!RNAttachmentKitModule) {
64
66
  // Create event emitter
65
67
  const eventEmitter = new NativeEventEmitter(RNAttachmentKitModule)
66
68
 
67
- export type { SelectionChangeEvent, Appearance } from "./types"
69
+ /** 같은 화면을 중복으로 열려고 할 때 reject 하는 Error (code: "E_ALREADY_OPEN") */
70
+ function alreadyOpenError(what: string): Error {
71
+ const err = new Error(`${what} is already open`)
72
+ ;(err as any).code = "E_ALREADY_OPEN"
73
+ return err
74
+ }
75
+
76
+ /**
77
+ * openGallery 가 아직 끝나지 않았는지. 네이티브는 갤러리 Promise 를 하나만 보관하므로(iOS currentGalleryVC,
78
+ * Android pickImagesPromise) 중복 호출하면 앞 호출의 Promise 가 영영 끝나지 않습니다 → JS 에서 먼저 막습니다.
79
+ */
80
+ let _galleryOpen = false
81
+ /** openEditor 도 Android 가 editImagePromise 하나만 보관하므로 같은 보호가 필요 */
82
+ let _editorOpen = false
83
+ /**
84
+ * asyncProcessing 모드의 onImageProcessed 구독. 이 모드에선 openGallery 가 끝난 뒤에도 이벤트가 오므로
85
+ * finally 에서 제거하지 않고, 다음 openGallery(asyncProcessing) 호출 때 이전 구독만 제거합니다 (최대 1개 유지).
86
+ */
87
+ let _asyncImgProcessedSub: { remove: () => void } | null = null
88
+
89
+ export type { SelectionChangeEvent, Appearance, AttachLocationResult, MapViewerOptions, ReverseGeocodeOptions, ReverseGeocodeResult, ReverseGeocodeErrorCode, AttachFileResult, AttachFileFailure, LocationThumbnailOptions, LocationThumbnailResult } from "./types"
68
90
  export type { MediaGalleryItem, MediaGalleryOptions, MediaGalleryGridSize, MediaGalleryGridSizeChangedEvent, MediaGalleryTheme, MediaGalleryViewerOptions, MediaGalleryDeleteOption, MediaGalleryItemDeletedEvent, MediaGalleryNeedPageEvent, MediaGalleryClosedEvent, MediaGalleryAppendPayload, MediaGalleryRemovePayload } from "./types"
69
91
 
70
92
  export interface RNAttachmentKit {
@@ -77,6 +99,21 @@ export interface RNAttachmentKit {
77
99
  openEditor(options: EditorOptions): Promise<ImageResult>
78
100
  openViewer(options: ViewerOptions): Promise<void>
79
101
  updateSourceRect(rect: import("./types").SourceRect): Promise<void>
102
+ /** 지도 뷰어. 닫히면 resolve */
103
+ openMapViewer(options: import("./types").MapViewerOptions): Promise<void>
104
+ /** 지도 뷰어가 열린 동안 말풍선 위치가 바뀌었을 때 (닫힐 때 돌아갈 자리) */
105
+ updateMapViewerSourceRect(rect: import("./types").SourceRect | null): Promise<void>
106
+ /** 위치 메시지 말풍선 지도 썸네일을 이 기기에서 그려 캐시 (같은 요청이면 캐시에서 바로) */
107
+ renderLocationThumbnail(options: import("./types").LocationThumbnailOptions): Promise<import("./types").LocationThumbnailResult>
108
+ /** renderLocationThumbnail 캐시 비우기 */
109
+ clearLocationThumbnailCache(): Promise<void>
110
+ /**
111
+ * 좌표 → 주소 (기기 지오코더, 무료). 언어는 languageCode 그대로 (생략하면 setDefaults 의 languageCode).
112
+ * 결과("결과 없음" 포함)는 디스크에 캐시. 오류는 ReverseGeocodeErrorCode 로 reject (캐시 안 함)
113
+ */
114
+ reverseGeocode(options: import("./types").ReverseGeocodeOptions): Promise<import("./types").ReverseGeocodeResult>
115
+ /** reverseGeocode 캐시 비우기 */
116
+ clearReverseGeocodeCache(): Promise<void>
80
117
  closeGallery(): Promise<boolean>
81
118
  addSelectionChangeListener(listener: (event: SelectionChangeEvent) => void): () => void
82
119
  getDefaultAnimationConfig(): Promise<{ galleryOpen: number, galleryClose: number, editorOpen: number, editorClose: number, viewerOpen: number, viewerClose: number }>
@@ -99,6 +136,7 @@ const AttachmentKit: RNAttachmentKit = {
99
136
  }
100
137
  if (options?.languageCode) {
101
138
  _defaultLanguageCode = normalizeLanguageCode(options.languageCode);
139
+ _rawLanguageCode = options.languageCode;
102
140
  }
103
141
  if (options?.appearance) {
104
142
  _defaultAppearance = normalizeAppearance(options.appearance);
@@ -111,7 +149,10 @@ const AttachmentKit: RNAttachmentKit = {
111
149
 
112
150
  setDefaults: (options: DefaultOptions): void => {
113
151
  if (options?.themeColor) _defaultThemeColor = options.themeColor
114
- if (options?.languageCode) _defaultLanguageCode = normalizeLanguageCode(options.languageCode)
152
+ if (options?.languageCode) {
153
+ _defaultLanguageCode = normalizeLanguageCode(options.languageCode)
154
+ _rawLanguageCode = options.languageCode
155
+ }
115
156
  if (options?.appearance) _defaultAppearance = normalizeAppearance(options.appearance)
116
157
  },
117
158
 
@@ -121,21 +162,46 @@ const AttachmentKit: RNAttachmentKit = {
121
162
  if (!RNAttachmentKitModule) {
122
163
  throw new Error(LINKING_ERROR)
123
164
  }
165
+ // 이미 열려 있으면 네이티브를 건드리지 않고 바로 reject (앞 호출의 Promise 를 지키기 위해)
166
+ if (_galleryOpen) {
167
+ throw alreadyOpenError("Gallery")
168
+ }
169
+ _galleryOpen = true
124
170
 
125
171
  // 콜백 이벤트 임시 리스너 등록
126
172
  let subscriptionSelChange: any = null
127
173
  let subscriptionImgProcessed: any = null
128
-
174
+
129
175
  if (options.onSelectionChange) {
130
176
  subscriptionSelChange = eventEmitter.addListener("onSelectionChange", options.onSelectionChange)
131
177
  }
132
178
  if (options.onImageProcessed) {
133
- subscriptionImgProcessed = eventEmitter.addListener("onImageProcessed", options.onImageProcessed)
179
+ if (options.asyncProcessing) {
180
+ // async 모드: 이전 호출이 남겨 둔 구독을 먼저 제거해서 리스너가 쌓이지 않게 함
181
+ if (_asyncImgProcessedSub) {
182
+ try { _asyncImgProcessedSub.remove() } catch (e) { /* noop */ }
183
+ _asyncImgProcessedSub = null
184
+ }
185
+ subscriptionImgProcessed = eventEmitter.addListener("onImageProcessed", options.onImageProcessed)
186
+ _asyncImgProcessedSub = subscriptionImgProcessed
187
+ } else {
188
+ subscriptionImgProcessed = eventEmitter.addListener("onImageProcessed", options.onImageProcessed)
189
+ }
190
+ }
191
+ let subscriptionLocation: any = null
192
+ if (options.onLocationSelected) {
193
+ subscriptionLocation = eventEmitter.addListener("onLocationSelected", options.onLocationSelected)
194
+ }
195
+ let subscriptionFiles: any = null
196
+ if (options.onFilesSelected) {
197
+ const onFiles = options.onFilesSelected
198
+ // failed: 복사에 실패한 파일 목록 [{ name, error }] (없으면 undefined)
199
+ subscriptionFiles = eventEmitter.addListener("onFilesSelected", (e: any) => onFiles(e?.files ?? [], e?.failed ?? undefined))
134
200
  }
135
201
 
136
202
  try {
137
203
  // 이벤트 콜백은 네이티브로 전달하지 않음
138
- const { onSelectionChange, onImageProcessed, ...restOptions } = options
204
+ const { onSelectionChange, onImageProcessed, onLocationSelected, onFilesSelected, ...restOptions } = options
139
205
  const nativeOptions = {
140
206
  themeColor: _defaultThemeColor,
141
207
  languageCode: _defaultLanguageCode,
@@ -147,10 +213,18 @@ const AttachmentKit: RNAttachmentKit = {
147
213
  const result = await RNAttachmentKitModule.openGallery(nativeOptions)
148
214
  return result
149
215
  } finally {
216
+ _galleryOpen = false
150
217
  // 갤러리가 닫히면 onSelectionChange 리스너 제거
151
218
  if (subscriptionSelChange) {
152
219
  subscriptionSelChange.remove()
153
220
  }
221
+ // 위치 이벤트는 openGallery 가 끝나기 전에 오므로 여기서 바로 제거
222
+ if (subscriptionLocation) {
223
+ subscriptionLocation.remove()
224
+ }
225
+ if (subscriptionFiles) {
226
+ subscriptionFiles.remove()
227
+ }
154
228
  // asyncProcessing 모드가 아닐 때만 onImageProcessed 리스너 제거 (async 모드에선 백그라운드 처리를 위해 유지해야 함)
155
229
  // 호출부에서 수동으로 제거하거나, 최종 완료 시 정리하는 구조가 필요할 수 있음
156
230
  if (!options.asyncProcessing && subscriptionImgProcessed) {
@@ -163,6 +237,11 @@ const AttachmentKit: RNAttachmentKit = {
163
237
  if (!RNAttachmentKitModule) {
164
238
  throw new Error(LINKING_ERROR)
165
239
  }
240
+ // Android 는 editImagePromise 를 하나만 보관해서 중복 호출 시 앞 Promise 가 끝나지 않음 → JS 에서 막음
241
+ if (_editorOpen) {
242
+ throw alreadyOpenError("Editor")
243
+ }
244
+ _editorOpen = true
166
245
  const mergedOptions = {
167
246
  themeColor: _defaultThemeColor,
168
247
  languageCode: _defaultLanguageCode,
@@ -171,7 +250,11 @@ const AttachmentKit: RNAttachmentKit = {
171
250
  }
172
251
  mergedOptions.languageCode = normalizeLanguageCode(mergedOptions.languageCode)
173
252
  mergedOptions.appearance = normalizeAppearance(mergedOptions.appearance)
174
- return RNAttachmentKitModule.openEditor(mergedOptions)
253
+ try {
254
+ return await RNAttachmentKitModule.openEditor(mergedOptions)
255
+ } finally {
256
+ _editorOpen = false
257
+ }
175
258
  },
176
259
 
177
260
  openViewer: async (options: ViewerOptions): Promise<void> => {
@@ -225,34 +308,34 @@ const AttachmentKit: RNAttachmentKit = {
225
308
  })
226
309
  }
227
310
 
228
- if (options.onViewerWillClose) {
229
- const closeHandler = () => {
230
- if (options.onViewerWillClose) {
231
- options.onViewerWillClose()
232
- }
233
- if (subscriptionPageSelected) {
234
- subscriptionPageSelected.remove()
235
- }
236
- if (subscriptionViewerOpened) {
237
- subscriptionViewerOpened.remove()
238
- }
239
- if (subscriptionViewerWillClose) {
240
- subscriptionViewerWillClose.remove()
241
- }
242
- if (deviceSubscriptionViewerWillClose) {
243
- deviceSubscriptionViewerWillClose.remove()
244
- }
245
- if (subscriptionImageDeleted) {
246
- subscriptionImageDeleted.remove()
247
- }
248
- };
311
+ // 네이티브 "onViewerWillClose"(iOS sendEvent / Android RCTDeviceEventEmitter) 는 앱이 콜백을 넘기지 않아도
312
+ // 항상 구독합니다 — 이 이벤트가 와야 onPageSelected / onImageDeleted 구독을 정리할 수 있기 때문입니다
313
+ // (예전엔 options.onViewerWillClose 가 없으면 구독을 안 해서 뷰어를 열 때마다 리스너가 누수됐음).
314
+ const closeHandler = () => {
315
+ if (options.onViewerWillClose) {
316
+ options.onViewerWillClose()
317
+ }
318
+ if (subscriptionPageSelected) {
319
+ subscriptionPageSelected.remove()
320
+ }
321
+ if (subscriptionViewerOpened) {
322
+ subscriptionViewerOpened.remove()
323
+ }
324
+ if (subscriptionViewerWillClose) {
325
+ subscriptionViewerWillClose.remove()
326
+ }
327
+ if (deviceSubscriptionViewerWillClose) {
328
+ deviceSubscriptionViewerWillClose.remove()
329
+ }
330
+ if (subscriptionImageDeleted) {
331
+ subscriptionImageDeleted.remove()
332
+ }
333
+ };
249
334
 
250
- subscriptionViewerWillClose = eventEmitter.addListener("onViewerWillClose", closeHandler);
335
+ subscriptionViewerWillClose = eventEmitter.addListener("onViewerWillClose", closeHandler);
251
336
 
252
- if (Platform.OS === "android") {
253
- const { DeviceEventEmitter } = require("react-native");
254
- deviceSubscriptionViewerWillClose = DeviceEventEmitter.addListener("onViewerWillClose", closeHandler);
255
- }
337
+ if (Platform.OS === "android") {
338
+ deviceSubscriptionViewerWillClose = DeviceEventEmitter.addListener("onViewerWillClose", closeHandler);
256
339
  }
257
340
 
258
341
  try {
@@ -266,9 +349,14 @@ const AttachmentKit: RNAttachmentKit = {
266
349
  mergedOptions.languageCode = normalizeLanguageCode(mergedOptions.languageCode)
267
350
  mergedOptions.appearance = normalizeAppearance(mergedOptions.appearance)
268
351
  return await RNAttachmentKitModule.openViewer(mergedOptions)
269
- } finally {
270
- // Listeners are now removed inside the onViewerWillClose callback
352
+ } catch (e) {
353
+ // 뷰어가 아예 안 떴으면(reject) onViewerWillClose 가 오지 않으므로 여기서 구독 정리 (앱 콜백은 호출 안 함)
354
+ for (const sub of [subscriptionPageSelected, subscriptionViewerOpened, subscriptionImageDeleted, subscriptionViewerWillClose, deviceSubscriptionViewerWillClose]) {
355
+ try { sub?.remove() } catch (err) { /* noop */ }
356
+ }
357
+ throw e
271
358
  }
359
+ // 정상적으로 열렸으면 리스너는 onViewerWillClose 콜백 안에서 제거됨
272
360
  },
273
361
 
274
362
  updateSourceRect: async (rect: import("./types").SourceRect): Promise<void> => {
@@ -278,6 +366,71 @@ const AttachmentKit: RNAttachmentKit = {
278
366
  return RNAttachmentKitModule.updateSourceRect(rect)
279
367
  },
280
368
 
369
+ openMapViewer: async (options: import("./types").MapViewerOptions): Promise<void> => {
370
+ if (!RNAttachmentKitModule) {
371
+ throw new Error(LINKING_ERROR)
372
+ }
373
+ const mergedOptions: Record<string, any> = {
374
+ themeColor: _defaultThemeColor,
375
+ languageCode: _defaultLanguageCode,
376
+ appearance: _defaultAppearance,
377
+ ...options,
378
+ }
379
+ // 주소를 안 넘기면 네이티브가 채움 — reverseGeocode 와 같은 캐시를 쓰도록 같은 언어(넘긴 그대로)
380
+ mergedOptions.addressLanguageCode = options.languageCode || _rawLanguageCode || _defaultLanguageCode
381
+ mergedOptions.languageCode = normalizeLanguageCode(mergedOptions.languageCode)
382
+ mergedOptions.appearance = normalizeAppearance(mergedOptions.appearance)
383
+ await RNAttachmentKitModule.openMapViewer(mergedOptions)
384
+ },
385
+
386
+ updateMapViewerSourceRect: async (rect: import("./types").SourceRect | null): Promise<void> => {
387
+ if (!RNAttachmentKitModule) {
388
+ throw new Error(LINKING_ERROR)
389
+ }
390
+ return RNAttachmentKitModule.updateMapViewerSourceRect(rect ?? {})
391
+ },
392
+
393
+ renderLocationThumbnail: async (options: import("./types").LocationThumbnailOptions): Promise<import("./types").LocationThumbnailResult> => {
394
+ if (!RNAttachmentKitModule) {
395
+ throw new Error(LINKING_ERROR)
396
+ }
397
+ const mergedOptions = {
398
+ themeColor: _defaultThemeColor,
399
+ appearance: _defaultAppearance,
400
+ ...options,
401
+ }
402
+ mergedOptions.appearance = normalizeAppearance(mergedOptions.appearance)
403
+ // 내 위치는 둘 다 있을 때만
404
+ if (typeof mergedOptions.myLatitude !== "number" || typeof mergedOptions.myLongitude !== "number") {
405
+ delete mergedOptions.myLatitude
406
+ delete mergedOptions.myLongitude
407
+ }
408
+ return RNAttachmentKitModule.renderLocationThumbnail(mergedOptions)
409
+ },
410
+
411
+ clearLocationThumbnailCache: async (): Promise<void> => {
412
+ if (!RNAttachmentKitModule) {
413
+ throw new Error(LINKING_ERROR)
414
+ }
415
+ return RNAttachmentKitModule.clearLocationThumbnailCache()
416
+ },
417
+
418
+ reverseGeocode: async (options: import("./types").ReverseGeocodeOptions): Promise<import("./types").ReverseGeocodeResult> => {
419
+ if (!RNAttachmentKitModule) {
420
+ throw new Error(LINKING_ERROR)
421
+ }
422
+ const languageCode = options.languageCode || _rawLanguageCode || _defaultLanguageCode
423
+ const r = await RNAttachmentKitModule.reverseGeocode({ latitude: options.latitude, longitude: options.longitude, languageCode })
424
+ return { address: r?.address ?? null, shortAddress: r?.shortAddress ?? null, cached: !!r?.cached }
425
+ },
426
+
427
+ clearReverseGeocodeCache: async (): Promise<void> => {
428
+ if (!RNAttachmentKitModule) {
429
+ throw new Error(LINKING_ERROR)
430
+ }
431
+ return RNAttachmentKitModule.clearReverseGeocodeCache()
432
+ },
433
+
281
434
  closeGallery: async (): Promise<boolean> => {
282
435
  if (!RNAttachmentKitModule) {
283
436
  throw new Error(LINKING_ERROR)