Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update App to React Native 0.72 version #18507

Merged
merged 55 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
fb839b2
Initial changes to use Expensify's 0.72.0-rc.1-alpha.0 RN version
fabioh8010 May 5, 2023
31a5993
Fix metro.config.js to use new config loading setup
fabioh8010 May 8, 2023
aadce15
Use personal RN release temporally
fabioh8010 May 8, 2023
1853e3a
Create temporary patches for @onfido/react-native-sdk and lottie-reac…
fabioh8010 May 8, 2023
e317397
Update react-native-reanimated to 3.1.0 to support RN 0.72
fabioh8010 May 9, 2023
dc090e4
Create temporary patch for react-native
fabioh8010 May 9, 2023
b7951d6
Merge remote-tracking branch 'origin/main' into feature/rn-update-0.72
fabioh8010 May 10, 2023
cc82588
Update react-native-reanimated to nightly build in order to fix iOS c…
fabioh8010 May 16, 2023
00eb45d
Update lottie-react-native and remove patch
fabioh8010 May 16, 2023
94fffc7
Update Gemfile.lock and Podfile.lock with correct Cocoapods version
fabioh8010 May 16, 2023
4f6775d
Merge remote-tracking branch 'origin/main' into feature/rn-update-0.72
fabioh8010 May 20, 2023
0fb2aa0
Fix react-native-reanimated patch to only include react-navigation ch…
fabioh8010 May 20, 2023
675801f
Merge remote-tracking branch 'origin/main' into feature/rn-update-0.72
fabioh8010 May 31, 2023
b45c2f6
Use a new Expensify RN release to fix a Android build problem
fabioh8010 May 31, 2023
61c395b
Merge remote-tracking branch 'origin/main' into feature/rn-update-0.72
fabioh8010 May 31, 2023
ff1c818
Update RN release with different version
fabioh8010 Jun 1, 2023
4bbf36e
Format files
fabioh8010 Jun 1, 2023
8c41f3c
Merge remote-tracking branch 'origin/main' into feature/rn-update-0.72
fabioh8010 Jun 1, 2023
ef3a33b
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jun 20, 2023
7c09b4e
Update app to use RN 0.72.0-rc.6
fabioh8010 Jun 20, 2023
20092ea
Upgrade RN to 0.62.0 and bump react-native-gesture-handler, react-nat…
fabioh8010 Jun 22, 2023
84196ee
Fix issue with Metro config
fabioh8010 Jun 22, 2023
6026a60
Create patch-package for @oguzhnatly/react-native-image-manipulator l…
fabioh8010 Jun 22, 2023
239def1
Remove unused libraries
fabioh8010 Jun 22, 2023
622e9f7
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jun 23, 2023
f18b635
Fix postInstall.sh script to install desktop modules when we are not …
fabioh8010 Jun 26, 2023
3248140
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jun 26, 2023
e1cda52
Remove react-native-reanimated patch
fabioh8010 Jun 26, 2023
50245aa
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jun 29, 2023
e7c0c61
Re-apply patch to RN 0.72.0
fabioh8010 Jun 29, 2023
5436537
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jun 30, 2023
0c3acdf
Upgrade RN to 0.72.1
fabioh8010 Jun 30, 2023
33bdacd
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jul 3, 2023
25696cd
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jul 3, 2023
4d42218
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jul 7, 2023
6a9fc44
Remove workaround as it's not necessary anymore in RN 0.72.0
fabioh8010 Jul 7, 2023
5005579
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jul 7, 2023
dae067f
Remove unnecessary "alternateTextMaxLines" usage from PriorityModePage
fabioh8010 Jul 7, 2023
3e75ba2
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jul 10, 2023
3829399
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jul 11, 2023
ea2ffb2
Enable Android building from source
fabioh8010 Jul 11, 2023
952cad4
Update patch-package to canary and apply two RN patches
fabioh8010 Jul 11, 2023
7b2292e
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jul 13, 2023
7b8b26f
Add Jest mock to prevent errors related to NumberOfLines PR
fabioh8010 Jul 13, 2023
058809d
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jul 13, 2023
f10fd80
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jul 14, 2023
12f60b4
Update "NumberOfLines" patch to include newer changes
fabioh8010 Jul 14, 2023
2dc0e8c
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jul 19, 2023
043f3b7
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jul 24, 2023
8cc097b
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jul 25, 2023
4881cd4
Update NumberOfLines patch file
fabioh8010 Jul 25, 2023
7d40e26
Add workaround for NumberOfLines patch file to fix issues with Text c…
fabioh8010 Jul 25, 2023
2b07cf5
Merge branch 'main' into feature/rn-update-0.72
fabioh8010 Jul 26, 2023
6c8e524
Merge remote-tracking branch 'origin/main' into feature/rn-update-0.72
fabioh8010 Aug 1, 2023
72a3520
Merge remote-tracking branch 'origin/main' into feature/rn-update-0.72
fabioh8010 Aug 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ build/
.gradle
local.properties
*.iml
android/*.hprof
*.hprof
android/app/src/main/java/com/expensify/chat/generated/
.cxx/

Expand Down Expand Up @@ -96,5 +96,8 @@ storybook-static
tests/e2e/results/
.reassure

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*

# Typescript
tsconfig.tsbuildinfo
1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

1 change: 1 addition & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
fabioh8010 marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
source "https://rubygems.org"

gem "cocoapods", "~> 1.11.3"
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will be better to set it as 3.x

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @parasharrajat that we should get on Ruby 3 if possible. However, I suggest that we lock to a specific version of Ruby and cocoapods. The Podfile.lock may have a diff if you do pod install from a different version of cocoapods. I think that also broke pod caching in our CI, so we should lock that down to a specific version.

Also, why remove the .ruby-version file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roryabraham @parasharrajat It was removed in the last version and now the ruby version is specified in Gemfile file, according to the upgrade helper tool.

Also, why remove the .ruby-version file?

These two commits also give us some insight about what those decisions:

I agree with @parasharrajat that we should get on Ruby 3 if possible. However, I suggest that we lock to a specific version of Ruby and cocoapods.

Yes, I agree as well (as long Ruby 3 works, needs testing). In fact, a common problem that we have here is that some contributors do pod install normally and some use bundle to execute this task, which sometimes result in diffs in Podfile.lock.

Coming from this issue, I agree we should change the instructions to tell contributors to use only bundle to avoid these problems.


gem "cocoapods", "~> 1.12"
gem "fastlane", "~> 2"
gem "xcpretty", "~> 0"

Expand Down
23 changes: 13 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,26 @@ GEM
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
claide (1.1.0)
cocoapods (1.11.3)
cocoapods (1.12.1)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.11.3)
cocoapods-core (= 1.12.1)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.4.0, < 2.0)
cocoapods-downloader (>= 1.6.0, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 1.0, < 3.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.21.0, < 2.0)
cocoapods-core (1.11.3)
activesupport (>= 5.0, < 7)
cocoapods-core (1.12.1)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
Expand Down Expand Up @@ -207,7 +207,7 @@ GEM
http-cookie (1.0.5)
domain_name (~> 0.5)
httpclient (2.8.3)
i18n (1.12.0)
i18n (1.13.0)
concurrent-ruby (~> 1.0)
jmespath (1.6.1)
json (2.6.3)
Expand Down Expand Up @@ -280,7 +280,7 @@ GEM
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.1)
xcpretty (~> 0.2, >= 0.0.7)
zeitwerk (2.6.7)
zeitwerk (2.6.8)

PLATFORMS
arm64-darwin-21
Expand All @@ -290,10 +290,13 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
cocoapods (~> 1.11.3)
cocoapods (~> 1.12)
fastlane (~> 2)
fastlane-plugin-aws_s3
xcpretty (~> 0)

RUBY VERSION
ruby 2.6.10p210

BUNDLED WITH
2.1.4
48 changes: 2 additions & 46 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ apply plugin: "com.facebook.react"
apply plugin: "com.google.firebase.firebase-perf"
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.
Expand All @@ -15,8 +13,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")

Expand Down Expand Up @@ -59,14 +57,6 @@ project.ext.envConfigFiles = [
release: ".env.production",
]

/**
* 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.
*/
Expand All @@ -85,16 +75,6 @@ def enableProguardInReleaseBuilds = false
*/
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

Expand All @@ -110,14 +90,6 @@ android {
versionName "1.3.49-0"
}

splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include (*reactNativeArchitectures())
}
}
signingConfigs {
release {
if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
Expand Down Expand Up @@ -155,27 +127,11 @@ android {
signingConfig signingConfigs.debug
}
}

// 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
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 =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}

}
}
}

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:${FLIPPER_VERSION}") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ 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());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material">

<selector>
<!--
<!--
This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.3.1")
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("com.google.gms:google-services:4.3.4")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.7.1")
Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ AsyncStorage_db_size_in_MB=10
AsyncStorage_useNextStorage=true

# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.125.0
FLIPPER_VERSION=0.182.0

# Use this property to specify which architecture you want to build.
# You can also override it from the CLI using
Expand Down
Binary file modified android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
20 changes: 15 additions & 5 deletions android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -205,6 +209,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand All @@ -231,4 +241,4 @@ eval "set -- $(
tr '\n' ' '
)" '"$@"'

exec "$JAVACMD" "$@"
exec "$JAVACMD" "$@"
37 changes: 13 additions & 24 deletions android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -54,7 +55,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -64,40 +65,28 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
:omega
Loading
Loading