From 74b746bf29023b5797e6a158292f16dff78f60ca Mon Sep 17 00:00:00 2001 From: Sayuri Mizuguchi Date: Thu, 13 Jun 2024 14:43:13 -0400 Subject: [PATCH 1/4] Issue ReactTextShadowNode not on v74 resolution --- .../utils/ReactTypefaceUtils.java | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java b/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java index 834d734f154..3e1ca6ac1c5 100644 --- a/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java +++ b/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java @@ -18,6 +18,7 @@ import android.text.TextUtils; import androidx.annotation.Nullable; import com.facebook.react.bridge.ReadableArray; +import com.facebook.react.common.ReactConstants; import com.facebook.react.views.text.ReactFontManager; import com.facebook.react.views.text.ReactTextShadowNode; import java.util.ArrayList; @@ -27,12 +28,13 @@ public class ReactTypefaceUtils { public static final int UNSET = -1; public static int parseFontWeight(@Nullable String fontWeightString) { - int fontWeightNumeric = - fontWeightString != null ? parseNumericFontWeight(fontWeightString) : UNSET; + int fontWeightNumeric = fontWeightString != null ? parseNumericFontWeight(fontWeightString) : UNSET; int fontWeight = fontWeightNumeric != UNSET ? fontWeightNumeric : Typeface.NORMAL; - if (fontWeight == 700 || "bold".equals(fontWeightString)) fontWeight = Typeface.BOLD; - else if (fontWeight == 400 || "normal".equals(fontWeightString)) fontWeight = Typeface.NORMAL; + if (fontWeight == 700 || "bold".equals(fontWeightString)) + fontWeight = Typeface.BOLD; + else if (fontWeight == 400 || "normal".equals(fontWeightString)) + fontWeight = Typeface.NORMAL; return fontWeight; } @@ -96,19 +98,20 @@ public static Typeface applyStyles( int want = 0; if ((weight == Typeface.BOLD) - || ((oldStyle & Typeface.BOLD) != 0 && weight == ReactTextShadowNode.UNSET)) { + || ((oldStyle & Typeface.BOLD) != 0 && weight == ReactConstants.UNSET)) { want |= Typeface.BOLD; } if ((style == Typeface.ITALIC) - || ((oldStyle & Typeface.ITALIC) != 0 && style == ReactTextShadowNode.UNSET)) { + || ((oldStyle & Typeface.ITALIC) != 0 && style == ReactConstants.UNSET)) { want |= Typeface.ITALIC; } if (family != null) { typeface = ReactFontManager.getInstance().getTypeface(family, want, weight, assetManager); } else if (typeface != null) { - // TODO(t9055065): Fix custom fonts getting applied to text children with different style + // TODO(t9055065): Fix custom fonts getting applied to text children with + // different style typeface = Typeface.create(typeface, want); } @@ -120,16 +123,18 @@ public static Typeface applyStyles( } /** - * Return -1 if the input string is not a valid numeric fontWeight (100, 200, ..., 900), otherwise + * Return -1 if the input string is not a valid numeric fontWeight (100, 200, + * ..., 900), otherwise * return the weight. */ private static int parseNumericFontWeight(String fontWeightString) { - // This should be much faster than using regex to verify input and Integer.parseInt + // This should be much faster than using regex to verify input and + // Integer.parseInt return fontWeightString.length() == 3 - && fontWeightString.endsWith("00") - && fontWeightString.charAt(0) <= '9' - && fontWeightString.charAt(0) >= '1' - ? 100 * (fontWeightString.charAt(0) - '0') - : UNSET; + && fontWeightString.endsWith("00") + && fontWeightString.charAt(0) <= '9' + && fontWeightString.charAt(0) >= '1' + ? 100 * (fontWeightString.charAt(0) - '0') + : UNSET; } } From 74a400988c26d29a7c11e69d6bb41c4c2c29040b Mon Sep 17 00:00:00 2001 From: Sayuri Mizuguchi Date: Thu, 13 Jun 2024 15:00:57 -0400 Subject: [PATCH 2/4] v74 package.json --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index a32c29b28f5..4f97d591310 100644 --- a/package.json +++ b/package.json @@ -77,9 +77,9 @@ "@babel/runtime": "7.22.6", "@babel/types": "7.22.5", "@babel/preset-env": "^7.22.9", - "@react-native/metro-config": "^0.73.2", - "@react-native/babel-preset": "^0.73.18", - "@react-native/typescript-config": "^0.73.1", + "@react-native/metro-config": "^0.74.84", + "@react-native/babel-preset": "^0.74.84", + "@react-native/typescript-config": "^0.74.84", "@react-native-community/blur": "^3.6.0", "@react-native-community/datetimepicker": "^3.4.7", "@react-native-community/eslint-config": "2.0.0", @@ -112,7 +112,7 @@ "pngjs": "^6.0.0", "prettier": "2.1.2", "react": "18.2.0", - "react-native": "0.73.3", + "react-native": "0.74.2", "react-native-fast-image": "^8.6.3", "react-native-gesture-handler": "^2.10.1", "react-native-reanimated": "^3.8.1", @@ -231,4 +231,4 @@ } } } -} \ No newline at end of file +} From b7343afa9095182df2fff85a700d8e8117101b0d Mon Sep 17 00:00:00 2001 From: Sayuri Mizuguchi Date: Thu, 22 Aug 2024 12:02:55 -0400 Subject: [PATCH 3/4] feat(upgrade): rn 74 requirement for babel plugin - exception treated --- babel.config.js | 6 ++++++ package.json | 11 ++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/babel.config.js b/babel.config.js index cdf7ebe6ab5..685371d5ea3 100644 --- a/babel.config.js +++ b/babel.config.js @@ -6,6 +6,12 @@ module.exports = function (api) { '@babel/plugin-proposal-export-namespace-from', '@babel/plugin-proposal-export-default-from', 'react-native-reanimated/plugin', + '@babel/plugin-proposal-class-properties', + ], + overrides: [ + { + plugins: [['@babel/plugin-transform-private-methods']], + }, ], }; }; diff --git a/package.json b/package.json index dc32f1fdd38..9a79305d207 100644 --- a/package.json +++ b/package.json @@ -71,16 +71,17 @@ "@babel/core": "7.22.9", "@babel/plugin-proposal-export-default-from": "7.10.1", "@babel/plugin-proposal-export-namespace-from": "7.10.1", + "@babel/plugin-transform-private-methods": "^7.24.7", + "@babel/preset-env": "^7.22.9", "@babel/runtime": "7.22.6", "@babel/types": "7.22.5", - "@babel/preset-env": "^7.22.9", - "@react-native/metro-config": "^0.74.84", - "@react-native/babel-preset": "^0.74.84", - "@react-native/typescript-config": "^0.74.84", "@react-native-community/blur": "^3.6.0", "@react-native-community/datetimepicker": "^3.4.7", "@react-native-community/eslint-config": "2.0.0", "@react-native-community/netinfo": "^5.9.4", + "@react-native/babel-preset": "^0.74.84", + "@react-native/metro-config": "^0.74.84", + "@react-native/typescript-config": "^0.74.84", "@testing-library/jest-native": "^5.4.2", "@testing-library/react-native": "^12.0.1", "@types/hoist-non-react-statics": "^3.0.1", @@ -228,4 +229,4 @@ } } } -} +} \ No newline at end of file From c2737ff2a8e8134cd23f3af5c34d9b5f74acec6e Mon Sep 17 00:00:00 2001 From: Sayuri Mizuguchi Date: Thu, 22 Aug 2024 12:03:34 -0400 Subject: [PATCH 4/4] feat(upgrade): rn 74 requirement Android minSdk 23 --- lib/android/app/build.gradle | 2 +- lib/android/gradle/wrapper/gradle-wrapper.properties | 3 +-- playground/android/app/build.gradle | 2 +- playground/android/build.gradle | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/android/app/build.gradle b/lib/android/app/build.gradle index 3428f1a8820..da51bb28397 100644 --- a/lib/android/app/build.gradle +++ b/lib/android/app/build.gradle @@ -13,7 +13,7 @@ def safeExtGetFallbackLowerBound(prop, fallback) { } def DEFAULT_COMPILE_SDK_VERSION = 33 -def DEFAULT_MIN_SDK_VERSION = 21 +def DEFAULT_MIN_SDK_VERSION = 23 def DEFAULT_TARGET_SDK_VERSION = 33 def DEFAULT_KOTLIN_VERSION = "1.5.31" def DEFAULT_KOTLIN_STDLIB = 'kotlin-stdlib-jdk8' diff --git a/lib/android/gradle/wrapper/gradle-wrapper.properties b/lib/android/gradle/wrapper/gradle-wrapper.properties index fd44bb50b67..ffed3a254e9 100644 --- a/lib/android/gradle/wrapper/gradle-wrapper.properties +++ b/lib/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Thu Jan 04 11:01:32 EET 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip diff --git a/playground/android/app/build.gradle b/playground/android/app/build.gradle index 8624bb3cc60..1c25d0d8b8b 100644 --- a/playground/android/app/build.gradle +++ b/playground/android/app/build.gradle @@ -22,7 +22,7 @@ android { defaultConfig { applicationId "com.reactnativenavigation.playground" - minSdkVersion 21 + minSdkVersion 23 targetSdkVersion rootProject.ext.get("targetSdkVersion") versionCode 1 versionName "1.0" diff --git a/playground/android/build.gradle b/playground/android/build.gradle index 809412b1917..39ababa1dfe 100644 --- a/playground/android/build.gradle +++ b/playground/android/build.gradle @@ -7,7 +7,7 @@ buildscript { detoxKotlinVersion = kotlinVersion compileSdkVersion = 34 buildToolsVersion = "34.0.0" - minSdkVersion = 21 + minSdkVersion = 23 targetSdkVersion = 34 // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP. ndkVersion = "23.1.7779620"