@phucprime/react-native-image-editor 1.0.1 → 1.0.3
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/android/build.gradle +18 -1
- package/android/libs/README.md +7 -0
- package/android/libs/photo-editor-android-original.jar +0 -0
- package/android/libs/photo-editor-android.jar +0 -0
- package/android/src/main/java/com/ahmedadeltito/photoeditor/widget/SlidingUpPanelLayout.java +1 -6
- package/android/src/main/java/ui/photoeditor/RNPhotoEditorModule.java +1 -2
- package/android/src/main/java/ui/photoeditor/RNPhotoEditorPackage.java +0 -6
- package/android/src/main/res/layout/photo_editor_sdk_image_item_list.xml +16 -0
- package/android/src/main/res/layout/photo_editor_sdk_text_item_list.xml +13 -0
- package/android/src/newarch/java/ui/photoeditor/RNPhotoEditorSpec.java +14 -0
- package/android/src/oldarch/java/ui/photoeditor/RNPhotoEditorSpec.java +19 -0
- package/ios/RNPhotoEditor.mm +25 -0
- package/lib/NativeRNPhotoEditor.d.ts +14 -0
- package/lib/NativeRNPhotoEditor.d.ts.map +1 -0
- package/lib/NativeRNPhotoEditor.js +5 -0
- package/lib/NativeRNPhotoEditor.js.map +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -8
- package/lib/index.js.map +1 -1
- package/package.json +15 -7
- package/react-native-image-editor.podspec +8 -5
- package/src/NativeRNPhotoEditor.ts +19 -0
- package/src/index.ts +6 -11
- package/ios/RNPhotoEditor.m +0 -13
package/android/build.gradle
CHANGED
|
@@ -4,6 +4,10 @@ def safeExtGet(prop, fallback) {
|
|
|
4
4
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
def isNewArchitectureEnabled() {
|
|
8
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
9
|
+
}
|
|
10
|
+
|
|
7
11
|
buildscript {
|
|
8
12
|
// The Android Gradle plugin is only required when opening the android folder stand-alone.
|
|
9
13
|
// This avoids unnecessary downloads and potential conflicts when the library is included as a
|
|
@@ -21,6 +25,10 @@ buildscript {
|
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
27
|
|
|
28
|
+
if (isNewArchitectureEnabled()) {
|
|
29
|
+
apply plugin: 'com.facebook.react'
|
|
30
|
+
}
|
|
31
|
+
|
|
24
32
|
android {
|
|
25
33
|
namespace "ui.photoeditor"
|
|
26
34
|
compileSdkVersion safeExtGet('compileSdkVersion', 35)
|
|
@@ -41,6 +49,16 @@ android {
|
|
|
41
49
|
sourceCompatibility JavaVersion.VERSION_17
|
|
42
50
|
targetCompatibility JavaVersion.VERSION_17
|
|
43
51
|
}
|
|
52
|
+
|
|
53
|
+
sourceSets {
|
|
54
|
+
main {
|
|
55
|
+
if (isNewArchitectureEnabled()) {
|
|
56
|
+
java.srcDirs += ['src/newarch']
|
|
57
|
+
} else {
|
|
58
|
+
java.srcDirs += ['src/oldarch']
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
44
62
|
}
|
|
45
63
|
|
|
46
64
|
repositories {
|
|
@@ -53,7 +71,6 @@ dependencies {
|
|
|
53
71
|
implementation 'com.facebook.react:react-native:+'
|
|
54
72
|
implementation files('libs/photo-editor-android.jar')
|
|
55
73
|
implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1@aar'
|
|
56
|
-
implementation 'com.nineoldandroids:library:2.4.0'
|
|
57
74
|
implementation 'com.google.android.material:material:1.9.0'
|
|
58
75
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
|
59
76
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
The real problem was that photo-editor-android.jar is a plain JAR (not an AAR). When distributed as a JAR, the Android build system has no way to generate an R.java for its package com.ahmedadeltito.photoeditorsdk — that only happens for AAR/library modules. The JAR's compiled bytecode hardcodes references to com.ahmedadeltito.photoeditorsdk.R$layout, which never gets created in the final APK.
|
|
2
|
+
|
|
3
|
+
The previous attempt (adding a R.java stub) was the right idea but Android's build system ignores hand-written R.java files — it generates and owns the R classes itself and overwrites them.
|
|
4
|
+
|
|
5
|
+
The working fix: Used a Python script to directly rewrite the constant pool in PhotoEditorSDK.class inside the JAR — replacing every com/ahmedadeltito/photoeditorsdk/R reference with ui/photoeditor/R (your library's actual namespace). Now at runtime, the SDK correctly resolves ui.photoeditor.R$layout.photo_editor_sdk_image_item_list and ui.photoeditor.R$id.photo_editor_sdk_image_iv, which exist in your compiled resources.
|
|
6
|
+
|
|
7
|
+
The two layout XMLs created in the previous step (photo_editor_sdk_image_item_list.xml and photo_editor_sdk_text_item_list.xml) are still needed — they provide the actual layouts the SDK inflates.
|
|
Binary file
|
|
Binary file
|
package/android/src/main/java/com/ahmedadeltito/photoeditor/widget/SlidingUpPanelLayout.java
CHANGED
|
@@ -25,7 +25,6 @@ import android.widget.ListView;
|
|
|
25
25
|
import android.widget.ScrollView;
|
|
26
26
|
|
|
27
27
|
import ui.photoeditor.R;
|
|
28
|
-
import com.nineoldandroids.view.animation.AnimatorProxy;
|
|
29
28
|
|
|
30
29
|
public class SlidingUpPanelLayout extends ViewGroup {
|
|
31
30
|
|
|
@@ -1150,11 +1149,7 @@ public class SlidingUpPanelLayout extends ViewGroup {
|
|
|
1150
1149
|
private void applyParallaxForCurrentSlideOffset() {
|
|
1151
1150
|
if (mParallaxOffset > 0) {
|
|
1152
1151
|
int mainViewOffset = getCurrentParallaxOffset();
|
|
1153
|
-
|
|
1154
|
-
mMainView.setTranslationY(mainViewOffset);
|
|
1155
|
-
} else {
|
|
1156
|
-
AnimatorProxy.wrap(mMainView).setTranslationY(mainViewOffset);
|
|
1157
|
-
}
|
|
1152
|
+
mMainView.setTranslationY(mainViewOffset);
|
|
1158
1153
|
}
|
|
1159
1154
|
}
|
|
1160
1155
|
|
|
@@ -9,13 +9,12 @@ import com.facebook.react.bridge.ActivityEventListener;
|
|
|
9
9
|
import com.facebook.react.bridge.BaseActivityEventListener;
|
|
10
10
|
import com.facebook.react.bridge.Callback;
|
|
11
11
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
12
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
13
12
|
import com.facebook.react.bridge.ReactMethod;
|
|
14
13
|
import com.facebook.react.bridge.ReadableArray;
|
|
15
14
|
import com.facebook.react.bridge.ReadableMap;
|
|
16
15
|
import java.util.ArrayList;
|
|
17
16
|
|
|
18
|
-
public class RNPhotoEditorModule extends
|
|
17
|
+
public class RNPhotoEditorModule extends RNPhotoEditorSpec {
|
|
19
18
|
|
|
20
19
|
private static final int PHOTO_EDITOR_REQUEST = 1;
|
|
21
20
|
private static final String E_PHOTO_EDITOR_CANCELLED = "E_PHOTO_EDITOR_CANCELLED";
|
|
@@ -9,7 +9,6 @@ import com.facebook.react.ReactPackage;
|
|
|
9
9
|
import com.facebook.react.bridge.NativeModule;
|
|
10
10
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
11
11
|
import com.facebook.react.uimanager.ViewManager;
|
|
12
|
-
import com.facebook.react.bridge.JavaScriptModule;
|
|
13
12
|
|
|
14
13
|
public class RNPhotoEditorPackage implements ReactPackage {
|
|
15
14
|
@Override
|
|
@@ -17,11 +16,6 @@ public class RNPhotoEditorPackage implements ReactPackage {
|
|
|
17
16
|
return Arrays.<NativeModule>asList(new RNPhotoEditorModule(reactContext));
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
// Deprecated from RN 0.47
|
|
21
|
-
public List<Class<? extends JavaScriptModule>> createJSModules() {
|
|
22
|
-
return Collections.emptyList();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
19
|
@Override
|
|
26
20
|
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
27
21
|
return Collections.emptyList();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
+
android:id="@+id/photo_editor_sdk_image_rl"
|
|
3
|
+
android:layout_width="match_parent"
|
|
4
|
+
android:layout_height="wrap_content">
|
|
5
|
+
|
|
6
|
+
<ImageView
|
|
7
|
+
android:id="@+id/photo_editor_sdk_image_iv"
|
|
8
|
+
android:layout_width="wrap_content"
|
|
9
|
+
android:layout_height="80dp"
|
|
10
|
+
android:layout_centerHorizontal="true"
|
|
11
|
+
android:layout_margin="12dp"
|
|
12
|
+
android:adjustViewBounds="true"
|
|
13
|
+
android:gravity="center"
|
|
14
|
+
android:scaleType="fitCenter" />
|
|
15
|
+
|
|
16
|
+
</RelativeLayout>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
+
android:id="@+id/photo_editor_sdk_text_rl"
|
|
3
|
+
android:layout_width="wrap_content"
|
|
4
|
+
android:layout_height="wrap_content">
|
|
5
|
+
|
|
6
|
+
<TextView
|
|
7
|
+
android:id="@+id/photo_editor_sdk_text_tv"
|
|
8
|
+
android:layout_width="wrap_content"
|
|
9
|
+
android:layout_height="wrap_content"
|
|
10
|
+
android:padding="10dp"
|
|
11
|
+
android:textSize="18sp" />
|
|
12
|
+
|
|
13
|
+
</RelativeLayout>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
package ui.photoeditor;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* New Architecture spec wrapper.
|
|
7
|
+
* On New Architecture, this extends the codegen-generated NativeRNPhotoEditorSpec
|
|
8
|
+
* which provides TurboModule integration with compile-time type validation.
|
|
9
|
+
*/
|
|
10
|
+
abstract class RNPhotoEditorSpec extends NativeRNPhotoEditorSpec {
|
|
11
|
+
RNPhotoEditorSpec(ReactApplicationContext context) {
|
|
12
|
+
super(context);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
package ui.photoeditor;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Callback;
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
5
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
6
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Old Architecture compatibility spec.
|
|
10
|
+
* On Old Architecture (bridge mode), this extends ReactContextBaseJavaModule directly.
|
|
11
|
+
* The concrete module (RNPhotoEditorModule) extends this class.
|
|
12
|
+
*/
|
|
13
|
+
abstract class RNPhotoEditorSpec extends ReactContextBaseJavaModule {
|
|
14
|
+
RNPhotoEditorSpec(ReactApplicationContext context) {
|
|
15
|
+
super(context);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public abstract void Edit(ReadableMap props, Callback onDone, Callback onCancel);
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
|
|
3
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
4
|
+
#import <RNPhotoEditorSpec/RNPhotoEditorSpec.h>
|
|
5
|
+
#endif
|
|
6
|
+
|
|
7
|
+
@interface RCT_EXTERN_MODULE(RNPhotoEditor, NSObject)
|
|
8
|
+
|
|
9
|
+
RCT_EXTERN_METHOD(Edit:(NSDictionary *)props
|
|
10
|
+
onDone:(RCTResponseSenderBlock)onDone
|
|
11
|
+
onCancel:(RCTResponseSenderBlock)onCancel)
|
|
12
|
+
|
|
13
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
14
|
+
return YES;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@end
|
|
18
|
+
|
|
19
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
20
|
+
// Conform to the codegen-generated protocol for TurboModule support.
|
|
21
|
+
// The actual implementation is in RNPhotoEditor.swift; this declaration
|
|
22
|
+
// tells the compiler the Swift class satisfies the protocol.
|
|
23
|
+
@interface RNPhotoEditor () <NativeRNPhotoEditorSpec>
|
|
24
|
+
@end
|
|
25
|
+
#endif
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
/**
|
|
3
|
+
* TurboModule codegen spec for RNPhotoEditor.
|
|
4
|
+
*
|
|
5
|
+
* This spec enables proper New Architecture (Fabric + TurboModules) support
|
|
6
|
+
* with compile-time type validation. On Old Architecture, TurboModuleRegistry
|
|
7
|
+
* falls back to the NativeModules bridge automatically.
|
|
8
|
+
*/
|
|
9
|
+
export interface Spec extends TurboModule {
|
|
10
|
+
Edit(props: Object, onDone: (result: string) => void, onCancel: (result: number) => void): void;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: Spec;
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=NativeRNPhotoEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeRNPhotoEditor.d.ts","sourceRoot":"","sources":["../src/NativeRNPhotoEditor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD;;;;;;GAMG;AACH,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,IAAI,CACF,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,EAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GACjC,IAAI,CAAC;CACT;;AAED,wBAAuE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeRNPhotoEditor.js","sourceRoot":"","sources":["../src/NativeRNPhotoEditor.ts"],"names":[],"mappings":";;AACA,+CAAmD;AAiBnD,kBAAe,kCAAmB,CAAC,YAAY,CAAO,eAAe,CAAC,CAAC"}
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kCAAkC;IAClC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kCAAkC;IAClC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kDAAkD;IAClD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kDAAkD;IAClD,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,6CAA6C;IAC7C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wDAAwD;AACxD,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,OAAO,GACP,MAAM,GACN,MAAM,GACN,OAAO,GACP,SAAS,GACT,MAAM,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpB;;;OAGG;IACH,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;IAEjC;;OAEG;IACH,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAEhC;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAErC;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAsCD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,cAAM,WAAW;IACf;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAgC5C;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CACT,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC,GAChE,OAAO,CAAC,MAAM,CAAC;IAYlB;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;CAG7C;AAED;;GAEG;AACH,QAAA,MAAM,WAAW,oBAAc,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AACpC,eAAe,WAAW,CAAC;AAG3B,mDAAmD;AACnD,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AACjD,qDAAqD;AACrD,MAAM,MAAM,QAAQ,GAAG,mBAAmB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -10,16 +10,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
13
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
17
|
exports.PhotoEditor = exports.ImageEditor = void 0;
|
|
15
|
-
const
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
throw new Error('@phucprime/react-native-image-editor: NativeModule RNPhotoEditor is null. ' +
|
|
21
|
-
'Make sure the native module is properly linked.');
|
|
22
|
-
}
|
|
18
|
+
const NativeRNPhotoEditor_1 = __importDefault(require("./NativeRNPhotoEditor"));
|
|
19
|
+
// TurboModuleRegistry.getEnforcing handles both architectures:
|
|
20
|
+
// - New Architecture: Uses TurboModule system directly
|
|
21
|
+
// - Old Architecture: Falls back to NativeModules bridge (RN 0.73+)
|
|
22
|
+
const RNPhotoEditor = NativeRNPhotoEditor_1.default;
|
|
23
23
|
/** Default color palette for the editor. */
|
|
24
24
|
const DEFAULT_COLORS = [
|
|
25
25
|
'#000000',
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gFAAwD;AAExD,+DAA+D;AAC/D,uDAAuD;AACvD,oEAAoE;AACpE,MAAM,aAAa,GAAG,6BAAmB,CAAC;AA4F1C,4CAA4C;AAC5C,MAAM,cAAc,GAAa;IAC/B,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;CACV,CAAC;AAEF,oCAAoC;AACpC,MAAM,iBAAiB,GAAkC;IACvD,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,WAAW;IAC1B,WAAW,EAAE,QAAQ;IACrB,YAAY,EAAE,SAAS;IACvB,iBAAiB,EAAE,cAAc;IACjC,iBAAiB,EAAE,gBAAgB;IACnC,mBAAmB,EAAE,4BAA4B;IACjD,yBAAyB,EACvB,0DAA0D;IAC5D,WAAW,EAAE,UAAU;IACvB,MAAM,EAAE,SAAS;IACjB,oBAAoB,EAAE,qDAAqD;IAC3E,gBAAgB,EAAE,aAAa;IAC/B,WAAW,EAAE,QAAQ;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW;IACf;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,MAAyB;QACnC,MAAM,EACJ,QAAQ,GAAG,EAAE,EACb,cAAc,GAAG,EAAE,EACnB,MAAM,GAAG,cAAc,EACvB,SAAS,EACT,MAAM,EACN,QAAQ,KAEN,MAAM,EADL,IAAI,UACL,MAAM,EARJ,2EAQL,CAAS,CAAC;QAEX,MAAM,eAAe,GAAG,SAAS;YAC/B,CAAC,iCAAM,iBAAiB,GAAK,SAAS,EACtC,CAAC,CAAC,iBAAiB,CAAC;QAEtB,aAAa,CAAC,IAAI,iBAEd,MAAM;YACN,cAAc;YACd,QAAQ,EACR,SAAS,EAAE,eAAe,IACvB,IAAI,GAET,CAAC,SAAiB,EAAE,EAAE;YACpB,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,SAAS,CAAC,CAAC;QACtB,CAAC,EACD,CAAC,UAAkB,EAAE,EAAE;YACrB,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,UAAU,CAAC,CAAC;QACzB,CAAC,CACF,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CACT,IAAY,EACZ,OAAiE;QAEjE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,WAAW,CAAC,IAAI,iCACX,OAAO,KACV,IAAI,EACJ,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,CAAC,UAAU,EAAE,EAAE,CACvB,MAAM,CAAC,IAAI,KAAK,CAAC,+BAA+B,UAAU,EAAE,CAAC,CAAC,IAChE,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,MAAyB;QACnC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;CACF;AAOQ,kCAAW;AALpB;;GAEG;AACH,MAAM,WAAW,GAAG,WAAW,CAAC;AAEV,kCAAW;AACjC,kBAAe,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phucprime/react-native-image-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "React Native: Native Image Editor for iOS and Android with drawing, text, stickers, cropping and more",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -49,9 +49,17 @@
|
|
|
49
49
|
],
|
|
50
50
|
"author": "phucprime",
|
|
51
51
|
"license": "Apache-2.0",
|
|
52
|
+
"codegenConfig": {
|
|
53
|
+
"name": "RNPhotoEditorSpec",
|
|
54
|
+
"type": "modules",
|
|
55
|
+
"jsSrcsDir": "src",
|
|
56
|
+
"android": {
|
|
57
|
+
"javaPackageName": "ui.photoeditor"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
52
60
|
"peerDependencies": {
|
|
53
|
-
"react": ">=
|
|
54
|
-
"react-native": ">=0.
|
|
61
|
+
"react": ">=18.2.0",
|
|
62
|
+
"react-native": ">=0.73.0"
|
|
55
63
|
},
|
|
56
64
|
"peerDependenciesMeta": {
|
|
57
65
|
"react": {
|
|
@@ -62,12 +70,12 @@
|
|
|
62
70
|
}
|
|
63
71
|
},
|
|
64
72
|
"devDependencies": {
|
|
65
|
-
"@types/react": "
|
|
66
|
-
"prettier": "
|
|
73
|
+
"@types/react": "18.2.0 || 19.0.0",
|
|
74
|
+
"prettier": "3.2.0",
|
|
67
75
|
"react-native": "0.78.2",
|
|
68
|
-
"typescript": "
|
|
76
|
+
"typescript": "5.9.3"
|
|
69
77
|
},
|
|
70
78
|
"engines": {
|
|
71
79
|
"node": ">=16.0.0"
|
|
72
80
|
}
|
|
73
|
-
}
|
|
81
|
+
}
|
|
@@ -15,6 +15,14 @@ Pod::Spec.new do |s|
|
|
|
15
15
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
16
16
|
s.dependency "iOSPhotoEditor"
|
|
17
17
|
|
|
18
|
+
# Always enforce C++17 so that C++ standard-library headers (<utility>, <vector>,
|
|
19
|
+
# <chrono>, …) resolve correctly when the pod is compiled alongside React Native's
|
|
20
|
+
# C++ TurboModule/JSI headers, regardless of architecture or RN version.
|
|
21
|
+
s.pod_target_xcconfig = {
|
|
22
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
|
23
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
19
27
|
if respond_to?(:install_modules_dependencies, true)
|
|
20
28
|
install_modules_dependencies(s)
|
|
@@ -24,11 +32,6 @@ Pod::Spec.new do |s|
|
|
|
24
32
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
25
33
|
if ENV["RCT_NEW_ARCH_ENABLED"] == "1"
|
|
26
34
|
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
27
|
-
s.pod_target_xcconfig = {
|
|
28
|
-
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
29
|
-
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
30
|
-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
|
31
|
-
}
|
|
32
35
|
s.dependency "React-Codegen"
|
|
33
36
|
s.dependency "RCT-Folly"
|
|
34
37
|
s.dependency "RCTRequired"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* TurboModule codegen spec for RNPhotoEditor.
|
|
6
|
+
*
|
|
7
|
+
* This spec enables proper New Architecture (Fabric + TurboModules) support
|
|
8
|
+
* with compile-time type validation. On Old Architecture, TurboModuleRegistry
|
|
9
|
+
* falls back to the NativeModules bridge automatically.
|
|
10
|
+
*/
|
|
11
|
+
export interface Spec extends TurboModule {
|
|
12
|
+
Edit(
|
|
13
|
+
props: Object,
|
|
14
|
+
onDone: (result: string) => void,
|
|
15
|
+
onCancel: (result: number) => void,
|
|
16
|
+
): void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('RNPhotoEditor');
|
package/src/index.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
throw new Error(
|
|
8
|
-
'@phucprime/react-native-image-editor: NativeModule RNPhotoEditor is null. ' +
|
|
9
|
-
'Make sure the native module is properly linked.',
|
|
10
|
-
);
|
|
11
|
-
}
|
|
1
|
+
import NativeRNPhotoEditor from './NativeRNPhotoEditor';
|
|
2
|
+
|
|
3
|
+
// TurboModuleRegistry.getEnforcing handles both architectures:
|
|
4
|
+
// - New Architecture: Uses TurboModule system directly
|
|
5
|
+
// - Old Architecture: Falls back to NativeModules bridge (RN 0.73+)
|
|
6
|
+
const RNPhotoEditor = NativeRNPhotoEditor;
|
|
12
7
|
|
|
13
8
|
/**
|
|
14
9
|
* Localization strings for the image editor UI.
|
package/ios/RNPhotoEditor.m
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#import <React/RCTBridgeModule.h>
|
|
2
|
-
|
|
3
|
-
@interface RCT_EXTERN_MODULE(RNPhotoEditor, NSObject)
|
|
4
|
-
|
|
5
|
-
RCT_EXTERN_METHOD(Edit:(NSDictionary *)props
|
|
6
|
-
onDone:(RCTResponseSenderBlock)onDone
|
|
7
|
-
onCancel:(RCTResponseSenderBlock)onCancel)
|
|
8
|
-
|
|
9
|
-
+ (BOOL)requiresMainQueueSetup {
|
|
10
|
-
return YES;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
@end
|