@onekeyfe/react-native-image-crop-picker 3.0.147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +83 -0
- package/ReactNativeImageCropPicker.podspec +40 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +144 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +24 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerException.kt +45 -0
- package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerImageProcessor.kt +308 -0
- package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerSession.kt +297 -0
- package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ReactNativeImageCropPicker.kt +69 -0
- package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ReactNativeImageCropPickerPackage.kt +24 -0
- package/ios/ImageCropPickerError.swift +57 -0
- package/ios/ImageCropPickerImageProcessor.swift +343 -0
- package/ios/ImageCropPickerSession.swift +407 -0
- package/ios/ReactNativeImageCropPicker.swift +65 -0
- package/ios/TOCropViewController/Categories/UIImage+CropRotate.h +39 -0
- package/ios/TOCropViewController/Categories/UIImage+CropRotate.m +94 -0
- package/ios/TOCropViewController/Constants/TOCropViewConstants.h +63 -0
- package/ios/TOCropViewController/LICENSE +21 -0
- package/ios/TOCropViewController/Models/TOActivityCroppedImageProvider.h +38 -0
- package/ios/TOCropViewController/Models/TOActivityCroppedImageProvider.m +73 -0
- package/ios/TOCropViewController/Models/TOCropViewControllerAspectRatioPreset.h +64 -0
- package/ios/TOCropViewController/Models/TOCropViewControllerAspectRatioPreset.m +121 -0
- package/ios/TOCropViewController/Models/TOCropViewControllerTransitioning.h +49 -0
- package/ios/TOCropViewController/Models/TOCropViewControllerTransitioning.m +125 -0
- package/ios/TOCropViewController/Models/TOCroppedImageAttributes.h +38 -0
- package/ios/TOCropViewController/Models/TOCroppedImageAttributes.m +45 -0
- package/ios/TOCropViewController/Resources/Base.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/PrivacyInfo.xcprivacy +14 -0
- package/ios/TOCropViewController/Resources/ar.lproj/TOCropViewControllerLocalizable.strings +9 -0
- package/ios/TOCropViewController/Resources/ca.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/cs.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/da-DK.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/de.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/en.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/es.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/fa-IR.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/fa.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/fi.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/fr.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/hu.lproj/TOCropViewControllerLocalizable.strings +9 -0
- package/ios/TOCropViewController/Resources/id.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/it.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/ja.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/ko.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/ms.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/nl.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/pl.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/pt-BR.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/pt.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/ro.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/ru.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/sk.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/tr.lproj/TOCropViewControllerLocalizable.strings +9 -0
- package/ios/TOCropViewController/Resources/uk.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/vi.lproj/TOCropViewControllerLocalizable.strings +9 -0
- package/ios/TOCropViewController/Resources/zh-Hans.lproj/TOCropViewControllerLocalizable.strings +9 -0
- package/ios/TOCropViewController/Resources/zh-Hant.lproj/TOCropViewControllerLocalizable.strings +9 -0
- package/ios/TOCropViewController/TOCropViewController.h +479 -0
- package/ios/TOCropViewController/TOCropViewController.m +1355 -0
- package/ios/TOCropViewController/Views/TOCropOverlayView.h +43 -0
- package/ios/TOCropViewController/Views/TOCropOverlayView.m +240 -0
- package/ios/TOCropViewController/Views/TOCropScrollView.h +39 -0
- package/ios/TOCropViewController/Views/TOCropScrollView.m +48 -0
- package/ios/TOCropViewController/Views/TOCropToolbar.h +104 -0
- package/ios/TOCropViewController/Views/TOCropToolbar.m +783 -0
- package/ios/TOCropViewController/Views/TOCropView.h +311 -0
- package/ios/TOCropViewController/Views/TOCropView.m +1787 -0
- package/lib/module/ReactNativeImageCropPicker.nitro.js +4 -0
- package/lib/module/ReactNativeImageCropPicker.nitro.js.map +1 -0
- package/lib/module/index.js +83 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/ReactNativeImageCropPicker.nitro.d.ts +54 -0
- package/lib/typescript/src/ReactNativeImageCropPicker.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +31 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/android/c++/JCropRect.hpp +69 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeImageCropPickerSpec.cpp +125 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeImageCropPickerSpec.hpp +66 -0
- package/nitrogen/generated/android/c++/JImageCropPickerOptions.hpp +154 -0
- package/nitrogen/generated/android/c++/JPickedImage.hpp +88 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/CropRect.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/HybridReactNativeImageCropPickerSpec.kt +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerOptions.kt +171 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/PickedImage.kt +86 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/reactnativeimagecroppickerOnLoad.kt +35 -0
- package/nitrogen/generated/android/reactnativeimagecroppicker+autolinking.cmake +81 -0
- package/nitrogen/generated/android/reactnativeimagecroppicker+autolinking.gradle +27 -0
- package/nitrogen/generated/android/reactnativeimagecroppickerOnLoad.cpp +54 -0
- package/nitrogen/generated/android/reactnativeimagecroppickerOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/ReactNativeImageCropPicker+autolinking.rb +62 -0
- package/nitrogen/generated/ios/ReactNativeImageCropPicker-Swift-Cxx-Bridge.cpp +57 -0
- package/nitrogen/generated/ios/ReactNativeImageCropPicker-Swift-Cxx-Bridge.hpp +221 -0
- package/nitrogen/generated/ios/ReactNativeImageCropPicker-Swift-Cxx-Umbrella.hpp +55 -0
- package/nitrogen/generated/ios/ReactNativeImageCropPickerAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ReactNativeImageCropPickerAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeImageCropPickerSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeImageCropPickerSpecSwift.hpp +116 -0
- package/nitrogen/generated/ios/swift/CropRect.swift +44 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_PickedImage.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeImageCropPickerSpec.swift +58 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeImageCropPickerSpec_cxx.swift +202 -0
- package/nitrogen/generated/ios/swift/ImageCropPickerOptions.swift +474 -0
- package/nitrogen/generated/ios/swift/PickedImage.swift +96 -0
- package/nitrogen/generated/shared/c++/CropRect.hpp +95 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeImageCropPickerSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeImageCropPickerSpec.hpp +71 -0
- package/nitrogen/generated/shared/c++/ImageCropPickerOptions.hpp +180 -0
- package/nitrogen/generated/shared/c++/PickedImage.hpp +114 -0
- package/package.json +173 -0
- package/src/ReactNativeImageCropPicker.nitro.ts +72 -0
- package/src/index.tsx +134 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReactNativeImageCropPickerSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `PickedImage` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::reactnativeimagecroppicker { struct PickedImage; }
|
|
18
|
+
// Forward declaration of `ImageCropPickerOptions` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::reactnativeimagecroppicker { struct ImageCropPickerOptions; }
|
|
20
|
+
|
|
21
|
+
#include "PickedImage.hpp"
|
|
22
|
+
#include <NitroModules/Promise.hpp>
|
|
23
|
+
#include "ImageCropPickerOptions.hpp"
|
|
24
|
+
#include <string>
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::reactnativeimagecroppicker {
|
|
27
|
+
|
|
28
|
+
using namespace margelo::nitro;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* An abstract base class for `ReactNativeImageCropPicker`
|
|
32
|
+
* Inherit this class to create instances of `HybridReactNativeImageCropPickerSpec` in C++.
|
|
33
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
34
|
+
* @example
|
|
35
|
+
* ```cpp
|
|
36
|
+
* class HybridReactNativeImageCropPicker: public HybridReactNativeImageCropPickerSpec {
|
|
37
|
+
* public:
|
|
38
|
+
* HybridReactNativeImageCropPicker(...): HybridObject(TAG) { ... }
|
|
39
|
+
* // ...
|
|
40
|
+
* };
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
class HybridReactNativeImageCropPickerSpec: public virtual HybridObject {
|
|
44
|
+
public:
|
|
45
|
+
// Constructor
|
|
46
|
+
explicit HybridReactNativeImageCropPickerSpec(): HybridObject(TAG) { }
|
|
47
|
+
|
|
48
|
+
// Destructor
|
|
49
|
+
~HybridReactNativeImageCropPickerSpec() override = default;
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
// Properties
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
// Methods
|
|
57
|
+
virtual std::shared_ptr<Promise<PickedImage>> openPicker(const ImageCropPickerOptions& options) = 0;
|
|
58
|
+
virtual std::shared_ptr<Promise<PickedImage>> openCropper(const std::string& path, const ImageCropPickerOptions& options) = 0;
|
|
59
|
+
virtual std::shared_ptr<Promise<void>> clean() = 0;
|
|
60
|
+
virtual std::shared_ptr<Promise<void>> cleanSingle(const std::string& path) = 0;
|
|
61
|
+
|
|
62
|
+
protected:
|
|
63
|
+
// Hybrid Setup
|
|
64
|
+
void loadHybridMethods() override;
|
|
65
|
+
|
|
66
|
+
protected:
|
|
67
|
+
// Tag for logging
|
|
68
|
+
static constexpr auto TAG = "ReactNativeImageCropPicker";
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
} // namespace margelo::nitro::reactnativeimagecroppicker
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ImageCropPickerOptions.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <optional>
|
|
34
|
+
#include <string>
|
|
35
|
+
|
|
36
|
+
namespace margelo::nitro::reactnativeimagecroppicker {
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A struct which can be represented as a JavaScript object (ImageCropPickerOptions).
|
|
40
|
+
*/
|
|
41
|
+
struct ImageCropPickerOptions final {
|
|
42
|
+
public:
|
|
43
|
+
std::optional<double> width SWIFT_PRIVATE;
|
|
44
|
+
std::optional<double> height SWIFT_PRIVATE;
|
|
45
|
+
std::optional<bool> cropping SWIFT_PRIVATE;
|
|
46
|
+
std::optional<bool> includeBase64 SWIFT_PRIVATE;
|
|
47
|
+
std::optional<double> compressImageQuality SWIFT_PRIVATE;
|
|
48
|
+
std::optional<double> compressImageMaxWidth SWIFT_PRIVATE;
|
|
49
|
+
std::optional<double> compressImageMaxHeight SWIFT_PRIVATE;
|
|
50
|
+
std::optional<bool> freeStyleCropEnabled SWIFT_PRIVATE;
|
|
51
|
+
std::optional<bool> cropperCircleOverlay SWIFT_PRIVATE;
|
|
52
|
+
std::optional<std::string> cropperToolbarTitle SWIFT_PRIVATE;
|
|
53
|
+
std::optional<std::string> cropperChooseText SWIFT_PRIVATE;
|
|
54
|
+
std::optional<std::string> cropperCancelText SWIFT_PRIVATE;
|
|
55
|
+
std::optional<std::string> cropperChooseColor SWIFT_PRIVATE;
|
|
56
|
+
std::optional<std::string> cropperCancelColor SWIFT_PRIVATE;
|
|
57
|
+
std::optional<bool> cropperRotateButtonsHidden SWIFT_PRIVATE;
|
|
58
|
+
std::optional<std::string> cropperActiveWidgetColor SWIFT_PRIVATE;
|
|
59
|
+
std::optional<std::string> cropperToolbarColor SWIFT_PRIVATE;
|
|
60
|
+
std::optional<std::string> cropperToolbarWidgetColor SWIFT_PRIVATE;
|
|
61
|
+
std::optional<bool> cropperStatusBarLight SWIFT_PRIVATE;
|
|
62
|
+
std::optional<bool> cropperNavigationBarLight SWIFT_PRIVATE;
|
|
63
|
+
std::optional<bool> showCropGuidelines SWIFT_PRIVATE;
|
|
64
|
+
std::optional<bool> showCropFrame SWIFT_PRIVATE;
|
|
65
|
+
std::optional<bool> enableRotationGesture SWIFT_PRIVATE;
|
|
66
|
+
std::optional<bool> hideBottomControls SWIFT_PRIVATE;
|
|
67
|
+
std::optional<bool> disableCropperColorSetters SWIFT_PRIVATE;
|
|
68
|
+
|
|
69
|
+
public:
|
|
70
|
+
ImageCropPickerOptions() = default;
|
|
71
|
+
explicit ImageCropPickerOptions(std::optional<double> width, std::optional<double> height, std::optional<bool> cropping, std::optional<bool> includeBase64, std::optional<double> compressImageQuality, std::optional<double> compressImageMaxWidth, std::optional<double> compressImageMaxHeight, std::optional<bool> freeStyleCropEnabled, std::optional<bool> cropperCircleOverlay, std::optional<std::string> cropperToolbarTitle, std::optional<std::string> cropperChooseText, std::optional<std::string> cropperCancelText, std::optional<std::string> cropperChooseColor, std::optional<std::string> cropperCancelColor, std::optional<bool> cropperRotateButtonsHidden, std::optional<std::string> cropperActiveWidgetColor, std::optional<std::string> cropperToolbarColor, std::optional<std::string> cropperToolbarWidgetColor, std::optional<bool> cropperStatusBarLight, std::optional<bool> cropperNavigationBarLight, std::optional<bool> showCropGuidelines, std::optional<bool> showCropFrame, std::optional<bool> enableRotationGesture, std::optional<bool> hideBottomControls, std::optional<bool> disableCropperColorSetters): width(width), height(height), cropping(cropping), includeBase64(includeBase64), compressImageQuality(compressImageQuality), compressImageMaxWidth(compressImageMaxWidth), compressImageMaxHeight(compressImageMaxHeight), freeStyleCropEnabled(freeStyleCropEnabled), cropperCircleOverlay(cropperCircleOverlay), cropperToolbarTitle(cropperToolbarTitle), cropperChooseText(cropperChooseText), cropperCancelText(cropperCancelText), cropperChooseColor(cropperChooseColor), cropperCancelColor(cropperCancelColor), cropperRotateButtonsHidden(cropperRotateButtonsHidden), cropperActiveWidgetColor(cropperActiveWidgetColor), cropperToolbarColor(cropperToolbarColor), cropperToolbarWidgetColor(cropperToolbarWidgetColor), cropperStatusBarLight(cropperStatusBarLight), cropperNavigationBarLight(cropperNavigationBarLight), showCropGuidelines(showCropGuidelines), showCropFrame(showCropFrame), enableRotationGesture(enableRotationGesture), hideBottomControls(hideBottomControls), disableCropperColorSetters(disableCropperColorSetters) {}
|
|
72
|
+
|
|
73
|
+
public:
|
|
74
|
+
friend bool operator==(const ImageCropPickerOptions& lhs, const ImageCropPickerOptions& rhs) = default;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
} // namespace margelo::nitro::reactnativeimagecroppicker
|
|
78
|
+
|
|
79
|
+
namespace margelo::nitro {
|
|
80
|
+
|
|
81
|
+
// C++ ImageCropPickerOptions <> JS ImageCropPickerOptions (object)
|
|
82
|
+
template <>
|
|
83
|
+
struct JSIConverter<margelo::nitro::reactnativeimagecroppicker::ImageCropPickerOptions> final {
|
|
84
|
+
static inline margelo::nitro::reactnativeimagecroppicker::ImageCropPickerOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
85
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
86
|
+
return margelo::nitro::reactnativeimagecroppicker::ImageCropPickerOptions(
|
|
87
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width"))),
|
|
88
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height"))),
|
|
89
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropping"))),
|
|
90
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "includeBase64"))),
|
|
91
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "compressImageQuality"))),
|
|
92
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "compressImageMaxWidth"))),
|
|
93
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "compressImageMaxHeight"))),
|
|
94
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "freeStyleCropEnabled"))),
|
|
95
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperCircleOverlay"))),
|
|
96
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarTitle"))),
|
|
97
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperChooseText"))),
|
|
98
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperCancelText"))),
|
|
99
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperChooseColor"))),
|
|
100
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperCancelColor"))),
|
|
101
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperRotateButtonsHidden"))),
|
|
102
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperActiveWidgetColor"))),
|
|
103
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarColor"))),
|
|
104
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarWidgetColor"))),
|
|
105
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperStatusBarLight"))),
|
|
106
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperNavigationBarLight"))),
|
|
107
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "showCropGuidelines"))),
|
|
108
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "showCropFrame"))),
|
|
109
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableRotationGesture"))),
|
|
110
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hideBottomControls"))),
|
|
111
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "disableCropperColorSetters")))
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativeimagecroppicker::ImageCropPickerOptions& arg) {
|
|
115
|
+
jsi::Object obj(runtime);
|
|
116
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "width"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.width));
|
|
117
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "height"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.height));
|
|
118
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropping"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.cropping));
|
|
119
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "includeBase64"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.includeBase64));
|
|
120
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "compressImageQuality"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.compressImageQuality));
|
|
121
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "compressImageMaxWidth"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.compressImageMaxWidth));
|
|
122
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "compressImageMaxHeight"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.compressImageMaxHeight));
|
|
123
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "freeStyleCropEnabled"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.freeStyleCropEnabled));
|
|
124
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperCircleOverlay"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.cropperCircleOverlay));
|
|
125
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarTitle"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cropperToolbarTitle));
|
|
126
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperChooseText"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cropperChooseText));
|
|
127
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperCancelText"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cropperCancelText));
|
|
128
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperChooseColor"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cropperChooseColor));
|
|
129
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperCancelColor"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cropperCancelColor));
|
|
130
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperRotateButtonsHidden"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.cropperRotateButtonsHidden));
|
|
131
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperActiveWidgetColor"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cropperActiveWidgetColor));
|
|
132
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarColor"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cropperToolbarColor));
|
|
133
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarWidgetColor"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cropperToolbarWidgetColor));
|
|
134
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperStatusBarLight"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.cropperStatusBarLight));
|
|
135
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperNavigationBarLight"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.cropperNavigationBarLight));
|
|
136
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "showCropGuidelines"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.showCropGuidelines));
|
|
137
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "showCropFrame"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.showCropFrame));
|
|
138
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "enableRotationGesture"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enableRotationGesture));
|
|
139
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "hideBottomControls"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.hideBottomControls));
|
|
140
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "disableCropperColorSetters"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.disableCropperColorSetters));
|
|
141
|
+
return obj;
|
|
142
|
+
}
|
|
143
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
144
|
+
if (!value.isObject()) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
jsi::Object obj = value.getObject(runtime);
|
|
148
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width")))) return false;
|
|
152
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height")))) return false;
|
|
153
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropping")))) return false;
|
|
154
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "includeBase64")))) return false;
|
|
155
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "compressImageQuality")))) return false;
|
|
156
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "compressImageMaxWidth")))) return false;
|
|
157
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "compressImageMaxHeight")))) return false;
|
|
158
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "freeStyleCropEnabled")))) return false;
|
|
159
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperCircleOverlay")))) return false;
|
|
160
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarTitle")))) return false;
|
|
161
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperChooseText")))) return false;
|
|
162
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperCancelText")))) return false;
|
|
163
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperChooseColor")))) return false;
|
|
164
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperCancelColor")))) return false;
|
|
165
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperRotateButtonsHidden")))) return false;
|
|
166
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperActiveWidgetColor")))) return false;
|
|
167
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarColor")))) return false;
|
|
168
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarWidgetColor")))) return false;
|
|
169
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperStatusBarLight")))) return false;
|
|
170
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperNavigationBarLight")))) return false;
|
|
171
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "showCropGuidelines")))) return false;
|
|
172
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "showCropFrame")))) return false;
|
|
173
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableRotationGesture")))) return false;
|
|
174
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hideBottomControls")))) return false;
|
|
175
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "disableCropperColorSetters")))) return false;
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PickedImage.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `CropRect` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::reactnativeimagecroppicker { struct CropRect; }
|
|
33
|
+
|
|
34
|
+
#include <string>
|
|
35
|
+
#include <optional>
|
|
36
|
+
#include "CropRect.hpp"
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro::reactnativeimagecroppicker {
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A struct which can be represented as a JavaScript object (PickedImage).
|
|
42
|
+
*/
|
|
43
|
+
struct PickedImage final {
|
|
44
|
+
public:
|
|
45
|
+
std::string path SWIFT_PRIVATE;
|
|
46
|
+
double size SWIFT_PRIVATE;
|
|
47
|
+
double width SWIFT_PRIVATE;
|
|
48
|
+
double height SWIFT_PRIVATE;
|
|
49
|
+
std::string mime SWIFT_PRIVATE;
|
|
50
|
+
std::optional<std::string> data SWIFT_PRIVATE;
|
|
51
|
+
std::optional<CropRect> cropRect SWIFT_PRIVATE;
|
|
52
|
+
std::optional<std::string> filename SWIFT_PRIVATE;
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
PickedImage() = default;
|
|
56
|
+
explicit PickedImage(std::string path, double size, double width, double height, std::string mime, std::optional<std::string> data, std::optional<CropRect> cropRect, std::optional<std::string> filename): path(path), size(size), width(width), height(height), mime(mime), data(data), cropRect(cropRect), filename(filename) {}
|
|
57
|
+
|
|
58
|
+
public:
|
|
59
|
+
friend bool operator==(const PickedImage& lhs, const PickedImage& rhs) = default;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
} // namespace margelo::nitro::reactnativeimagecroppicker
|
|
63
|
+
|
|
64
|
+
namespace margelo::nitro {
|
|
65
|
+
|
|
66
|
+
// C++ PickedImage <> JS PickedImage (object)
|
|
67
|
+
template <>
|
|
68
|
+
struct JSIConverter<margelo::nitro::reactnativeimagecroppicker::PickedImage> final {
|
|
69
|
+
static inline margelo::nitro::reactnativeimagecroppicker::PickedImage fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
70
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
71
|
+
return margelo::nitro::reactnativeimagecroppicker::PickedImage(
|
|
72
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "path"))),
|
|
73
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "size"))),
|
|
74
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width"))),
|
|
75
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height"))),
|
|
76
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mime"))),
|
|
77
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "data"))),
|
|
78
|
+
JSIConverter<std::optional<margelo::nitro::reactnativeimagecroppicker::CropRect>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropRect"))),
|
|
79
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "filename")))
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativeimagecroppicker::PickedImage& arg) {
|
|
83
|
+
jsi::Object obj(runtime);
|
|
84
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "path"), JSIConverter<std::string>::toJSI(runtime, arg.path));
|
|
85
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "size"), JSIConverter<double>::toJSI(runtime, arg.size));
|
|
86
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "width"), JSIConverter<double>::toJSI(runtime, arg.width));
|
|
87
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "height"), JSIConverter<double>::toJSI(runtime, arg.height));
|
|
88
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "mime"), JSIConverter<std::string>::toJSI(runtime, arg.mime));
|
|
89
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "data"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.data));
|
|
90
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropRect"), JSIConverter<std::optional<margelo::nitro::reactnativeimagecroppicker::CropRect>>::toJSI(runtime, arg.cropRect));
|
|
91
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "filename"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.filename));
|
|
92
|
+
return obj;
|
|
93
|
+
}
|
|
94
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
95
|
+
if (!value.isObject()) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
jsi::Object obj = value.getObject(runtime);
|
|
99
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "path")))) return false;
|
|
103
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "size")))) return false;
|
|
104
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width")))) return false;
|
|
105
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height")))) return false;
|
|
106
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mime")))) return false;
|
|
107
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "data")))) return false;
|
|
108
|
+
if (!JSIConverter<std::optional<margelo::nitro::reactnativeimagecroppicker::CropRect>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropRect")))) return false;
|
|
109
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "filename")))) return false;
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
} // namespace margelo::nitro
|
package/package.json
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@onekeyfe/react-native-image-crop-picker",
|
|
3
|
+
"version": "3.0.147",
|
|
4
|
+
"description": "Single photo picker and cropper Nitro module for OneKey, replacing react-native-image-crop-picker",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
6
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"source": "./src/index.tsx",
|
|
10
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"lib",
|
|
18
|
+
"android",
|
|
19
|
+
"ios",
|
|
20
|
+
"cpp",
|
|
21
|
+
"nitrogen",
|
|
22
|
+
"nitro.json",
|
|
23
|
+
"*.podspec",
|
|
24
|
+
"react-native.config.js",
|
|
25
|
+
"!ios/build",
|
|
26
|
+
"!android/build",
|
|
27
|
+
"!android/gradle",
|
|
28
|
+
"!android/gradlew",
|
|
29
|
+
"!android/gradlew.bat",
|
|
30
|
+
"!android/local.properties",
|
|
31
|
+
"!**/__tests__",
|
|
32
|
+
"!**/__fixtures__",
|
|
33
|
+
"!**/__mocks__",
|
|
34
|
+
"!**/.*"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
38
|
+
"prepare": "bob build",
|
|
39
|
+
"nitrogen": "nitrogen",
|
|
40
|
+
"typecheck": "tsc",
|
|
41
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
42
|
+
"test": "jest",
|
|
43
|
+
"release": "yarn prepare && npm whoami && npm publish --access public"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"react-native",
|
|
47
|
+
"ios",
|
|
48
|
+
"android",
|
|
49
|
+
"image",
|
|
50
|
+
"picker",
|
|
51
|
+
"crop",
|
|
52
|
+
"cropping"
|
|
53
|
+
],
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "git+https://github.com/OneKeyHQ/app-modules/react-native-image-crop-picker.git"
|
|
57
|
+
},
|
|
58
|
+
"author": "onekeyfe <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
|
|
59
|
+
"license": "MIT",
|
|
60
|
+
"bugs": {
|
|
61
|
+
"url": "https://github.com/OneKeyHQ/app-modules/react-native-image-crop-picker/issues"
|
|
62
|
+
},
|
|
63
|
+
"homepage": "https://github.com/OneKeyHQ/app-modules/react-native-image-crop-picker#readme",
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"registry": "https://registry.npmjs.org/"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
69
|
+
"@eslint/compat": "^1.3.2",
|
|
70
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
71
|
+
"@eslint/js": "^9.35.0",
|
|
72
|
+
"@react-native/babel-preset": "0.86.2",
|
|
73
|
+
"@react-native/eslint-config": "0.86.2",
|
|
74
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
75
|
+
"@types/jest": "^29.5.14",
|
|
76
|
+
"@types/react": "^19.2.0",
|
|
77
|
+
"commitlint": "^19.8.1",
|
|
78
|
+
"del-cli": "^6.0.0",
|
|
79
|
+
"eslint": "^9.35.0",
|
|
80
|
+
"eslint-config-prettier": "^10.1.8",
|
|
81
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
82
|
+
"jest": "^29.7.0",
|
|
83
|
+
"lefthook": "^2.0.3",
|
|
84
|
+
"nitrogen": "0.37.0",
|
|
85
|
+
"prettier": "^2.8.8",
|
|
86
|
+
"react": "19.2.3",
|
|
87
|
+
"react-native": "patch:react-native@npm%3A0.86.2#~/.yarn/patches/react-native-npm-0.86.2-c9d546616f.patch",
|
|
88
|
+
"react-native-builder-bob": "^0.40.13",
|
|
89
|
+
"react-native-nitro-modules": "0.37.0",
|
|
90
|
+
"release-it": "^19.0.4",
|
|
91
|
+
"turbo": "^2.5.6",
|
|
92
|
+
"typescript": "^5.9.2"
|
|
93
|
+
},
|
|
94
|
+
"peerDependencies": {
|
|
95
|
+
"react": "*",
|
|
96
|
+
"react-native": "*",
|
|
97
|
+
"react-native-nitro-modules": "0.37.0"
|
|
98
|
+
},
|
|
99
|
+
"react-native-builder-bob": {
|
|
100
|
+
"source": "src",
|
|
101
|
+
"output": "lib",
|
|
102
|
+
"targets": [
|
|
103
|
+
[
|
|
104
|
+
"custom",
|
|
105
|
+
{
|
|
106
|
+
"script": "nitrogen",
|
|
107
|
+
"clean": "nitrogen/"
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
[
|
|
111
|
+
"module",
|
|
112
|
+
{
|
|
113
|
+
"esm": true
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
[
|
|
117
|
+
"typescript",
|
|
118
|
+
{
|
|
119
|
+
"project": "tsconfig.build.json"
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
"prettier": {
|
|
125
|
+
"quoteProps": "consistent",
|
|
126
|
+
"singleQuote": true,
|
|
127
|
+
"tabWidth": 2,
|
|
128
|
+
"trailingComma": "es5",
|
|
129
|
+
"useTabs": false
|
|
130
|
+
},
|
|
131
|
+
"jest": {
|
|
132
|
+
"preset": "react-native",
|
|
133
|
+
"modulePathIgnorePatterns": [
|
|
134
|
+
"<rootDir>/example/node_modules",
|
|
135
|
+
"<rootDir>/lib/"
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
"commitlint": {
|
|
139
|
+
"extends": [
|
|
140
|
+
"@commitlint/config-conventional"
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
"release-it": {
|
|
144
|
+
"git": {
|
|
145
|
+
"commitMessage": "chore: release ${version}",
|
|
146
|
+
"tagName": "v${version}"
|
|
147
|
+
},
|
|
148
|
+
"npm": {
|
|
149
|
+
"publish": true
|
|
150
|
+
},
|
|
151
|
+
"github": {
|
|
152
|
+
"release": true
|
|
153
|
+
},
|
|
154
|
+
"plugins": {
|
|
155
|
+
"@release-it/conventional-changelog": {
|
|
156
|
+
"preset": {
|
|
157
|
+
"name": "angular"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
"create-react-native-library": {
|
|
163
|
+
"type": "nitro-module",
|
|
164
|
+
"languages": "kotlin-swift",
|
|
165
|
+
"tools": [
|
|
166
|
+
"eslint",
|
|
167
|
+
"jest",
|
|
168
|
+
"lefthook",
|
|
169
|
+
"release-it"
|
|
170
|
+
],
|
|
171
|
+
"version": "0.56.0"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
|
|
3
|
+
export interface CropRect {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface PickedImage {
|
|
11
|
+
// file:// URI of the processed image inside the module's temporary directory.
|
|
12
|
+
path: string;
|
|
13
|
+
size: number;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
mime: string;
|
|
17
|
+
// Base64 encoded image data (without a data: prefix) when `includeBase64` is set.
|
|
18
|
+
data?: string;
|
|
19
|
+
cropRect?: CropRect;
|
|
20
|
+
filename?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ImageCropPickerOptions {
|
|
24
|
+
// Target size of the cropped image. Also defines the crop aspect ratio.
|
|
25
|
+
width?: number;
|
|
26
|
+
height?: number;
|
|
27
|
+
cropping?: boolean;
|
|
28
|
+
includeBase64?: boolean;
|
|
29
|
+
compressImageQuality?: number;
|
|
30
|
+
compressImageMaxWidth?: number;
|
|
31
|
+
compressImageMaxHeight?: number;
|
|
32
|
+
freeStyleCropEnabled?: boolean;
|
|
33
|
+
cropperCircleOverlay?: boolean;
|
|
34
|
+
cropperToolbarTitle?: string;
|
|
35
|
+
cropperChooseText?: string;
|
|
36
|
+
cropperCancelText?: string;
|
|
37
|
+
// iOS only
|
|
38
|
+
cropperChooseColor?: string;
|
|
39
|
+
cropperCancelColor?: string;
|
|
40
|
+
cropperRotateButtonsHidden?: boolean;
|
|
41
|
+
// Android only
|
|
42
|
+
cropperActiveWidgetColor?: string;
|
|
43
|
+
cropperToolbarColor?: string;
|
|
44
|
+
cropperToolbarWidgetColor?: string;
|
|
45
|
+
cropperStatusBarLight?: boolean;
|
|
46
|
+
cropperNavigationBarLight?: boolean;
|
|
47
|
+
showCropGuidelines?: boolean;
|
|
48
|
+
showCropFrame?: boolean;
|
|
49
|
+
enableRotationGesture?: boolean;
|
|
50
|
+
hideBottomControls?: boolean;
|
|
51
|
+
disableCropperColorSetters?: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface ReactNativeImageCropPicker
|
|
55
|
+
extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
|
|
56
|
+
// Pick a single photo from the system photo picker, optionally cropping it.
|
|
57
|
+
// Neither platform asks for photo library permission.
|
|
58
|
+
openPicker(options: ImageCropPickerOptions): Promise<PickedImage>;
|
|
59
|
+
|
|
60
|
+
// Crop an existing image. `path` accepts file:// URIs, absolute paths,
|
|
61
|
+
// http(s):// URLs, data: URIs and, on Android, content:// URIs.
|
|
62
|
+
openCropper(
|
|
63
|
+
path: string,
|
|
64
|
+
options: ImageCropPickerOptions
|
|
65
|
+
): Promise<PickedImage>;
|
|
66
|
+
|
|
67
|
+
// Delete every file this module wrote to its temporary directory.
|
|
68
|
+
clean(): Promise<void>;
|
|
69
|
+
|
|
70
|
+
// Delete a single file returned by this module.
|
|
71
|
+
cleanSingle(path: string): Promise<void>;
|
|
72
|
+
}
|