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

Upgrade the react native dependency to v0.71.2-alpha.3 #15130

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e95c79e
Initial changes to upgrade the react native dependency to v0.71.2-alp…
priyeshshah11 Feb 14, 2023
1872ad1
upgraded react-native-onyx version to use my (priyeshshah11's) fork
priyeshshah11 Feb 15, 2023
0894618
upgraded react-native version to v0.71.2-alpha-2 & to use react-nativ…
priyeshshah11 Feb 17, 2023
9e34845
Resolve merge conflicts with main
priyeshshah11 Feb 17, 2023
42bd0d8
removed jest preset
priyeshshah11 Feb 17, 2023
01360c7
Updated pusher-js to v7.4.0 & updated build.gradle to fix build issue…
priyeshshah11 Feb 18, 2023
17d4262
Upgraded react-native-onyx to v1.0.38
priyeshshah11 Feb 21, 2023
0c5bd25
Merge branch 'main' of https://github.com/priyeshshah11/App into priy…
priyeshshah11 Feb 24, 2023
dc4c304
Merge branch 'main' of https://github.com/priyeshshah11/App into priy…
priyeshshah11 Feb 26, 2023
a8877de
Putting jest preset back to test breaking tests
priyeshshah11 Mar 1, 2023
9c8b0d6
Merge branch 'main' of https://github.com/priyeshshah11/App into priy…
priyeshshah11 Mar 1, 2023
133b58c
Merge branch 'main' of https://github.com/priyeshshah11/App into priy…
priyeshshah11 Mar 1, 2023
17f37fa
upgraded react-native version to 0.71.2-alpha.3
priyeshshah11 Mar 22, 2023
b355b3c
Merge branch 'main' of https://github.com/priyeshshah11/App into priy…
priyeshshah11 Mar 22, 2023
b62a444
updated podfile
priyeshshah11 Mar 22, 2023
2063018
Merge branch 'main' of https://github.com/priyeshshah11/App into priy…
priyeshshah11 Mar 29, 2023
3336df1
pod update
priyeshshah11 Mar 29, 2023
27d3889
Merge branch 'main' of https://github.com/priyeshshah11/App into priy…
priyeshshah11 Mar 29, 2023
3deb55f
upgraded react-native-community/cameraroll to latest version v5.3.1
priyeshshah11 Mar 31, 2023
ea1e0b3
Merge branch 'main' of https://github.com/priyeshshah11/App into priy…
priyeshshah11 Mar 31, 2023
a13e022
updated cameraroll library source
priyeshshah11 Mar 31, 2023
eb89ec1
testing builds
priyeshshah11 Mar 31, 2023
5342ef5
Merge branch 'main' of https://github.com/priyeshshah11/App into priy…
priyeshshah11 Apr 3, 2023
686eeae
adding ReactNativeFlipper file for internalRelease build version
priyeshshah11 Apr 5, 2023
a99f7c6
Merge branch 'main' of https://github.com/priyeshshah11/App into priy…
priyeshshah11 Apr 5, 2023
25f1f5c
Merge branch 'main' of https://github.com/priyeshshah11/App into priy…
priyeshshah11 Apr 5, 2023
6c83538
commented maintainVisibleContentPosition to fix tests
priyeshshah11 Apr 5, 2023
93e9b62
ran pod update
priyeshshah11 Apr 5, 2023
3407bad
Merge branch 'main' of https://github.com/priyeshshah11/App into priy…
priyeshshah11 Apr 7, 2023
fbe8cba
defaulting numberOfLines in the composer to undefined to fix the comp…
priyeshshah11 Apr 7, 2023
4da4d3a
Merge branch 'main' of https://github.com/priyeshshah11/App into priy…
priyeshshah11 Apr 7, 2023
bdf2820
setting alternateTextMaxLines to undefined on priority page to fix th…
priyeshshah11 Apr 7, 2023
c1540a2
Merge branch 'main' of https://github.com/priyeshshah11/App into priy…
priyeshshah11 Apr 11, 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
288 changes: 68 additions & 220 deletions android/app/build.gradle

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package com.reactnativechat;
package com.expensify.chat;

import android.content.Context;
import com.facebook.flipper.android.AndroidFlipperClient;
Expand All @@ -17,21 +17,23 @@
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
import com.facebook.react.ReactInstanceEventListener;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.modules.network.NetworkingModule;
import okhttp3.OkHttpClient;

/**
* Class responsible of loading Flipper inside your React Native application. This is the debug
* flavor of it. Here you can add your own plugins and customize the Flipper setup.
*/
public class ReactNativeFlipper {
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
if (FlipperUtils.shouldEnableFlipper(context)) {
final FlipperClient client = AndroidFlipperClient.getInstance(context);

client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
client.addPlugin(new ReactFlipperPlugin());
client.addPlugin(new DatabasesFlipperPlugin(context));
client.addPlugin(new SharedPreferencesFlipperPlugin(context));
client.addPlugin(CrashReporterPlugin.getInstance());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package com.expensify.chat;

import android.content.Context;
import com.facebook.react.ReactInstanceManager;

/**
* Class responsible of loading Flipper inside your React Native application. This is the release
* flavor of it so it's empty as we don't want to load Flipper.
*/
public class ReactNativeFlipper {
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
// Do nothing as we don't want to initialize Flipper on Release.
}
}
43 changes: 15 additions & 28 deletions android/app/src/main/java/com/expensify/chat/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import com.expensify.chat.bootsplash.BootSplash;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
import com.facebook.react.defaults.DefaultReactActivityDelegate;

public class MainActivity extends ReactActivity {

Expand All @@ -19,34 +20,20 @@ protected String getMainComponentName() {
}

/**
* Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
* you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer
* (Paper).
*/
* Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link
* DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React
* (aka React 18) with two boolean flags.
*/
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new MainActivityDelegate(this, getMainComponentName());
}

public static class MainActivityDelegate extends ReactActivityDelegate {
public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
super(activity, mainComponentName);
}

@Override
protected ReactRootView createRootView() {
ReactRootView reactRootView = new ReactRootView(getContext());
// If you opted-in for the New Architecture, we enable the Fabric Renderer. New delegate and enabling Fabric in ReactRootView is only required for the new architecture builds.
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
return reactRootView;
}

@Override
protected boolean isConcurrentRootEnabled() {
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
}
return new DefaultReactActivityDelegate(
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
);
}

@Override
Expand All @@ -57,4 +44,4 @@ protected void onCreate(Bundle savedInstanceState) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
}
}
}
66 changes: 22 additions & 44 deletions android/app/src/main/java/com/expensify/chat/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import com.expensify.chat.bootsplash.BootSplashPackage;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.config.ReactFeatureFlags;
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
import com.facebook.react.defaults.DefaultReactNativeHost;
import com.facebook.react.modules.i18nmanager.I18nUtil;
import com.facebook.soloader.SoLoader;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
Expand All @@ -22,9 +22,8 @@
import java.util.List;

public class MainApplication extends MultiDexApplication implements ReactApplication {

private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
new DefaultReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
Expand All @@ -46,20 +45,21 @@ protected List<ReactPackage> getPackages() {
protected String getJSMainModuleName() {
return "index";
}
};

// TODO: Use this to enable new architecture.
// private final ReactNativeHost mNewArchitectureNativeHost =
// new MainApplicationReactNativeHost(this);
private final ReactNativeHost mNewArchitectureNativeHost = null;
@Override
protected boolean isNewArchEnabled() {
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
}

@Override
protected Boolean isHermesEnabled() {
return BuildConfig.IS_HERMES_ENABLED;
}
};

@Override
public ReactNativeHost getReactNativeHost() {
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
return mNewArchitectureNativeHost;
} else {
return mReactNativeHost;
}
return mReactNativeHost;
}

@Override
Expand All @@ -68,11 +68,14 @@ public void onCreate() {

// Use night (dark) mode so native UI defaults to dark theme.
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);

// If you opted-in for the New Architecture, we enable the TurboModule system
ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;

SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
DefaultNewArchitectureEntryPoint.load();
}
ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());

if (BuildConfig.DEBUG) {
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(false);
}
Expand All @@ -95,29 +98,4 @@ public void onCreate() {
e.printStackTrace();
}
}

/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.reactnativechat.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}

This file was deleted.

This file was deleted.

Loading