@phucprime/react-native-image-editor 1.0.1 → 1.0.2

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.
@@ -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'
@@ -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
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
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 ReactContextBaseJavaModule {
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,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
+ }
@@ -1,13 +1,24 @@
1
1
  #import <React/RCTBridgeModule.h>
2
2
 
3
- @interface RCT_EXTERN_MODULE(RNPhotoEditor, NSObject)
3
+ #ifdef RCT_NEW_ARCH_ENABLED
4
+ #import <RNPhotoEditorSpec/RNPhotoEditorSpec.h>
5
+ #endif
4
6
 
5
- RCT_EXTERN_METHOD(Edit:(NSDictionary *)props
6
- onDone:(RCTResponseSenderBlock)onDone
7
- onCancel:(RCTResponseSenderBlock)onCancel)
7
+ @interface RCT_EXTERN_MODULE (RNPhotoEditor, NSObject)
8
+
9
+ RCT_EXTERN_METHOD(Edit : (NSDictionary *)props onDone : (RCTResponseSenderBlock)
10
+ onDone onCancel : (RCTResponseSenderBlock)onCancel)
8
11
 
9
12
  + (BOOL)requiresMainQueueSetup {
10
- return YES;
13
+ return YES;
11
14
  }
12
15
 
13
16
  @end
17
+
18
+ #ifdef RCT_NEW_ARCH_ENABLED
19
+ // Conform to the codegen-generated protocol for TurboModule support.
20
+ // The actual implementation is in RNPhotoEditor.swift; this declaration
21
+ // tells the compiler the Swift class satisfies the protocol.
22
+ @interface RNPhotoEditor () <NativeRNPhotoEditorSpec>
23
+ @end
24
+ #endif
@@ -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,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_native_1 = require("react-native");
4
+ exports.default = react_native_1.TurboModuleRegistry.getEnforcing('RNPhotoEditor');
5
+ //# sourceMappingURL=NativeRNPhotoEditor.js.map
@@ -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"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA;;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,EA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AmD;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 react_native_1 = require("react-native");
16
- // Support both New Architecture (interop layer) and Old Architecture (NativeModules bridge).
17
- // In RN 0.78+, NativeModules works through the TurboModule interop layer in bridgeless mode.
18
- const RNPhotoEditor = react_native_1.NativeModules.RNPhotoEditor;
19
- if (!RNPhotoEditor) {
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":";;;;;;;;;;;;;;AAAA,+CAAuD;AAEvD,6FAA6F;AAC7F,6FAA6F;AAC7F,MAAM,aAAa,GAAG,4BAAa,CAAC,aAAa,CAAC;AAClD,IAAI,CAAC,aAAa,EAAE,CAAC;IACnB,MAAM,IAAI,KAAK,CACb,4EAA4E;QAC1E,iDAAiD,CACpD,CAAC;AACJ,CAAC;AA4FD,4CAA4C;AAC5C,MAAM,c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AC,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.1",
3
+ "version": "1.0.2",
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": ">=16.8.0",
54
- "react-native": ">=0.60.0"
61
+ "react": ">=18.2.0",
62
+ "react-native": ">=0.73.0"
55
63
  },
56
64
  "peerDependenciesMeta": {
57
65
  "react": {
@@ -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 { NativeModules, Platform } from 'react-native';
2
-
3
- // Support both New Architecture (interop layer) and Old Architecture (NativeModules bridge).
4
- // In RN 0.78+, NativeModules works through the TurboModule interop layer in bridgeless mode.
5
- const RNPhotoEditor = NativeModules.RNPhotoEditor;
6
- if (!RNPhotoEditor) {
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.