Skip to content

Commit

Permalink
Merge pull request Expensify#51475 from software-mansion-labs/@wolewi…
Browse files Browse the repository at this point in the history
…cki/rn-76-upgrade

Upgrade to React Native 0.76
  • Loading branch information
mountiny authored Jan 7, 2025
2 parents cf9a023 + 132c2f6 commit 476b8d5
Show file tree
Hide file tree
Showing 86 changed files with 6,555 additions and 5,747 deletions.
3,371 changes: 2,074 additions & 1,297 deletions .github/actions/javascript/authorChecklist/index.js

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions .github/actions/javascript/checkAndroidStatus/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9771,14 +9771,16 @@ function useColors() {
return false;
}

let m;

// Is webkit? http://stackoverflow.com/a/16459606/376773
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
// Is firebug? http://stackoverflow.com/a/398120/376773
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
// Is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
// Double check webkit in userAgent just in case we are in a worker
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
}
Expand Down Expand Up @@ -10407,11 +10409,11 @@ function getDate() {
}

/**
* Invokes `util.format()` with the specified arguments and writes to stderr.
* Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
*/

function log(...args) {
return process.stderr.write(util.format(...args) + '\n');
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n');
}

/**
Expand Down Expand Up @@ -729342,7 +729344,7 @@ var y = d * 365.25;
* @api public
*/

module.exports = function(val, options) {
module.exports = function (val, options) {
options = options || {};
var type = typeof val;
if (type === 'string' && val.length > 0) {
Expand Down
10 changes: 6 additions & 4 deletions .github/actions/javascript/getAndroidRolloutPercentage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5097,14 +5097,16 @@ function useColors() {
return false;
}

let m;

// Is webkit? http://stackoverflow.com/a/16459606/376773
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
// Is firebug? http://stackoverflow.com/a/398120/376773
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
// Is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
// Double check webkit in userAgent just in case we are in a worker
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
}
Expand Down Expand Up @@ -5733,11 +5735,11 @@ function getDate() {
}

/**
* Invokes `util.format()` with the specified arguments and writes to stderr.
* Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
*/

function log(...args) {
return process.stderr.write(util.format(...args) + '\n');
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n');
}

/**
Expand Down Expand Up @@ -724594,7 +724596,7 @@ var y = d * 365.25;
* @api public
*/

module.exports = function(val, options) {
module.exports = function (val, options) {
options = options || {};
var type = typeof val;
if (type === 'string' && val.length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/javascript/proposalPoliceComment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8150,7 +8150,7 @@ var y = d * 365.25;
* @api public
*/

module.exports = function(val, options) {
module.exports = function (val, options) {
options = options || {};
var type = typeof val;
if (type === 'string' && val.length > 0) {
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ruby ">= 3.3.4"

gem "cocoapods", "= 1.15.2"
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
gem 'xcodeproj', '< 1.26.0'
gem "fastlane", "~> 2", ">= 2.222.0"
gem "xcpretty", "~> 0"

Expand Down
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ DEPENDENCIES
cocoapods (= 1.15.2)
fastlane (~> 2, >= 2.222.0)
fastlane-plugin-aws_s3
xcodeproj (< 1.26.0)
xcpretty (~> 0)

RUBY VERSION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.modules.i18nmanager.I18nUtil
import com.facebook.react.soloader.OpenSourceMergedSoMapping
import com.facebook.soloader.SoLoader
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.oblador.performance.RNPerformance
Expand Down Expand Up @@ -63,10 +64,10 @@ class MainApplication : MultiDexApplication(), ReactApplication {
return
}

SoLoader.init(this, /* native exopackage */false)
SoLoader.init(this, OpenSourceMergedSoMapping)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load(bridgelessEnabled = false)
load()
}
if (BuildConfig.DEBUG) {
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.Callback;
import com.facebook.react.uimanager.UIManagerModule;
import com.facebook.react.uimanager.UIBlock;
import com.facebook.react.uimanager.NativeViewHierarchyManager;
import android.content.Context;
import android.view.View;
import android.widget.TextView;
import android.view.inputmethod.InputMethodManager;
import android.util.Log;

public class RNTextInputResetModule extends ReactContextBaseJavaModule {

Expand All @@ -31,13 +25,12 @@ public String getName() {
// https://github.com/facebook/react-native/pull/12462#issuecomment-298812731
@ReactMethod
public void resetKeyboardInput(final int reactTagToReset) {
UIManagerModule uiManager = getReactApplicationContext().getNativeModule(UIManagerModule.class);
uiManager.addUIBlock(new UIBlock() {
reactContext.runOnUiQueueThread(new Runnable() {
@Override
public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) {
public void run() {
InputMethodManager imm = (InputMethodManager) getReactApplicationContext().getBaseContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
View viewToReset = nativeViewHierarchyManager.resolveView(reactTagToReset);
View viewToReset = reactContext.getFabricUIManager().resolveView(reactTagToReset);
imm.restartInput(viewToReset);
}
}
Expand Down
8 changes: 3 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 23
compileSdkVersion = 34
buildToolsVersion = "35.0.0"
minSdkVersion = 24
compileSdkVersion = 35
targetSdkVersion = 34
ndkVersion = "26.1.10909125"

Expand Down Expand Up @@ -42,8 +42,6 @@ allprojects {
configurations.all {
resolutionStrategy {
force 'org.xerial:sqlite-jdbc:3.34.0'
//Fix Investigate App Crash MainActivity.onCreate #35655
force "com.facebook.soloader:soloader:0.10.4+"

eachDependency { dependency ->
if (dependency.requested.group == 'org.bouncycastle') {
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
5 changes: 4 additions & 1 deletion android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
18 changes: 18 additions & 0 deletions config/webpack/webpack.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import dotenv from 'dotenv';
import fs from 'fs';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import path from 'path';
import TerserPlugin from 'terser-webpack-plugin';
import type {Class} from 'type-fest';
import type {Configuration, WebpackPluginInstance} from 'webpack';
import {DefinePlugin, EnvironmentPlugin, IgnorePlugin, ProvidePlugin} from 'webpack';
Expand Down Expand Up @@ -38,7 +39,10 @@ const includeModules = [
'react-native-qrcode-svg',
'react-native-view-shot',
'@react-native/assets',
'expo',
'expo-av',
'expo-image-manipulator',
'expo-modules-core',
].join('|');

const environmentToLogoSuffixMap: Record<string, string> = {
Expand Down Expand Up @@ -283,6 +287,20 @@ const getCommonConfiguration = ({file = '.env', platform = 'web'}: Environment):
},

optimization: {
minimizer: [
// default settings accordint to https://webpack.js.org/configuration/optimization/#optimizationminimizer
// with addition of preserving the class name for ImageManipulator (expo module)
new TerserPlugin({
terserOptions: {
compress: {
passes: 2,
},
// eslint-disable-next-line @typescript-eslint/naming-convention
keep_classnames: /ImageManipulator|ImageModule/,
},
}),
'...',
],
runtimeChunk: 'single',
splitChunks: {
cacheGroups: {
Expand Down
28 changes: 14 additions & 14 deletions ios/NewExpensify.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "$(SRCROOT)/NewExpensify/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1218,7 +1218,7 @@
INFOPLIST_FILE = NotificationServiceExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = NotificationServiceExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1260,7 +1260,7 @@
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "$(SRCROOT)/NewExpensify/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1299,7 +1299,7 @@
DEVELOPMENT_TEAM = 368M544MTT;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT;
INFOPLIST_FILE = NewExpensify/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1383,7 +1383,7 @@
INFOPLIST_FILE = NotificationServiceExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = NotificationServiceExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1469,7 +1469,7 @@
INFOPLIST_FILE = NotificationServiceExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = NotificationServiceExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1556,7 +1556,7 @@
INFOPLIST_FILE = NotificationServiceExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = NotificationServiceExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1637,7 +1637,7 @@
INFOPLIST_FILE = NotificationServiceExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = NotificationServiceExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1716,7 +1716,7 @@
INFOPLIST_FILE = NotificationServiceExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = NotificationServiceExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1796,7 +1796,7 @@
INFOPLIST_FILE = NotificationServiceExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = NotificationServiceExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -2071,7 +2071,7 @@
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "$(SRCROOT)/NewExpensify/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -2220,7 +2220,7 @@
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "$(SRCROOT)/NewExpensify/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -2362,7 +2362,7 @@
DEVELOPMENT_TEAM = 368M544MTT;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT;
INFOPLIST_FILE = NewExpensify/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -2501,7 +2501,7 @@
DEVELOPMENT_TEAM = 368M544MTT;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 368M544MTT;
INFOPLIST_FILE = NewExpensify/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
3 changes: 1 addition & 2 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ end
node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')

# Our min supported iOS version is higher than the default (min_ios_version_supported) to support libraires such as Airship
platform :ios, 14.0
platform :ios, min_ios_version_supported
prepare_react_native_project!


Expand Down
Loading

0 comments on commit 476b8d5

Please sign in to comment.