Skip to content

Commit 6d13661

Browse files
committed
chore(deps): upate react-native0.66.1 to 0.69.1
1 parent fb1fe83 commit 6d13661

File tree

94 files changed

+8701
-6181
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+8701
-6181
lines changed

example/base/.flowconfig

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ node_modules/react-native/Libraries/polyfills/.*
1111
; Flow doesn't support platforms
1212
.*/Libraries/Utilities/LoadingView.js
1313

14+
.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$
15+
1416
[untyped]
1517
.*/node_modules/@react-native-community/cli/.*/.*
1618

@@ -50,7 +52,6 @@ nonstrict-import=warn
5052
deprecated-type=warn
5153
unsafe-getters-setters=warn
5254
unnecessary-invariant=warn
53-
signature-verification-failure=warn
5455

5556
[strict]
5657
deprecated-type
@@ -62,4 +63,4 @@ untyped-import
6263
untyped-type-import
6364

6465
[version]
65-
^0.158.0
66+
^0.176.3

example/base/.gitattributes

-3
This file was deleted.

example/base/.gitignore

+8-4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ DerivedData
2020
*.hmap
2121
*.ipa
2222
*.xcuserstate
23+
ios/.xcode.env.local
2324

2425
# Android/IntelliJ
2526
#
@@ -28,6 +29,7 @@ build/
2829
.gradle
2930
local.properties
3031
*.iml
32+
*.hprof
3133

3234
# node.js
3335
#
@@ -48,12 +50,14 @@ buck-out/
4850
# For more information about the recommended setup visit:
4951
# https://docs.fastlane.tools/best-practices/source-control/
5052

51-
*/fastlane/report.xml
52-
*/fastlane/Preview.html
53-
*/fastlane/screenshots
53+
**/fastlane/report.xml
54+
**/fastlane/Preview.html
55+
**/fastlane/screenshots
56+
**/fastlane/test_output
5457

5558
# Bundle artifact
5659
*.jsbundle
5760

58-
# CocoaPods
61+
# Ruby / CocoaPods
5962
/ios/Pods/
63+
/vendor/bundle/

example/base/.prettierrc.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
module.exports = {
2+
arrowParens: 'avoid',
3+
bracketSameLine: true,
24
bracketSpacing: false,
3-
jsxBracketSameLine: true,
5+
tabWidth: 2,
46
singleQuote: true,
57
trailingComma: 'all',
68
arrowParens: 'avoid',
9+
printWidth: 160,
710
};

example/base/Gemfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source 'https://rubygems.org'
2+
3+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4+
ruby '2.7.5'
5+
6+
gem 'cocoapods', '~> 1.11', '>= 1.11.2'

example/base/_bundle/config

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUNDLE_PATH: "vendor/bundle"
2+
BUNDLE_FORCE_RUBY_PLATFORM: 1

example/base/_ruby-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.7.5

example/base/android/app/src/debug/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
android:usesCleartextTraffic="true"
99
tools:targetApi="28"
1010
tools:ignore="GoogleAppIndexingWarning">
11-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
11+
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
1212
</application>
1313
</manifest>

example/base/android/app/src/debug/java/com/awesomeproject/ReactNativeFlipper.java renamed to example/base/android/app/src/debug/java/com/helloworld/ReactNativeFlipper.java

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/**
2-
* Copyright (c) Facebook, Inc. and its affiliates.
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
44
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
55
* directory of this source tree.
66
*/
77
package com.awesomeproject;
8-
98
import android.content.Context;
109
import com.facebook.flipper.android.AndroidFlipperClient;
1110
import com.facebook.flipper.android.utils.FlipperUtils;
@@ -19,22 +18,20 @@
1918
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
2019
import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
2120
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
21+
import com.facebook.react.ReactInstanceEventListener;
2222
import com.facebook.react.ReactInstanceManager;
2323
import com.facebook.react.bridge.ReactContext;
2424
import com.facebook.react.modules.network.NetworkingModule;
2525
import okhttp3.OkHttpClient;
26-
2726
public class ReactNativeFlipper {
2827
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
2928
if (FlipperUtils.shouldEnableFlipper(context)) {
3029
final FlipperClient client = AndroidFlipperClient.getInstance(context);
31-
3230
client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
3331
client.addPlugin(new ReactFlipperPlugin());
3432
client.addPlugin(new DatabasesFlipperPlugin(context));
3533
client.addPlugin(new SharedPreferencesFlipperPlugin(context));
3634
client.addPlugin(CrashReporterPlugin.getInstance());
37-
3835
NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
3936
NetworkingModule.setCustomClientBuilder(
4037
new NetworkingModule.CustomClientBuilder() {
@@ -45,13 +42,12 @@ public void apply(OkHttpClient.Builder builder) {
4542
});
4643
client.addPlugin(networkFlipperPlugin);
4744
client.start();
48-
4945
// Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
5046
// Hence we run if after all native modules have been initialized
5147
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
5248
if (reactContext == null) {
5349
reactInstanceManager.addReactInstanceEventListener(
54-
new ReactInstanceManager.ReactInstanceEventListener() {
50+
new ReactInstanceEventListener() {
5551
@Override
5652
public void onReactContextInitialized(ReactContext reactContext) {
5753
reactInstanceManager.removeReactInstanceEventListener(this);
@@ -69,4 +65,4 @@ public void run() {
6965
}
7066
}
7167
}
72-
}
68+
}

example/base/android/app/src/main/AndroidManifest.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
<activity
1414
android:name=".MainActivity"
1515
android:label="@string/app_name"
16-
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
16+
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
1717
android:launchMode="singleTask"
18-
android:windowSoftInputMode="adjustResize">
18+
android:windowSoftInputMode="adjustResize"
19+
android:exported="true">
1920
<intent-filter>
2021
<action android:name="android.intent.action.MAIN" />
2122
<category android:name="android.intent.category.LAUNCHER" />

example/base/android/app/src/main/java/com/awesomeproject/MainActivity.java

-15
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package com.awesomeproject;
2+
3+
import com.facebook.react.ReactActivity;
4+
import com.facebook.react.ReactActivityDelegate;
5+
import com.facebook.react.ReactRootView;
6+
7+
public class MainActivity extends ReactActivity {
8+
9+
/**
10+
* Returns the name of the main component registered from JavaScript. This is used to schedule
11+
* rendering of the component.
12+
*/
13+
@Override
14+
protected String getMainComponentName() {
15+
return "AwesomeProject";
16+
}
17+
18+
/**
19+
* Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
20+
* you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer
21+
* (Paper).
22+
*/
23+
@Override
24+
protected ReactActivityDelegate createReactActivityDelegate() {
25+
return new MainActivityDelegate(this, getMainComponentName());
26+
}
27+
28+
public static class MainActivityDelegate extends ReactActivityDelegate {
29+
public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
30+
super(activity, mainComponentName);
31+
}
32+
33+
@Override
34+
protected ReactRootView createRootView() {
35+
ReactRootView reactRootView = new ReactRootView(getContext());
36+
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
37+
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
38+
return reactRootView;
39+
}
40+
41+
@Override
42+
protected boolean isConcurrentRootEnabled() {
43+
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
44+
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
45+
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
46+
}
47+
}
48+
}

example/base/android/app/src/main/java/com/awesomeproject/MainApplication.java renamed to example/base/android/app/src/main/java/com/helloworld/MainApplication.java

+12-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
import com.facebook.react.ReactInstanceManager;
88
import com.facebook.react.ReactNativeHost;
99
import com.facebook.react.ReactPackage;
10+
import com.facebook.react.config.ReactFeatureFlags;
1011
import com.facebook.soloader.SoLoader;
12+
import com.awesomeproject.newarchitecture.MainApplicationReactNativeHost;
1113
import java.lang.reflect.InvocationTargetException;
1214
import java.util.List;
1315

@@ -35,14 +37,23 @@ protected String getJSMainModuleName() {
3537
}
3638
};
3739

40+
private final ReactNativeHost mNewArchitectureNativeHost =
41+
new MainApplicationReactNativeHost(this);
42+
3843
@Override
3944
public ReactNativeHost getReactNativeHost() {
40-
return mReactNativeHost;
45+
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
46+
return mNewArchitectureNativeHost;
47+
} else {
48+
return mReactNativeHost;
49+
}
4150
}
4251

4352
@Override
4453
public void onCreate() {
4554
super.onCreate();
55+
// If you opted-in for the New Architecture, we enable the TurboModule system
56+
ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
4657
SoLoader.init(this, /* native exopackage */ false);
4758
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
4859
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
package com.awesomeproject.newarchitecture;
2+
3+
import android.app.Application;
4+
import androidx.annotation.NonNull;
5+
import com.facebook.react.PackageList;
6+
import com.facebook.react.ReactInstanceManager;
7+
import com.facebook.react.ReactNativeHost;
8+
import com.facebook.react.ReactPackage;
9+
import com.facebook.react.ReactPackageTurboModuleManagerDelegate;
10+
import com.facebook.react.bridge.JSIModulePackage;
11+
import com.facebook.react.bridge.JSIModuleProvider;
12+
import com.facebook.react.bridge.JSIModuleSpec;
13+
import com.facebook.react.bridge.JSIModuleType;
14+
import com.facebook.react.bridge.JavaScriptContextHolder;
15+
import com.facebook.react.bridge.ReactApplicationContext;
16+
import com.facebook.react.bridge.UIManager;
17+
import com.facebook.react.fabric.ComponentFactory;
18+
import com.facebook.react.fabric.CoreComponentsRegistry;
19+
import com.facebook.react.fabric.FabricJSIModuleProvider;
20+
import com.facebook.react.fabric.ReactNativeConfig;
21+
import com.facebook.react.uimanager.ViewManagerRegistry;
22+
import com.awesomeproject.BuildConfig;
23+
import com.awesomeproject.newarchitecture.components.MainComponentsRegistry;
24+
import com.awesomeproject.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate;
25+
import java.util.ArrayList;
26+
import java.util.List;
27+
28+
/**
29+
* A {@link ReactNativeHost} that helps you load everything needed for the New Architecture, both
30+
* TurboModule delegates and the Fabric Renderer.
31+
*
32+
* <p>Please note that this class is used ONLY if you opt-in for the New Architecture (see the
33+
* `newArchEnabled` property). Is ignored otherwise.
34+
*/
35+
public class MainApplicationReactNativeHost extends ReactNativeHost {
36+
public MainApplicationReactNativeHost(Application application) {
37+
super(application);
38+
}
39+
40+
@Override
41+
public boolean getUseDeveloperSupport() {
42+
return BuildConfig.DEBUG;
43+
}
44+
45+
@Override
46+
protected List<ReactPackage> getPackages() {
47+
List<ReactPackage> packages = new PackageList(this).getPackages();
48+
// Packages that cannot be autolinked yet can be added manually here, for example:
49+
// packages.add(new MyReactNativePackage());
50+
// TurboModules must also be loaded here providing a valid TurboReactPackage implementation:
51+
// packages.add(new TurboReactPackage() { ... });
52+
// If you have custom Fabric Components, their ViewManagers should also be loaded here
53+
// inside a ReactPackage.
54+
return packages;
55+
}
56+
57+
@Override
58+
protected String getJSMainModuleName() {
59+
return "index";
60+
}
61+
62+
@NonNull
63+
@Override
64+
protected ReactPackageTurboModuleManagerDelegate.Builder
65+
getReactPackageTurboModuleManagerDelegateBuilder() {
66+
// Here we provide the ReactPackageTurboModuleManagerDelegate Builder. This is necessary
67+
// for the new architecture and to use TurboModules correctly.
68+
return new MainApplicationTurboModuleManagerDelegate.Builder();
69+
}
70+
71+
@Override
72+
protected JSIModulePackage getJSIModulePackage() {
73+
return new JSIModulePackage() {
74+
@Override
75+
public List<JSIModuleSpec> getJSIModules(
76+
final ReactApplicationContext reactApplicationContext,
77+
final JavaScriptContextHolder jsContext) {
78+
final List<JSIModuleSpec> specs = new ArrayList<>();
79+
80+
// Here we provide a new JSIModuleSpec that will be responsible of providing the
81+
// custom Fabric Components.
82+
specs.add(
83+
new JSIModuleSpec() {
84+
@Override
85+
public JSIModuleType getJSIModuleType() {
86+
return JSIModuleType.UIManager;
87+
}
88+
89+
@Override
90+
public JSIModuleProvider<UIManager> getJSIModuleProvider() {
91+
final ComponentFactory componentFactory = new ComponentFactory();
92+
CoreComponentsRegistry.register(componentFactory);
93+
94+
// Here we register a Components Registry.
95+
// The one that is generated with the template contains no components
96+
// and just provides you the one from React Native core.
97+
MainComponentsRegistry.register(componentFactory);
98+
99+
final ReactInstanceManager reactInstanceManager = getReactInstanceManager();
100+
101+
ViewManagerRegistry viewManagerRegistry =
102+
new ViewManagerRegistry(
103+
reactInstanceManager.getOrCreateViewManagers(reactApplicationContext));
104+
105+
return new FabricJSIModuleProvider(
106+
reactApplicationContext,
107+
componentFactory,
108+
ReactNativeConfig.DEFAULT_CONFIG,
109+
viewManagerRegistry);
110+
}
111+
});
112+
return specs;
113+
}
114+
};
115+
}
116+
}

0 commit comments

Comments
 (0)