react-native-customizable-image-crop-picker 1.0.1

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 (176) hide show
  1. package/LICENSE +44 -0
  2. package/README.md +479 -0
  3. package/RNCustomizableImageCropPicker.podspec +26 -0
  4. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  5. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  6. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  7. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  8. package/android/.gradle/8.9/gc.properties +0 -0
  9. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  10. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  11. package/android/.gradle/vcs-1/gc.properties +0 -0
  12. package/android/build/.transforms/a34a6297c7e9b65c987429ecd018e9a9/results.bin +1 -0
  13. package/android/build/.transforms/a34a6297c7e9b65c987429ecd018e9a9/transformed/classes/classes_dex/classes.dex +0 -0
  14. package/android/build/.transforms/d07257a7807cb64bf14f5adb0f98ee25/results.bin +1 -0
  15. package/android/build/.transforms/d07257a7807cb64bf14f5adb0f98ee25/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/rncustomizableimagecroppicker/BuildConfig.dex +0 -0
  16. package/android/build/.transforms/d07257a7807cb64bf14f5adb0f98ee25/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/rncustomizableimagecroppicker/NativeImageCropperActivity$Companion.dex +0 -0
  17. package/android/build/.transforms/d07257a7807cb64bf14f5adb0f98ee25/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/rncustomizableimagecroppicker/NativeImageCropperActivity.dex +0 -0
  18. package/android/build/.transforms/d07257a7807cb64bf14f5adb0f98ee25/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/rncustomizableimagecroppicker/NativeImageCropperModule$Companion.dex +0 -0
  19. package/android/build/.transforms/d07257a7807cb64bf14f5adb0f98ee25/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/rncustomizableimagecroppicker/NativeImageCropperModule.dex +0 -0
  20. package/android/build/.transforms/d07257a7807cb64bf14f5adb0f98ee25/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/rncustomizableimagecroppicker/NativeImageCropperPackage.dex +0 -0
  21. package/android/build/.transforms/d07257a7807cb64bf14f5adb0f98ee25/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/rncustomizableimagecroppicker/NativeImagePickerFileProvider.dex +0 -0
  22. package/android/build/.transforms/d07257a7807cb64bf14f5adb0f98ee25/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
  23. package/android/build/generated/source/buildConfig/debug/com/rncustomizableimagecroppicker/BuildConfig.java +10 -0
  24. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +26 -0
  25. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
  26. package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
  27. package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
  28. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  29. package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  30. package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +1 -0
  31. package/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/xml_nativeimagepicker_file_paths.xml.flat +0 -0
  32. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +2 -0
  33. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
  34. package/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +2 -0
  35. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  36. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  37. package/android/build/intermediates/java_res/debug/processDebugJavaRes/out/META-INF/react-native-customizable-image-crop-picker_debug.kotlin_module +0 -0
  38. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/rncustomizableimagecroppicker/BuildConfig.class +0 -0
  39. package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +3 -0
  40. package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +41 -0
  41. package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +26 -0
  42. package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
  43. package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
  44. package/android/build/intermediates/packaged_res/debug/packageDebugResources/xml/nativeimagepicker_file_paths.xml +6 -0
  45. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/META-INF/react-native-customizable-image-crop-picker_debug.kotlin_module +0 -0
  46. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/rncustomizableimagecroppicker/BuildConfig.class +0 -0
  47. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/rncustomizableimagecroppicker/NativeImageCropperActivity$Companion.class +0 -0
  48. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/rncustomizableimagecroppicker/NativeImageCropperActivity.class +0 -0
  49. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/rncustomizableimagecroppicker/NativeImageCropperModule$Companion.class +0 -0
  50. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/rncustomizableimagecroppicker/NativeImageCropperModule.class +0 -0
  51. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/rncustomizableimagecroppicker/NativeImageCropperPackage.class +0 -0
  52. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/rncustomizableimagecroppicker/NativeImagePickerFileProvider.class +0 -0
  53. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  54. package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +2 -0
  55. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  56. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  57. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  58. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
  59. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  60. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
  61. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  62. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  63. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  64. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  65. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  66. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  67. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  68. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  69. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  70. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  71. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  72. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  73. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  74. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  75. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  76. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
  77. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
  78. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
  79. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
  80. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values +0 -0
  81. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
  82. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.s +1 -0
  83. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
  84. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len +0 -0
  85. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  86. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  87. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  88. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  89. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  90. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  91. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  92. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  93. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  94. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  95. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  96. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values +0 -0
  97. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  98. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.s +1 -0
  99. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  100. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  101. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  102. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  103. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  104. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  105. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  106. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  107. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  108. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  109. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  110. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  111. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  112. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  113. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  114. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  115. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  116. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  117. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  118. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  119. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  120. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  121. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  122. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +2 -0
  123. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  124. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  125. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  126. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
  127. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  128. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
  129. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  130. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  131. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  132. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  133. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  134. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  135. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  136. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  137. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  138. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  139. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  140. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  141. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values +0 -0
  142. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  143. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.s +1 -0
  144. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  145. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
  146. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  147. package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
  148. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  149. package/android/build/outputs/logs/manifest-merger-debug-report.txt +46 -0
  150. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  151. package/android/build/tmp/kotlin-classes/debug/META-INF/react-native-customizable-image-crop-picker_debug.kotlin_module +0 -0
  152. package/android/build/tmp/kotlin-classes/debug/com/rncustomizableimagecroppicker/NativeImageCropperActivity$Companion.class +0 -0
  153. package/android/build/tmp/kotlin-classes/debug/com/rncustomizableimagecroppicker/NativeImageCropperActivity.class +0 -0
  154. package/android/build/tmp/kotlin-classes/debug/com/rncustomizableimagecroppicker/NativeImageCropperModule$Companion.class +0 -0
  155. package/android/build/tmp/kotlin-classes/debug/com/rncustomizableimagecroppicker/NativeImageCropperModule.class +0 -0
  156. package/android/build/tmp/kotlin-classes/debug/com/rncustomizableimagecroppicker/NativeImageCropperPackage.class +0 -0
  157. package/android/build/tmp/kotlin-classes/debug/com/rncustomizableimagecroppicker/NativeImagePickerFileProvider.class +0 -0
  158. package/android/build.gradle +49 -0
  159. package/android/consumer-rules.pro +3 -0
  160. package/android/src/main/AndroidManifest.xml +23 -0
  161. package/android/src/main/java/com/rncustomizableimagecroppicker/NativeImageCropperActivity.kt +1009 -0
  162. package/android/src/main/java/com/rncustomizableimagecroppicker/NativeImageCropperModule.kt +684 -0
  163. package/android/src/main/java/com/rncustomizableimagecroppicker/NativeImageCropperPackage.kt +17 -0
  164. package/android/src/main/java/com/rncustomizableimagecroppicker/NativeImagePickerFileProvider.kt +6 -0
  165. package/android/src/main/res/xml/nativeimagepicker_file_paths.xml +6 -0
  166. package/ios/NativeImageCropperModule.m +13 -0
  167. package/ios/NativeImageCropperModule.swift +1400 -0
  168. package/package.json +116 -0
  169. package/react-native.config.js +13 -0
  170. package/src/api.ts +41 -0
  171. package/src/errors.ts +39 -0
  172. package/src/index.ts +4 -0
  173. package/src/native/NativeImageCropperModule.ts +34 -0
  174. package/src/native/mapOptions.ts +164 -0
  175. package/src/types.ts +258 -0
  176. package/src/ui/ImageCropPickerModal.tsx +322 -0
@@ -0,0 +1,322 @@
1
+ import React, { useMemo } from 'react';
2
+ import {
3
+ Image,
4
+ Modal,
5
+ Pressable,
6
+ SafeAreaView,
7
+ StyleSheet,
8
+ Text,
9
+ View,
10
+ } from 'react-native';
11
+ import type {
12
+ CropperRenderOverrides,
13
+ CropperUIProps,
14
+ HeaderAlignment,
15
+ } from '../types';
16
+
17
+ type Props = CropperUIProps &
18
+ CropperRenderOverrides & {
19
+ visible: boolean;
20
+ imageUri?: string;
21
+ onCancel: () => void;
22
+ onConfirm: () => void;
23
+ };
24
+
25
+ function resolveAlignment(alignment?: HeaderAlignment): HeaderAlignment {
26
+ if (alignment === 'left' || alignment === 'right' || alignment === 'center') {
27
+ return alignment;
28
+ }
29
+ return 'center';
30
+ }
31
+
32
+ export function ImageCropPickerModal(props: Props) {
33
+ const {
34
+ visible,
35
+ imageUri,
36
+ onCancel,
37
+ onConfirm,
38
+ backgroundColor,
39
+ safeAreaEnabled = true,
40
+ } = props;
41
+
42
+ const title = props.headerTitle ?? 'Preview Image';
43
+ const headerAlignment = resolveAlignment(props.headerAlignment);
44
+
45
+ const ctx = useMemo(
46
+ () => ({
47
+ title,
48
+ headerAlignment,
49
+ onCancel,
50
+ onConfirm,
51
+ }),
52
+ [title, headerAlignment, onCancel, onConfirm],
53
+ );
54
+
55
+ const content = (
56
+ <View style={[styles.root, { backgroundColor: backgroundColor ?? '#000' }]}>
57
+ {props.showHeader !== false &&
58
+ (props.renderHeader ? (
59
+ props.renderHeader(ctx)
60
+ ) : (
61
+ <DefaultHeader {...props} {...ctx} />
62
+ ))}
63
+
64
+ <View style={[styles.previewOuter, props.overlayStyle?.previewContainerStyle]}>
65
+ <View style={[styles.previewInner, props.overlayStyle?.containerStyle]}>
66
+ {imageUri ? (
67
+ <Image
68
+ source={{ uri: imageUri }}
69
+ resizeMode="contain"
70
+ style={[styles.image, props.overlayStyle?.imageStyle]}
71
+ />
72
+ ) : (
73
+ <View style={styles.placeholder} />
74
+ )}
75
+
76
+ <View
77
+ pointerEvents="none"
78
+ style={[styles.cropOverlay, props.overlayStyle?.cropOverlayStyle]}
79
+ />
80
+ </View>
81
+ </View>
82
+
83
+ {props.showFooter !== false &&
84
+ (props.renderFooter ? (
85
+ props.renderFooter(ctx)
86
+ ) : (
87
+ <DefaultFooter {...props} {...ctx} />
88
+ ))}
89
+ </View>
90
+ );
91
+
92
+ return (
93
+ <Modal visible={visible} animationType="slide" presentationStyle="fullScreen">
94
+ {safeAreaEnabled ? (
95
+ <SafeAreaView style={styles.safe}>{content}</SafeAreaView>
96
+ ) : (
97
+ content
98
+ )}
99
+ </Modal>
100
+ );
101
+ }
102
+
103
+ function DefaultHeader(
104
+ props: CropperUIProps &
105
+ CropperRenderOverrides & {
106
+ title: string;
107
+ headerAlignment: HeaderAlignment;
108
+ onCancel: () => void;
109
+ onConfirm: () => void;
110
+ },
111
+ ) {
112
+ const {
113
+ title,
114
+ headerAlignment,
115
+ onCancel,
116
+ onConfirm,
117
+ leftIcon,
118
+ rightIcon,
119
+ showLeftIcon,
120
+ showRightIcon,
121
+ headerStyle,
122
+ } = props;
123
+
124
+ const titleAlignStyle =
125
+ headerAlignment === 'left'
126
+ ? styles.headerTitleLeft
127
+ : headerAlignment === 'right'
128
+ ? styles.headerTitleRight
129
+ : styles.headerTitleCenter;
130
+
131
+ const canShowLeft = showLeftIcon ?? headerAlignment === 'center';
132
+ const canShowRight = showRightIcon ?? headerAlignment === 'center';
133
+
134
+ return (
135
+ <View style={[styles.header, headerStyle?.containerStyle]}>
136
+ <View style={[styles.headerSide, headerStyle?.leftIconContainerStyle]}>
137
+ {canShowLeft ? (
138
+ <Pressable accessibilityRole="button" onPress={onCancel} hitSlop={12}>
139
+ {leftIcon ?? <Text style={styles.defaultIcon}>×</Text>}
140
+ </Pressable>
141
+ ) : null}
142
+ </View>
143
+
144
+ <Text
145
+ numberOfLines={1}
146
+ style={[styles.headerTitle, titleAlignStyle, headerStyle?.titleStyle]}
147
+ >
148
+ {title}
149
+ </Text>
150
+
151
+ <View style={[styles.headerSide, headerStyle?.rightIconContainerStyle]}>
152
+ {canShowRight ? (
153
+ <Pressable accessibilityRole="button" onPress={onConfirm} hitSlop={12}>
154
+ {rightIcon ?? <Text style={styles.defaultIcon}>✓</Text>}
155
+ </Pressable>
156
+ ) : null}
157
+ </View>
158
+ </View>
159
+ );
160
+ }
161
+
162
+ function DefaultFooter(
163
+ props: CropperUIProps &
164
+ CropperRenderOverrides & {
165
+ onCancel: () => void;
166
+ onConfirm: () => void;
167
+ },
168
+ ) {
169
+ const {
170
+ onCancel,
171
+ onConfirm,
172
+ cancelText = 'Cancel',
173
+ uploadText = 'Upload',
174
+ cancelIcon,
175
+ uploadIcon,
176
+ footerStyle,
177
+ renderCancelButton,
178
+ renderUploadButton,
179
+ } = props;
180
+
181
+ const ctx = {
182
+ title: props.headerTitle ?? 'Preview Image',
183
+ headerAlignment: resolveAlignment(props.headerAlignment),
184
+ onCancel,
185
+ onConfirm,
186
+ };
187
+
188
+ return (
189
+ <View style={[styles.footer, footerStyle?.containerStyle]}>
190
+ <View style={[styles.buttonRow, footerStyle?.buttonRowStyle]}>
191
+ {renderCancelButton ? (
192
+ renderCancelButton(ctx)
193
+ ) : (
194
+ <Pressable
195
+ accessibilityRole="button"
196
+ onPress={onCancel}
197
+ style={[styles.cancelButton, footerStyle?.cancelButtonStyle]}
198
+ >
199
+ <View style={[styles.buttonIconWrap, footerStyle?.cancelIconContainerStyle]}>
200
+ {cancelIcon}
201
+ </View>
202
+ <Text style={[styles.cancelText, footerStyle?.cancelTextStyle]}>
203
+ {cancelText}
204
+ </Text>
205
+ </Pressable>
206
+ )}
207
+
208
+ {renderUploadButton ? (
209
+ renderUploadButton(ctx)
210
+ ) : (
211
+ <Pressable
212
+ accessibilityRole="button"
213
+ onPress={onConfirm}
214
+ style={[styles.uploadButton, footerStyle?.uploadButtonStyle]}
215
+ >
216
+ <View style={[styles.buttonIconWrap, footerStyle?.uploadIconContainerStyle]}>
217
+ {uploadIcon}
218
+ </View>
219
+ <Text style={[styles.uploadText, footerStyle?.uploadTextStyle]}>
220
+ {uploadText}
221
+ </Text>
222
+ </Pressable>
223
+ )}
224
+ </View>
225
+ </View>
226
+ );
227
+ }
228
+
229
+ const styles = StyleSheet.create({
230
+ safe: { flex: 1 },
231
+ root: { flex: 1 },
232
+
233
+ header: {
234
+ minHeight: 56,
235
+ paddingHorizontal: 16,
236
+ paddingVertical: 12,
237
+ flexDirection: 'row',
238
+ alignItems: 'center',
239
+ backgroundColor: '#fff',
240
+ },
241
+ headerSide: {
242
+ width: 44,
243
+ alignItems: 'center',
244
+ justifyContent: 'center',
245
+ },
246
+ headerTitle: {
247
+ flex: 1,
248
+ fontSize: 18,
249
+ fontWeight: '700',
250
+ color: '#111',
251
+ },
252
+ headerTitleLeft: { textAlign: 'left' },
253
+ headerTitleCenter: { textAlign: 'center' },
254
+ headerTitleRight: { textAlign: 'right' },
255
+ defaultIcon: { fontSize: 22, color: '#111' },
256
+
257
+ previewOuter: {
258
+ flex: 1,
259
+ justifyContent: 'center',
260
+ paddingHorizontal: 16,
261
+ },
262
+ previewInner: {
263
+ flex: 1,
264
+ justifyContent: 'center',
265
+ },
266
+ image: {
267
+ flex: 1,
268
+ width: '100%',
269
+ },
270
+ placeholder: {
271
+ flex: 1,
272
+ borderRadius: 12,
273
+ backgroundColor: 'rgba(255,255,255,0.1)',
274
+ },
275
+ cropOverlay: {
276
+ position: 'absolute',
277
+ left: 24,
278
+ right: 24,
279
+ top: 24,
280
+ bottom: 24,
281
+ borderWidth: 1,
282
+ borderColor: 'rgba(255,255,255,0.8)',
283
+ borderRadius: 12,
284
+ },
285
+
286
+ footer: {
287
+ paddingHorizontal: 16,
288
+ paddingTop: 12,
289
+ paddingBottom: 16,
290
+ backgroundColor: '#fff',
291
+ },
292
+ buttonRow: {
293
+ flexDirection: 'row',
294
+ gap: 12,
295
+ },
296
+ cancelButton: {
297
+ flex: 1,
298
+ height: 48,
299
+ borderRadius: 24,
300
+ borderWidth: 1,
301
+ borderColor: '#D9D9D9',
302
+ backgroundColor: '#fff',
303
+ alignItems: 'center',
304
+ justifyContent: 'center',
305
+ flexDirection: 'row',
306
+ gap: 8,
307
+ },
308
+ uploadButton: {
309
+ flex: 1,
310
+ height: 48,
311
+ borderRadius: 24,
312
+ backgroundColor: '#2E7D32',
313
+ alignItems: 'center',
314
+ justifyContent: 'center',
315
+ flexDirection: 'row',
316
+ gap: 8,
317
+ },
318
+ cancelText: { fontSize: 16, fontWeight: '600', color: '#111' },
319
+ uploadText: { fontSize: 16, fontWeight: '700', color: '#fff' },
320
+ buttonIconWrap: { alignItems: 'center', justifyContent: 'center' },
321
+ });
322
+