Skip to content

Commit 8fec829

Browse files
authored
Merge pull request #167 from callstack/chore/retyui/update-dev-deps
React Native 0.77.x compatibility
2 parents 07e555b + 4b5ee57 commit 8fec829

21 files changed

+5099
-6663
lines changed

.eslintrc.js

-13
This file was deleted.

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

+12-6
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,23 @@ runs:
6565
run: |
6666
set -x # print all executed commands
6767
68+
export YARN_ENABLE_IMMUTABLE_INSTALLS=false
69+
6870
# Create new tmp React Native project
69-
npx react-native@${{ inputs.rn-ver }} init ${{ env.APP_NAME }} --version ${{ inputs.rn-ver }} --skip-git-init --install-pods false
71+
npx @react-native-community/cli init ${{ env.APP_NAME }} --version ${{ inputs.rn-ver }} --skip-git-init --install-pods false --pm yarn
7072
cd ${{ env.APP_NAME }}
7173
72-
# Install my module
73-
# Yarn1 syntax: yarn add ${{ inputs.module-to-install }}
74-
# Yarn Berry (2+) syntax:
75-
yarn add @react-native-community/image-editor@portal:${{ inputs.module-to-install }}
74+
# Link my module
75+
if [ -d ".yarn" ]; then
76+
# Yarn Berry (2+) syntax:
77+
yarn add @react-native-community/image-editor@portal:${{ inputs.module-to-install }}
78+
else
79+
# Yarn1 syntax:
80+
yarn add ${{ inputs.module-to-install }}
81+
fi
7682
7783
# Debug info
78-
npx react-native@${{ inputs.rn-ver }} info
84+
npx @react-native-community/cli info
7985
8086
if [[ '${{ inputs.platform }}' == 'ios' ]]; then
8187
brew install xcbeautify

android/src/main/java/com/reactnativecommunity/imageeditor/ImageEditorModuleImpl.kt

+10-1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ class ImageEditorModuleImpl(private val reactContext: ReactApplicationContext) {
8787
}
8888
}
8989

90+
/**
91+
* React Native
92+
* - 0.77.x: toHashMap(): HashMap<String, Any?>?
93+
* - 0.76.x: toHashMap(): HashMap<String, Any>?
94+
*/
95+
fun <V> safeConvert(map: HashMap<String, V>?): HashMap<String, Any>? {
96+
return map?.filterValues { it != null } as? HashMap<String, Any>
97+
}
98+
9099
/**
91100
* Crop an image. If all goes well, the promise will be resolved with the file:// URI of the new
92101
* image as the only argument. This is a temporary file - consider using
@@ -102,7 +111,7 @@ class ImageEditorModuleImpl(private val reactContext: ReactApplicationContext) {
102111
fun cropImage(uri: String?, options: ReadableMap, promise: Promise) {
103112
val headers =
104113
if (options.hasKey("headers") && options.getType("headers") == ReadableType.Map)
105-
options.getMap("headers")?.toHashMap()
114+
safeConvert(options.getMap("headers")?.toHashMap())
106115
else null
107116
val format = if (options.hasKey("format")) options.getString("format") else null
108117
val offset = if (options.hasKey("offset")) options.getMap("offset") else null

eslint.config.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const callstackConfigReact = require('@callstack/eslint-config/react.flat.js');
2+
3+
module.exports = [
4+
{
5+
ignores: ['node_modules/', 'lib/'],
6+
},
7+
...callstackConfigReact,
8+
{
9+
files: ['eslint.config.js', 'example/**/*.{js,ts,tsx}'],
10+
rules: {
11+
'import/no-extraneous-dependencies': 'off',
12+
'import/no-unresolved': 'off',
13+
'require-await': 'off',
14+
},
15+
},
16+
];

example/android/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ android.useAndroidX=true
2727
# Automatically convert third-party libraries to use AndroidX
2828
android.enableJetifier=true
2929
# Jetifier randomly fails on these libraries
30-
android.jetifier.ignorelist=hermes-android
30+
android.jetifier.ignorelist=hermes-android,react-android
3131

3232
# Use this property to specify which architecture you want to build.
3333
# You can also override it from the CLI using
-9 Bytes
Binary file not shown.

example/android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

example/android/gradlew

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.

example/app.json

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
"dist/assets",
2121
"dist/main.macos.jsbundle"
2222
],
23+
"visionos": [
24+
"dist/assets",
25+
"dist/main.visionos.jsbundle"
26+
],
2327
"windows": [
2428
"dist/assets",
2529
"dist/main.windows.bundle"

example/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* @format
3+
*/
4+
15
import { AppRegistry } from 'react-native';
26
import App from './src/App';
37
import { name as appName } from './app.json';

example/ios/Podfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ require "#{ws_dir}/node_modules/react-native-test-app/test_app.rb"
66

77
workspace 'ImageEditorExample.xcworkspace'
88

9-
use_test_app!
9+
use_test_app! :hermes_enabled => true

0 commit comments

Comments
 (0)