Skip to content

Commit b726c59

Browse files
committed
chore: Addressing code review comments
1 parent 189aae8 commit b726c59

File tree

9 files changed

+49
-357
lines changed

9 files changed

+49
-357
lines changed

.github/actions/build-app/action.yml

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,14 @@ inputs:
2727
description: 'Platform (example: android or ios))'
2828
required: true
2929

30-
node-version:
31-
description: 'The Node.js version to set up'
32-
required: false
33-
34-
java-version:
35-
description: 'The Java version to set up'
36-
required: false
37-
3830

3931
runs:
4032
using: 'composite'
4133
steps:
4234
- uses: ./.github/actions/lock-nodejs-ver
43-
with:
44-
node-version: ${{ inputs.node-version }}
4535

4636
- uses: ./.github/actions/lock-java-ver
4737
if: ${{ inputs.platform == 'android' }}
48-
with:
49-
java-version: ${{ inputs.java-version }}
5038

5139
- uses: ./.github/actions/lock-ruby-ver
5240
if: ${{ inputs.platform == 'ios' }}
@@ -90,25 +78,13 @@ runs:
9078
if [[ '${{ inputs.platform }}' == 'ios' ]]; then
9179
brew install xcbeautify
9280
93-
94-
# Disable Flipper
95-
# RN 0.69.x and 0.70.x
96-
sed -i.bak "s|FlipperConfiguration.enabled|ENV['NO_FLIPPER'] == \"1\" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled|g" ios/Podfile
97-
# RN <= 0.68.x
98-
sed -i.bak 's|use_flipper!()|if ENV["NO_FLIPPER"] != "1"\n use_flipper!()\n end|g' ios/Podfile
99-
100-
# Fix Xcode 14 ([email protected])
101-
sed -i.bak 's|node->getLayout().hadOverflow() \|\||node->getLayout().hadOverflow()\|\||g' node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp
102-
sed -i.bak 's|node->getLayout().hadOverflow() \||node->getLayout().hadOverflow()\|\||g' node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp
103-
104-
10581
# Update pods after adding new module
10682
npx pod-install
107-
83+
10884
# Build iOS App
10985
xcodebuild -scheme ${{ env.APP_NAME }} -workspace ios/${{ env.APP_NAME }}.xcworkspace -configuration Release -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' | xcbeautify --quiet
110-
111-
# set output variable
86+
87+
# set output variable
11288
echo "app_path=$(find ~/Library/Developer/Xcode/DerivedData -type d -name "${{ env.APP_NAME }}.app")" >> $GITHUB_OUTPUT
11389
else
11490
# Enable new arch for Android
@@ -118,7 +94,7 @@ runs:
11894
11995
# Build Android
12096
./android/gradlew assembleRelease --no-daemon -p android -PreactNativeArchitectures=${{ inputs.arch }}
121-
97+
12298
# set output variable
12399
echo "app_path=$(find $(pwd)/android -type f -name '*.apk')" >> $GITHUB_OUTPUT
124100
fi

.github/workflows/main.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ jobs:
5656
max-parallel: 4
5757
matrix:
5858
new_arch_enabled: [ 1, 0 ]
59-
rn_ver: [latest] # also, can be any npm tag: 0.71-stable, next, nightly or version: 0.68, 0.70 ...
60-
59+
rn_ver: [latest ] # also, can be any npm tag: 0.71-stable, next, nightly
6160
steps:
6261
- name: Checkout repository
6362
uses: actions/checkout@v3
@@ -71,8 +70,6 @@ jobs:
7170
module-to-install: file:${{ github.workspace }}
7271
store-artifacts: true
7372
platform: android
74-
node-version: ${{ contains(matrix.rn_ver, '0.5') && '14' || contains(matrix.rn_ver, '0.6') && '16' || '18' }}
75-
java-version: ${{ contains(matrix.rn_ver, '0.5') && '8' || contains(matrix.rn_ver, '0.6') && '11' || '17' }}
7673

7774
build-ios:
7875
name: Build iOS
@@ -82,10 +79,7 @@ jobs:
8279
max-parallel: 3
8380
matrix:
8481
new_arch_enabled: [ 1, 0 ]
85-
rn_ver: [latest] # also, can be any npm tag: 0.71-stable, next, nightly or version: 0.68, 0.70 ...
86-
87-
88-
82+
rn_ver: [latest ] # also, can be any npm tag: 0.71-stable, next, nightly
8983
steps:
9084
- name: Checkout repository
9185
uses: actions/checkout@v3
@@ -98,5 +92,3 @@ jobs:
9892
module-to-install: file:${{ github.workspace }}
9993
store-artifacts: true
10094
platform: ios
101-
node-version: ${{ contains(matrix.rn_ver, '0.5') && '14' || contains(matrix.rn_ver, '0.6') && '16' || '18' }}
102-
java-version: ${{ contains(matrix.rn_ver, '0.5') && '8' || contains(matrix.rn_ver, '0.6') && '11' || '17' }}

android/build.gradle

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,3 @@ dependencies {
9393
//noinspection GradleDynamicVersion
9494
implementation "com.facebook.react:react-native:+"
9595
}
96-
97-
if (isNewArchitectureEnabled()) {
98-
react {
99-
jsRootDir = file("../src/")
100-
libraryName = "RNCImageEditor"
101-
codegenJavaPackageName = "com.reactnativecommunity.imageeditor"
102-
}
103-
}

android/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
RNImageEditor_compileSdkVersion=31
2-
RNImageEditor_targetSdkVersion=31
1+
RNImageEditor_compileSdkVersion=34
2+
RNImageEditor_targetSdkVersion=34
33
RNImageEditor_minSdkVersion=21

android/src/main/java/com/reactnativecommunity/imageeditor/ImageEditorPackage.java

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99

1010
import androidx.annotation.Nullable;
1111

12+
import com.facebook.react.TurboReactPackage;
1213
import com.facebook.react.bridge.NativeModule;
1314
import com.facebook.react.bridge.ReactApplicationContext;
15+
import com.facebook.react.module.annotations.ReactModule;
1416
import com.facebook.react.module.model.ReactModuleInfo;
1517
import com.facebook.react.module.model.ReactModuleInfoProvider;
16-
import com.facebook.react.TurboReactPackage;
18+
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
1719

1820
import java.util.HashMap;
1921
import java.util.Map;
@@ -32,21 +34,32 @@ public NativeModule getModule(String name, ReactApplicationContext reactContext)
3234

3335
@Override
3436
public ReactModuleInfoProvider getReactModuleInfoProvider() {
35-
return () -> {
36-
final Map<String, ReactModuleInfo> moduleInfos = new HashMap<>();
37-
boolean isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
38-
moduleInfos.put(
39-
ImageEditorModule.NAME,
37+
Class<? extends NativeModule>[] moduleList = new Class[] {
38+
ImageEditorModule.class
39+
};
40+
final Map<String, ReactModuleInfo> reactModuleInfoMap = new HashMap<>();
41+
42+
for (Class<? extends NativeModule> moduleClass : moduleList) {
43+
ReactModule reactModule = moduleClass.getAnnotation(ReactModule.class);
44+
reactModuleInfoMap.put(
45+
reactModule.name(),
4046
new ReactModuleInfo(
41-
ImageEditorModule.NAME,
42-
ImageEditorModule.NAME,
43-
false, // canOverrideExistingModule
44-
false, // needsEagerInit
45-
true, // hasConstants
46-
false, // isCxxModule
47-
isTurboModule // isTurboModule
48-
));
49-
return moduleInfos;
47+
reactModule.name(),
48+
moduleClass.getName(),
49+
true,
50+
reactModule.needsEagerInit(),
51+
reactModule.hasConstants(),
52+
reactModule.isCxxModule(),
53+
TurboModule.class.isAssignableFrom(moduleClass)
54+
)
55+
);
56+
}
57+
58+
return new ReactModuleInfoProvider() {
59+
@Override
60+
public Map<String, ReactModuleInfo> getReactModuleInfos() {
61+
return reactModuleInfoMap;
62+
}
5063
};
5164
}
5265
}

android/src/newarch/com/reactnativecommunity/imageeditor/ImageEditorModule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package com.reactnativecommunity.imageeditor;
22

3-
import android.os.AsyncTask;
4-
53
import androidx.annotation.NonNull;
64

75
import com.facebook.react.bridge.Promise;
86
import com.facebook.react.bridge.ReadableMap;
97
import com.facebook.react.bridge.ReactApplicationContext;
8+
import com.facebook.react.module.annotations.ReactModule;
109

10+
@ReactModule(name = ImageEditorModule.NAME)
1111
public class ImageEditorModule extends NativeRNCImageEditorSpec {
1212
private ImageEditorModuleImpl moduleImpl;
1313

android/src/oldarch/com/reactnativecommunity/imageeditor/ImageEditorModule.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
import com.facebook.react.bridge.ReactContextBaseJavaModule;
99
import com.facebook.react.bridge.ReactMethod;
1010
import com.facebook.react.bridge.ReadableMap;
11+
import com.facebook.react.module.annotations.ReactModule;
1112

13+
@ReactModule(name = ImageEditorModule.NAME)
1214
public class ImageEditorModule extends ReactContextBaseJavaModule {
1315
private ImageEditorModuleImpl moduleImpl;
1416

0 commit comments

Comments
 (0)