From a56de41f53172bcb48757fa6179d45ca830e8de0 Mon Sep 17 00:00:00 2001 From: Thuc Nguyen Duy Date: Sat, 9 Sep 2023 11:17:08 +0700 Subject: [PATCH] [issue-1007] Upgrade React Native 0.72.4 --- .eslintrc.js | 2 +- .gitignore | 4 +- .node-version | 1 - Gemfile | 2 +- __tests__/App-test.tsx | 3 + android/app/build.gradle | 49 +- .../app/subwallet/mobile/MainActivity.java | 5 +- .../res/drawable/rn_edit_text_material.xml | 2 +- android/build.gradle | 2 +- android/gradle.properties | 2 +- android/gradle/wrapper/gradle-wrapper.jar | Bin 59821 -> 61574 bytes .../gradle/wrapper/gradle-wrapper.properties | 3 +- android/gradlew | 18 +- android/gradlew.bat | 15 +- android/settings.gradle | 2 +- babel.config.js | 2 +- ios/Podfile | 23 +- ios/Podfile.lock | 721 +- ios/SubWalletMobile.xcodeproj/project.pbxproj | 2 + ios/SubWalletMobile/AppDelegate.mm | 9 - jest.config.js | 4 + metro.config.js | 40 +- package.json | 28 +- .../animated-flatlist/index.tsx | 44 - src/components/design-system-ui/index.ts | 1 - .../Home/Crypto/shared/TokensLayout.tsx | 8 +- src/screens/Home/index.tsx | 2 +- yarn.lock | 5965 ++++++++--------- 28 files changed, 3220 insertions(+), 3739 deletions(-) delete mode 100644 .node-version create mode 100644 jest.config.js delete mode 100644 src/components/design-system-ui/animated-flatlist/index.tsx diff --git a/.eslintrc.js b/.eslintrc.js index dcf0be086..9dd57a791 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,6 +1,6 @@ module.exports = { root: true, - extends: '@react-native-community', + extends: '@react-native', parser: '@typescript-eslint/parser', plugins: ['@typescript-eslint'], overrides: [ diff --git a/.gitignore b/.gitignore index e4fb83526..d4ef66da0 100644 --- a/.gitignore +++ b/.gitignore @@ -63,4 +63,6 @@ yarn-error.log # Temporary files created by Metro to check the health of the file watcher .metro-health-check* .env.development -.env.production \ No newline at end of file +.env.production +# testing +/coverage diff --git a/.node-version b/.node-version deleted file mode 100644 index 25bf17fc5..000000000 --- a/.node-version +++ /dev/null @@ -1 +0,0 @@ -18 \ No newline at end of file diff --git a/Gemfile b/Gemfile index 1142b1b20..8105b960f 100644 --- a/Gemfile +++ b/Gemfile @@ -3,4 +3,4 @@ source 'https://rubygems.org' # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version ruby '>= 2.6.10' -gem 'cocoapods', '>= 1.11.3' +gem 'cocoapods', '~> 1.12' diff --git a/__tests__/App-test.tsx b/__tests__/App-test.tsx index f83288be7..1002a812a 100644 --- a/__tests__/App-test.tsx +++ b/__tests__/App-test.tsx @@ -5,6 +5,9 @@ import 'react-native'; import React from 'react'; +// Note: import explicitly to use the types shiped with jest. +import { it } from '@jest/globals'; + // Note: test renderer must be required after react-native. import renderer from 'react-test-renderer'; import AppNew from '../src/AppNew'; diff --git a/android/app/build.gradle b/android/app/build.gradle index f7bbbbde0..49fc6de2c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -2,8 +2,6 @@ apply plugin: "com.android.application" apply plugin: "com.facebook.react" apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" -import com.android.build.OutputFile - /** * This is the configuration block to customize your React Native Android app. * By default you don't need to apply any configuration, just uncomment the lines you need. @@ -14,8 +12,8 @@ react { // root = file("../") // The folder where the react-native NPM package is. Default is ../node_modules/react-native // reactNativeDir = file("../node_modules/react-native") - // The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen - // codegenDir = file("../node_modules/react-native-codegen") + // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen + // codegenDir = file("../node_modules/@react-native/codegen") // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js // cliFile = file("../node_modules/react-native/cli.js") /* Variants */ @@ -50,14 +48,6 @@ react { // hermesFlags = ["-O", "-output-source-map"] } -/** - * Set this to true to create four separate APKs instead of one, - * one for each native architecture. This is useful if you don't - * use App Bundles (https://developer.android.com/guide/app-bundle/) - * and want to have separate APKs to upload to the Play Store. - */ -def enableSeparateBuildPerCPUArchitecture = false - /** * Set this to true to Run Proguard on Release builds to minify the Java bytecode. */ @@ -75,15 +65,6 @@ def enableProguardInReleaseBuilds = false * this variant is about 6MiB larger per architecture than default. */ def jscFlavor = 'org.webkit:android-jsc:+' -/** - * Private function to get the list of Native Architectures you want to build. - * This reads the value from reactNativeArchitectures in your gradle.properties - * file and works together with the --active-arch-only flag of react-native run-android. - */ -def reactNativeArchitectures() { - def value = project.getProperties().get("reactNativeArchitectures") - return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] -} android { ndkVersion rootProject.ext.ndkVersion @@ -99,14 +80,6 @@ android { missingDimensionStrategy 'react-native-camera', 'general' } - splits { - abi { - reset() - enable enableSeparateBuildPerCPUArchitecture - universalApk false // If true, also generate a universal APK - include (*reactNativeArchitectures()) - } - } signingConfigs { debug { storeFile file('debug.keystore') @@ -136,22 +109,6 @@ android { } } - // applicationVariants are e.g. debug, release - applicationVariants.all { variant -> - variant.outputs.each { output -> - // For each separate APK per architecture, set a unique version code as described here: - // https://developer.android.com/studio/build/configure-apk-splits.html - // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc. - def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] - def abi = output.getFilter(OutputFile.ABI) - if (abi != null) { // null for the universal-debug, universal-release variants - output.versionCodeOverride = - defaultConfig.versionCode * 1000 + versionCodes.get(abi) - } - - } - } - sourceSets { main { assets.srcDirs = ['src/main/assets', '../../html'] } } @@ -177,8 +134,6 @@ dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") - implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0") - debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { exclude group:'com.squareup.okhttp3', module:'okhttp' diff --git a/android/app/src/main/java/app/subwallet/mobile/MainActivity.java b/android/app/src/main/java/app/subwallet/mobile/MainActivity.java index a717703cc..5e9214598 100644 --- a/android/app/src/main/java/app/subwallet/mobile/MainActivity.java +++ b/android/app/src/main/java/app/subwallet/mobile/MainActivity.java @@ -36,9 +36,6 @@ protected ReactActivityDelegate createReactActivityDelegate() { this, getMainComponentName(), // If you opted-in for the New Architecture, we enable the Fabric Renderer. - DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled - // If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18). - DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled - ); + DefaultNewArchitectureEntryPoint.getFabricEnabled()); } } diff --git a/android/app/src/main/res/drawable/rn_edit_text_material.xml b/android/app/src/main/res/drawable/rn_edit_text_material.xml index f35d99620..73b37e4d9 100644 --- a/android/app/src/main/res/drawable/rn_edit_text_material.xml +++ b/android/app/src/main/res/drawable/rn_edit_text_material.xml @@ -20,7 +20,7 @@ android:insetBottom="@dimen/abc_edit_text_inset_bottom_material"> -