react-native 0.74.0-rc.3 → 0.74.0-rc.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/Libraries/Core/ReactNativeVersion.js +1 -1
  2. package/Libraries/Core/registerCallableModule.d.ts +16 -0
  3. package/React/Base/RCTBridgeProxy+Cxx.h +20 -0
  4. package/React/Base/RCTBridgeProxy.h +2 -0
  5. package/React/Base/RCTBridgeProxy.mm +15 -0
  6. package/React/Base/RCTVersion.m +1 -1
  7. package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h +7 -0
  8. package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm +17 -2
  9. package/ReactAndroid/api/ReactAndroid.api +57 -1
  10. package/ReactAndroid/build.gradle.kts +18 -6
  11. package/ReactAndroid/gradle.properties +1 -1
  12. package/ReactAndroid/hermes-engine/build.gradle.kts +2 -0
  13. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivity.java +4 -0
  14. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +9 -35
  15. package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +101 -15
  16. package/ReactAndroid/src/main/java/com/facebook/react/ReactHost.kt +8 -0
  17. package/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java +1 -1
  18. package/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java +2 -1
  19. package/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleRegistry.java +2 -2
  20. package/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArrayInterface.java +1 -1
  21. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +2 -1
  22. package/ReactAndroid/src/main/java/com/facebook/react/fabric/internal/interop/InteropUiBlockListener.kt +8 -2
  23. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  24. package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessCatalystInstance.kt +201 -0
  25. package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.java +4 -6
  26. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java +79 -0
  27. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.java +1 -1
  28. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java +17 -1
  29. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +1 -1
  30. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +2 -0
  31. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  32. package/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTImagePrimitivesConversions.h +2 -2
  33. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +8 -6
  34. package/ReactCommon/yoga/yoga/algorithm/AbsoluteLayout.cpp +64 -40
  35. package/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +19 -20
  36. package/package.json +11 -11
  37. package/scripts/cocoapods/helpers.rb +4 -0
  38. package/scripts/cocoapods/utils.rb +26 -6
  39. package/scripts/react_native_pods.rb +2 -0
  40. package/sdks/hermesc/osx-bin/hermes +0 -0
  41. package/sdks/hermesc/osx-bin/hermesc +0 -0
  42. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  43. package/template/package.json +5 -5
  44. package/types/index.d.ts +1 -0
@@ -17,7 +17,7 @@ const version: $ReadOnly<{
17
17
  major: 0,
18
18
  minor: 74,
19
19
  patch: 0,
20
- prerelease: 'rc.3',
20
+ prerelease: 'rc.5',
21
21
  };
22
22
 
23
23
  module.exports = {version};
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @format
8
+ */
9
+
10
+ type Module = Object;
11
+ type RegisterCallableModule = (
12
+ name: string,
13
+ moduleOrFactory: Module | (() => Module),
14
+ ) => void;
15
+
16
+ export const registerCallableModule: RegisterCallableModule;
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #ifdef __cplusplus
9
+ #import <ReactCommon/CallInvoker.h>
10
+ #endif
11
+
12
+ #import "RCTBridgeProxy.h"
13
+
14
+ @interface RCTBridgeProxy (Cxx)
15
+
16
+ #ifdef __cplusplus
17
+ @property (nonatomic, readwrite) std::shared_ptr<facebook::react::CallInvoker> jsCallInvoker;
18
+ #endif
19
+
20
+ @end
@@ -15,6 +15,7 @@
15
15
  @class RCTViewRegistry;
16
16
 
17
17
  @interface RCTBridgeProxy : NSProxy
18
+
18
19
  - (instancetype)initWithViewRegistry:(RCTViewRegistry *)viewRegistry
19
20
  moduleRegistry:(RCTModuleRegistry *)moduleRegistry
20
21
  bundleManager:(RCTBundleManager *)bundleManager
@@ -34,4 +35,5 @@
34
35
  */
35
36
  - (id)moduleForClass:(Class)moduleClass;
36
37
  - (id)moduleForName:(NSString *)moduleName lazilyLoadIfNecessary:(BOOL)lazilyLoad;
38
+
37
39
  @end
@@ -6,10 +6,13 @@
6
6
  */
7
7
 
8
8
  #import "RCTBridgeProxy.h"
9
+ #import "RCTBridgeProxy+Cxx.h"
10
+
9
11
  #import <React/RCTBridge+Private.h>
10
12
  #import <React/RCTBridge.h>
11
13
  #import <React/RCTLog.h>
12
14
  #import <React/RCTUIManager.h>
15
+ #import <ReactCommon/CallInvoker.h>
13
16
  #import <jsi/jsi.h>
14
17
 
15
18
  using namespace facebook;
@@ -21,6 +24,12 @@ using namespace facebook;
21
24
  - (void)forwardInvocation:(NSInvocation *)invocation;
22
25
  @end
23
26
 
27
+ @interface RCTBridgeProxy ()
28
+
29
+ @property (nonatomic, readwrite) std::shared_ptr<facebook::react::CallInvoker> jsCallInvoker;
30
+
31
+ @end
32
+
24
33
  @implementation RCTBridgeProxy {
25
34
  RCTUIManagerProxy *_uiManagerProxy;
26
35
  RCTModuleRegistry *_moduleRegistry;
@@ -84,6 +93,12 @@ using namespace facebook;
84
93
  return _runtime;
85
94
  }
86
95
 
96
+ - (std::shared_ptr<facebook::react::CallInvoker>)jsCallInvoker
97
+ {
98
+ [self logWarning:@"Please migrate to RuntimeExecutor" cmd:_cmd];
99
+ return _jsCallInvoker;
100
+ }
101
+
87
102
  /**
88
103
  * RCTModuleRegistry
89
104
  */
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(74),
26
26
  RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"rc.3",
27
+ RCTVersionPrerelease: @"rc.5",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -56,6 +56,13 @@ NS_ASSUME_NONNULL_BEGIN
56
56
  */
57
57
  @property (nonatomic, copy, nullable) RCTSurfaceHostingViewActivityIndicatorViewFactory activityIndicatorViewFactory;
58
58
 
59
+ /**
60
+ * When set to `YES`, the activity indicator is not automatically hidden when the Surface stage changes.
61
+ * In this scenario, users should invoke `hideActivityIndicator` to remove it.
62
+ *
63
+ * @param disabled: if `YES`, the auto-hide is disabled. Otherwise the loading view will be hidden automatically
64
+ */
65
+ - (void)disableActivityIndicatorAutoHide:(BOOL)disabled;
59
66
  @end
60
67
 
61
68
  NS_ASSUME_NONNULL_END
@@ -24,6 +24,7 @@
24
24
  UIView *_Nullable _activityIndicatorView;
25
25
  UIView *_Nullable _surfaceView;
26
26
  RCTSurfaceStage _stage;
27
+ BOOL _autoHideDisabled;
27
28
  }
28
29
 
29
30
  RCT_NOT_IMPLEMENTED(-(instancetype)init)
@@ -36,6 +37,7 @@ RCT_NOT_IMPLEMENTED(-(nullable instancetype)initWithCoder : (NSCoder *)coder)
36
37
  if (self = [super initWithFrame:CGRectZero]) {
37
38
  _surface = surface;
38
39
  _sizeMeasureMode = sizeMeasureMode;
40
+ _autoHideDisabled = NO;
39
41
 
40
42
  _surface.delegate = self;
41
43
  _stage = surface.stage;
@@ -124,6 +126,10 @@ RCT_NOT_IMPLEMENTED(-(nullable instancetype)initWithCoder : (NSCoder *)coder)
124
126
  _sizeMeasureMode = sizeMeasureMode;
125
127
  [self _invalidateLayout];
126
128
  }
129
+ - (void)disableActivityIndicatorAutoHide:(BOOL)disabled
130
+ {
131
+ _autoHideDisabled = disabled;
132
+ }
127
133
 
128
134
  #pragma mark - isActivityIndicatorViewVisible
129
135
 
@@ -162,7 +168,16 @@ RCT_NOT_IMPLEMENTED(-(nullable instancetype)initWithCoder : (NSCoder *)coder)
162
168
  _surfaceView = _surface.view;
163
169
  _surfaceView.frame = self.bounds;
164
170
  _surfaceView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
165
- [self addSubview:_surfaceView];
171
+ if (_activityIndicatorView && _autoHideDisabled) {
172
+ // The activity indicator is still showing and the surface is set to
173
+ // prevent the auto hide. This means that the application will take care of
174
+ // hiding it when it's ready.
175
+ // Let's add the surfaceView below the activity indicator so it's ready once
176
+ // the activity indicator is hidden.
177
+ [self insertSubview:_surfaceView belowSubview:_activityIndicatorView];
178
+ } else {
179
+ [self addSubview:_surfaceView];
180
+ }
166
181
  } else {
167
182
  [_surfaceView removeFromSuperview];
168
183
  _surfaceView = nil;
@@ -204,7 +219,7 @@ RCT_NOT_IMPLEMENTED(-(nullable instancetype)initWithCoder : (NSCoder *)coder)
204
219
  - (void)_updateViews
205
220
  {
206
221
  self.isSurfaceViewVisible = RCTSurfaceStageIsRunning(_stage);
207
- self.isActivityIndicatorViewVisible = RCTSurfaceStageIsPreparing(_stage);
222
+ self.isActivityIndicatorViewVisible = _autoHideDisabled || RCTSurfaceStageIsPreparing(_stage);
208
223
  }
209
224
 
210
225
  - (void)didMoveToWindow
@@ -83,6 +83,7 @@ public abstract class com/facebook/react/ReactActivity : androidx/appcompat/app/
83
83
  protected fun <init> ()V
84
84
  protected fun createReactActivityDelegate ()Lcom/facebook/react/ReactActivityDelegate;
85
85
  protected fun getMainComponentName ()Ljava/lang/String;
86
+ public fun getReactDelegate ()V
86
87
  protected final fun getReactInstanceManager ()Lcom/facebook/react/ReactInstanceManager;
87
88
  protected final fun getReactNativeHost ()Lcom/facebook/react/ReactNativeHost;
88
89
  public fun invokeDefaultOnBackPressed ()V
@@ -113,6 +114,7 @@ public class com/facebook/react/ReactActivityDelegate {
113
114
  protected fun getLaunchOptions ()Landroid/os/Bundle;
114
115
  public fun getMainComponentName ()Ljava/lang/String;
115
116
  protected fun getPlainActivity ()Landroid/app/Activity;
117
+ protected fun getReactDelegate ()Lcom/facebook/react/ReactDelegate;
116
118
  public fun getReactHost ()Lcom/facebook/react/ReactHost;
117
119
  public fun getReactInstanceManager ()Lcom/facebook/react/ReactInstanceManager;
118
120
  protected fun getReactNativeHost ()Lcom/facebook/react/ReactNativeHost;
@@ -151,9 +153,15 @@ public class com/facebook/react/ReactDelegate {
151
153
  public fun loadApp (Ljava/lang/String;)V
152
154
  public fun onActivityResult (IILandroid/content/Intent;Z)V
153
155
  public fun onBackPressed ()Z
156
+ public fun onConfigurationChanged (Landroid/content/res/Configuration;)V
154
157
  public fun onHostDestroy ()V
155
158
  public fun onHostPause ()V
156
159
  public fun onHostResume ()V
160
+ public fun onKeyDown (ILandroid/view/KeyEvent;)Z
161
+ public fun onKeyLongPress (I)Z
162
+ public fun onNewIntent (Landroid/content/Intent;)Z
163
+ public fun onWindowFocusChanged (Z)V
164
+ public fun reload ()V
157
165
  public fun shouldShowDevMenuOrReload (ILandroid/view/KeyEvent;)Z
158
166
  }
159
167
 
@@ -198,12 +206,15 @@ public abstract interface class com/facebook/react/ReactHost {
198
206
  public abstract fun getReactQueueConfiguration ()Lcom/facebook/react/bridge/queue/ReactQueueConfiguration;
199
207
  public abstract fun onActivityResult (Landroid/app/Activity;IILandroid/content/Intent;)V
200
208
  public abstract fun onBackPressed ()Z
209
+ public abstract fun onConfigurationChanged (Landroid/content/Context;)V
201
210
  public abstract fun onHostDestroy ()V
202
211
  public abstract fun onHostDestroy (Landroid/app/Activity;)V
203
212
  public abstract fun onHostPause ()V
204
213
  public abstract fun onHostPause (Landroid/app/Activity;)V
205
214
  public abstract fun onHostResume (Landroid/app/Activity;)V
206
215
  public abstract fun onHostResume (Landroid/app/Activity;Lcom/facebook/react/modules/core/DefaultHardwareBackBtnHandler;)V
216
+ public abstract fun onNewIntent (Landroid/content/Intent;)V
217
+ public abstract fun onWindowFocusChange (Z)V
207
218
  public abstract fun reload (Ljava/lang/String;)Lcom/facebook/react/interfaces/TaskInterface;
208
219
  public abstract fun removeBeforeDestroyListener (Lkotlin/jvm/functions/Function0;)V
209
220
  public abstract fun setJsEngineResolutionAlgorithm (Lcom/facebook/react/JSEngineResolutionAlgorithm;)V
@@ -950,6 +961,10 @@ public abstract class com/facebook/react/bridge/NativeArray : com/facebook/react
950
961
  public fun toString ()Ljava/lang/String;
951
962
  }
952
963
 
964
+ public abstract interface class com/facebook/react/bridge/NativeArrayInterface {
965
+ public abstract fun toString ()Ljava/lang/String;
966
+ }
967
+
953
968
  public abstract class com/facebook/react/bridge/NativeMap {
954
969
  public fun <init> (Lcom/facebook/jni/HybridData;)V
955
970
  public fun toString ()Ljava/lang/String;
@@ -2512,7 +2527,7 @@ public class com/facebook/react/fabric/FabricSoLoader {
2512
2527
  public static fun staticInit ()V
2513
2528
  }
2514
2529
 
2515
- public class com/facebook/react/fabric/FabricUIManager : com/facebook/react/bridge/LifecycleEventListener, com/facebook/react/bridge/UIManager {
2530
+ public class com/facebook/react/fabric/FabricUIManager : com/facebook/react/bridge/LifecycleEventListener, com/facebook/react/bridge/UIManager, com/facebook/react/fabric/interop/UIBlockViewResolver {
2516
2531
  public static final field ENABLE_FABRIC_LOGS Z
2517
2532
  public static final field ENABLE_FABRIC_PERF_LOGS Z
2518
2533
  public static final field IS_DEVELOPMENT_ENVIRONMENT Z
@@ -3576,6 +3591,43 @@ public abstract class com/facebook/react/runtime/BindingsInstaller {
3576
3591
  public fun <init> (Lcom/facebook/jni/HybridData;)V
3577
3592
  }
3578
3593
 
3594
+ public final class com/facebook/react/runtime/BridgelessCatalystInstance : com/facebook/react/bridge/CatalystInstance {
3595
+ public fun <init> (Lcom/facebook/react/runtime/ReactHostImpl;)V
3596
+ public fun addBridgeIdleDebugListener (Lcom/facebook/react/bridge/NotThreadSafeBridgeIdleDebugListener;)V
3597
+ public fun addJSIModules (Ljava/util/List;)V
3598
+ public fun callFunction (Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/bridge/NativeArray;)V
3599
+ public fun destroy ()V
3600
+ public fun extendNativeModules (Lcom/facebook/react/bridge/NativeModuleRegistry;)V
3601
+ public fun getFabricUIManager ()Lcom/facebook/react/bridge/UIManager;
3602
+ public fun getJSCallInvokerHolder ()Lcom/facebook/react/turbomodule/core/interfaces/CallInvokerHolder;
3603
+ public fun getJSIModule (Lcom/facebook/react/bridge/JSIModuleType;)Lcom/facebook/react/bridge/JSIModule;
3604
+ public fun getJSModule (Ljava/lang/Class;)Lcom/facebook/react/bridge/JavaScriptModule;
3605
+ public fun getJavaScriptContextHolder ()Lcom/facebook/react/bridge/JavaScriptContextHolder;
3606
+ public fun getNativeMethodCallInvokerHolder ()Lcom/facebook/react/turbomodule/core/interfaces/NativeMethodCallInvokerHolder;
3607
+ public fun getNativeModule (Ljava/lang/Class;)Lcom/facebook/react/bridge/NativeModule;
3608
+ public fun getNativeModule (Ljava/lang/String;)Lcom/facebook/react/bridge/NativeModule;
3609
+ public fun getNativeModules ()Ljava/util/Collection;
3610
+ public fun getReactQueueConfiguration ()Lcom/facebook/react/bridge/queue/ReactQueueConfiguration;
3611
+ public fun getRuntimeExecutor ()Lcom/facebook/react/bridge/RuntimeExecutor;
3612
+ public fun getRuntimeScheduler ()Lcom/facebook/react/bridge/RuntimeScheduler;
3613
+ public fun getSourceURL ()Ljava/lang/String;
3614
+ public fun handleMemoryPressure (I)V
3615
+ public fun hasNativeModule (Ljava/lang/Class;)Z
3616
+ public fun hasRunJSBundle ()Z
3617
+ public fun invokeCallback (ILcom/facebook/react/bridge/NativeArrayInterface;)V
3618
+ public fun isDestroyed ()Z
3619
+ public fun loadScriptFromAssets (Landroid/content/res/AssetManager;Ljava/lang/String;Z)V
3620
+ public fun loadScriptFromFile (Ljava/lang/String;Ljava/lang/String;Z)V
3621
+ public fun loadSplitBundleFromFile (Ljava/lang/String;Ljava/lang/String;)V
3622
+ public fun registerSegment (ILjava/lang/String;)V
3623
+ public fun removeBridgeIdleDebugListener (Lcom/facebook/react/bridge/NotThreadSafeBridgeIdleDebugListener;)V
3624
+ public fun runJSBundle ()V
3625
+ public fun setFabricUIManager (Lcom/facebook/react/bridge/UIManager;)V
3626
+ public fun setSourceURLs (Ljava/lang/String;Ljava/lang/String;)V
3627
+ public fun setTurboModuleManager (Lcom/facebook/react/bridge/JSIModule;)V
3628
+ public fun setTurboModuleRegistry (Lcom/facebook/react/internal/turbomodule/core/interfaces/TurboModuleRegistry;)V
3629
+ }
3630
+
3579
3631
  public class com/facebook/react/runtime/CoreReactPackage$$ReactModuleInfoProvider : com/facebook/react/module/model/ReactModuleInfoProvider {
3580
3632
  public fun <init> ()V
3581
3633
  public fun getReactModuleInfos ()Ljava/util/Map;
@@ -3605,12 +3657,15 @@ public class com/facebook/react/runtime/ReactHostImpl : com/facebook/react/React
3605
3657
  public fun getReactQueueConfiguration ()Lcom/facebook/react/bridge/queue/ReactQueueConfiguration;
3606
3658
  public fun onActivityResult (Landroid/app/Activity;IILandroid/content/Intent;)V
3607
3659
  public fun onBackPressed ()Z
3660
+ public fun onConfigurationChanged (Landroid/content/Context;)V
3608
3661
  public fun onHostDestroy ()V
3609
3662
  public fun onHostDestroy (Landroid/app/Activity;)V
3610
3663
  public fun onHostPause ()V
3611
3664
  public fun onHostPause (Landroid/app/Activity;)V
3612
3665
  public fun onHostResume (Landroid/app/Activity;)V
3613
3666
  public fun onHostResume (Landroid/app/Activity;Lcom/facebook/react/modules/core/DefaultHardwareBackBtnHandler;)V
3667
+ public fun onNewIntent (Landroid/content/Intent;)V
3668
+ public fun onWindowFocusChange (Z)V
3614
3669
  public fun reload (Ljava/lang/String;)Lcom/facebook/react/interfaces/TaskInterface;
3615
3670
  public fun removeBeforeDestroyListener (Lkotlin/jvm/functions/Function0;)V
3616
3671
  public fun removeReactInstanceEventListener (Lcom/facebook/react/ReactInstanceEventListener;)V
@@ -7044,6 +7099,7 @@ public class com/facebook/react/views/text/TextAttributeProps : com/facebook/rea
7044
7099
  public static final field TA_KEY_TEXT_SHADOW_OFFSET_DY S
7045
7100
  public static final field TA_KEY_TEXT_SHADOW_RADIUS S
7046
7101
  public static final field TA_KEY_TEXT_TRANSFORM S
7102
+ public static final field UNSET I
7047
7103
  protected field mAccessibilityRole Lcom/facebook/react/uimanager/ReactAccessibilityDelegate$AccessibilityRole;
7048
7104
  protected field mAllowFontScaling Z
7049
7105
  protected field mBackgroundColor I
@@ -127,14 +127,24 @@ val preparePrefab by
127
127
  )),
128
128
  PrefabPreprocessingEntry(
129
129
  "rrc_text",
130
- Pair(
131
- "../ReactCommon/react/renderer/components/text/",
132
- "react/renderer/components/text/")),
130
+ listOf(
131
+ Pair(
132
+ "../ReactCommon/react/renderer/components/text/",
133
+ "react/renderer/components/text/"),
134
+ Pair(
135
+ "../ReactCommon/react/renderer/attributedstring",
136
+ "react/renderer/attributedstring"),
137
+ )),
133
138
  PrefabPreprocessingEntry(
134
139
  "rrc_textinput",
135
- Pair(
136
- "../ReactCommon/react/renderer/components/textinput/",
137
- "react/renderer/components/androidtextinput/")),
140
+ listOf(
141
+ Pair(
142
+ "../ReactCommon/react/renderer/components/textinput/",
143
+ "react/renderer/components/textinput/"),
144
+ Pair(
145
+ "../ReactCommon/react/renderer/components/textinput/platform/android/",
146
+ ""),
147
+ )),
138
148
  PrefabPreprocessingEntry(
139
149
  "rrc_legacyviewmanagerinterop",
140
150
  Pair(
@@ -488,6 +498,8 @@ android {
488
498
  }
489
499
  if (rootProject.hasProperty("ndkVersion") && rootProject.properties["ndkVersion"] != null) {
490
500
  ndkVersion = rootProject.properties["ndkVersion"].toString()
501
+ } else {
502
+ ndkVersion = libs.versions.ndkVersion.get()
491
503
  }
492
504
 
493
505
  compileOptions {
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.74.0-rc.3
1
+ VERSION_NAME=0.74.0-rc.5
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -192,6 +192,8 @@ android {
192
192
  }
193
193
  if (rootProject.hasProperty("ndkVersion") && rootProject.properties["ndkVersion"] != null) {
194
194
  ndkVersion = rootProject.properties["ndkVersion"].toString()
195
+ } else {
196
+ ndkVersion = libs.versions.ndkVersion.get()
195
197
  }
196
198
 
197
199
  defaultConfig {
@@ -65,6 +65,10 @@ public abstract class ReactActivity extends AppCompatActivity
65
65
  mDelegate.onDestroy();
66
66
  }
67
67
 
68
+ public void getReactDelegate() {
69
+ mDelegate.getReactDelegate();
70
+ }
71
+
68
72
  @Override
69
73
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
70
74
  super.onActivityResult(requestCode, resultCode, data);
@@ -88,6 +88,10 @@ public class ReactActivityDelegate {
88
88
  return ((ReactApplication) getPlainActivity().getApplication()).getReactHost();
89
89
  }
90
90
 
91
+ protected @Nullable ReactDelegate getReactDelegate() {
92
+ return mReactDelegate;
93
+ }
94
+
91
95
  public ReactInstanceManager getReactInstanceManager() {
92
96
  return mReactDelegate.getReactInstanceManager();
93
97
  }
@@ -144,15 +148,7 @@ public class ReactActivityDelegate {
144
148
  }
145
149
 
146
150
  public boolean onKeyDown(int keyCode, KeyEvent event) {
147
- if (!ReactFeatureFlags.enableBridgelessArchitecture) {
148
- if (getReactNativeHost().hasInstance()
149
- && getReactNativeHost().getUseDeveloperSupport()
150
- && keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD) {
151
- event.startTracking();
152
- return true;
153
- }
154
- }
155
- return false;
151
+ return mReactDelegate.onKeyDown(keyCode, event);
156
152
  }
157
153
 
158
154
  public boolean onKeyUp(int keyCode, KeyEvent event) {
@@ -160,15 +156,7 @@ public class ReactActivityDelegate {
160
156
  }
161
157
 
162
158
  public boolean onKeyLongPress(int keyCode, KeyEvent event) {
163
- if (!ReactFeatureFlags.enableBridgelessArchitecture) {
164
- if (getReactNativeHost().hasInstance()
165
- && getReactNativeHost().getUseDeveloperSupport()
166
- && keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD) {
167
- getReactNativeHost().getReactInstanceManager().showDevOptionsDialog();
168
- return true;
169
- }
170
- }
171
- return false;
159
+ return mReactDelegate.onKeyLongPress(keyCode);
172
160
  }
173
161
 
174
162
  public boolean onBackPressed() {
@@ -176,29 +164,15 @@ public class ReactActivityDelegate {
176
164
  }
177
165
 
178
166
  public boolean onNewIntent(Intent intent) {
179
- if (!ReactFeatureFlags.enableBridgelessArchitecture) {
180
- if (getReactNativeHost().hasInstance()) {
181
- getReactNativeHost().getReactInstanceManager().onNewIntent(intent);
182
- return true;
183
- }
184
- }
185
- return false;
167
+ return mReactDelegate.onNewIntent(intent);
186
168
  }
187
169
 
188
170
  public void onWindowFocusChanged(boolean hasFocus) {
189
- if (!ReactFeatureFlags.enableBridgelessArchitecture) {
190
- if (getReactNativeHost().hasInstance()) {
191
- getReactNativeHost().getReactInstanceManager().onWindowFocusChange(hasFocus);
192
- }
193
- }
171
+ mReactDelegate.onWindowFocusChanged(hasFocus);
194
172
  }
195
173
 
196
174
  public void onConfigurationChanged(Configuration newConfig) {
197
- if (!ReactFeatureFlags.enableBridgelessArchitecture) {
198
- if (getReactNativeHost().hasInstance()) {
199
- getReactInstanceManager().onConfigurationChanged(getContext(), newConfig);
200
- }
201
- }
175
+ mReactDelegate.onConfigurationChanged(newConfig);
202
176
  }
203
177
 
204
178
  public void requestPermissions(
@@ -9,6 +9,7 @@ package com.facebook.react;
9
9
 
10
10
  import android.app.Activity;
11
11
  import android.content.Intent;
12
+ import android.content.res.Configuration;
12
13
  import android.os.Bundle;
13
14
  import android.view.KeyEvent;
14
15
  import androidx.annotation.NonNull;
@@ -16,6 +17,7 @@ import androidx.annotation.Nullable;
16
17
  import com.facebook.infer.annotation.Assertions;
17
18
  import com.facebook.react.config.ReactFeatureFlags;
18
19
  import com.facebook.react.devsupport.DoubleTapReloadRecognizer;
20
+ import com.facebook.react.devsupport.interfaces.DevSupportManager;
19
21
  import com.facebook.react.interfaces.fabric.ReactSurface;
20
22
  import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
21
23
 
@@ -80,6 +82,20 @@ public class ReactDelegate {
80
82
  mReactNativeHost = reactNativeHost;
81
83
  }
82
84
 
85
+ @Nullable
86
+ private DevSupportManager getDevSupportManager() {
87
+ if (ReactFeatureFlags.enableBridgelessArchitecture
88
+ && mReactHost != null
89
+ && mReactHost.getDevSupportManager() != null) {
90
+ return mReactHost.getDevSupportManager();
91
+ } else if (getReactNativeHost().hasInstance()
92
+ && getReactNativeHost().getUseDeveloperSupport()) {
93
+ return getReactNativeHost().getReactInstanceManager().getDevSupportManager();
94
+ } else {
95
+ return null;
96
+ }
97
+ }
98
+
83
99
  public void onHostResume() {
84
100
  if (ReactFeatureFlags.enableBridgelessArchitecture) {
85
101
  if (mActivity instanceof DefaultHardwareBackBtnHandler) {
@@ -136,6 +152,19 @@ public class ReactDelegate {
136
152
  return false;
137
153
  }
138
154
 
155
+ public boolean onNewIntent(Intent intent) {
156
+ if (ReactFeatureFlags.enableBridgelessArchitecture) {
157
+ mReactHost.onNewIntent(intent);
158
+ return true;
159
+ } else {
160
+ if (getReactNativeHost().hasInstance()) {
161
+ getReactNativeHost().getReactInstanceManager().onNewIntent(intent);
162
+ return true;
163
+ }
164
+ }
165
+ return false;
166
+ }
167
+
139
168
  public void onActivityResult(
140
169
  int requestCode, int resultCode, Intent data, boolean shouldForwardToReactInstance) {
141
170
  if (ReactFeatureFlags.enableBridgelessArchitecture) {
@@ -149,6 +178,64 @@ public class ReactDelegate {
149
178
  }
150
179
  }
151
180
 
181
+ public void onWindowFocusChanged(boolean hasFocus) {
182
+ if (ReactFeatureFlags.enableBridgelessArchitecture) {
183
+ mReactHost.onWindowFocusChange(hasFocus);
184
+ } else {
185
+ if (getReactNativeHost().hasInstance()) {
186
+ getReactNativeHost().getReactInstanceManager().onWindowFocusChange(hasFocus);
187
+ }
188
+ }
189
+ }
190
+
191
+ public void onConfigurationChanged(Configuration newConfig) {
192
+ if (ReactFeatureFlags.enableBridgelessArchitecture) {
193
+ mReactHost.onConfigurationChanged(Assertions.assertNotNull(mActivity));
194
+ } else {
195
+ if (getReactNativeHost().hasInstance()) {
196
+ getReactInstanceManager()
197
+ .onConfigurationChanged(Assertions.assertNotNull(mActivity), newConfig);
198
+ }
199
+ }
200
+ }
201
+
202
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
203
+ if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD
204
+ && ((ReactFeatureFlags.enableBridgelessArchitecture
205
+ && mReactHost != null
206
+ && mReactHost.getDevSupportManager() != null)
207
+ || (getReactNativeHost().hasInstance()
208
+ && getReactNativeHost().getUseDeveloperSupport()))) {
209
+ event.startTracking();
210
+ return true;
211
+ }
212
+ return false;
213
+ }
214
+
215
+ public boolean onKeyLongPress(int keyCode) {
216
+ if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD) {
217
+ if (ReactFeatureFlags.enableBridgelessArchitecture
218
+ && mReactHost != null
219
+ && mReactHost.getDevSupportManager() != null) {
220
+ mReactHost.getDevSupportManager().showDevOptionsDialog();
221
+ return true;
222
+ } else {
223
+ if (getReactNativeHost().hasInstance() && getReactNativeHost().getUseDeveloperSupport()) {
224
+ getReactNativeHost().getReactInstanceManager().showDevOptionsDialog();
225
+ return true;
226
+ }
227
+ }
228
+ }
229
+ return false;
230
+ }
231
+
232
+ public void reload() {
233
+ DevSupportManager devSupportManager = getDevSupportManager();
234
+ if (devSupportManager != null) {
235
+ devSupportManager.handleReloadJS();
236
+ }
237
+ }
238
+
152
239
  public void loadApp() {
153
240
  loadApp(mMainComponentName);
154
241
  }
@@ -195,22 +282,21 @@ public class ReactDelegate {
195
282
  * application.
196
283
  */
197
284
  public boolean shouldShowDevMenuOrReload(int keyCode, KeyEvent event) {
198
- if (ReactFeatureFlags.enableBridgelessArchitecture) {
199
- // TODO T156475655: Implement shouldShowDevMenuOrReload for Bridgeless
285
+ DevSupportManager devSupportManager = getDevSupportManager();
286
+ if (devSupportManager == null) {
200
287
  return false;
201
- } else if (getReactNativeHost().hasInstance()
202
- && getReactNativeHost().getUseDeveloperSupport()) {
203
- if (keyCode == KeyEvent.KEYCODE_MENU) {
204
- getReactNativeHost().getReactInstanceManager().showDevOptionsDialog();
205
- return true;
206
- }
207
- boolean didDoubleTapR =
208
- Assertions.assertNotNull(mDoubleTapReloadRecognizer)
209
- .didDoubleTapR(keyCode, mActivity.getCurrentFocus());
210
- if (didDoubleTapR) {
211
- getReactNativeHost().getReactInstanceManager().getDevSupportManager().handleReloadJS();
212
- return true;
213
- }
288
+ }
289
+
290
+ if (keyCode == KeyEvent.KEYCODE_MENU) {
291
+ devSupportManager.showDevOptionsDialog();
292
+ return true;
293
+ }
294
+ boolean didDoubleTapR =
295
+ Assertions.assertNotNull(mDoubleTapReloadRecognizer)
296
+ .didDoubleTapR(keyCode, mActivity.getCurrentFocus());
297
+ if (didDoubleTapR) {
298
+ devSupportManager.handleReloadJS();
299
+ return true;
214
300
  }
215
301
  return false;
216
302
  }
@@ -120,6 +120,14 @@ public interface ReactHost {
120
120
  data: Intent?,
121
121
  )
122
122
 
123
+ /* To be called when focus has changed for the hosting window. */
124
+ public fun onWindowFocusChange(hasFocus: Boolean)
125
+
126
+ /* This method will give JS the opportunity to receive intents via Linking. */
127
+ public fun onNewIntent(intent: Intent)
128
+
129
+ public fun onConfigurationChanged(context: Context)
130
+
123
131
  public fun addBeforeDestroyListener(onBeforeDestroy: () -> Unit)
124
132
 
125
133
  public fun removeBeforeDestroyListener(onBeforeDestroy: () -> Unit)
@@ -120,7 +120,7 @@ public interface CatalystInstance
120
120
  RuntimeScheduler getRuntimeScheduler();
121
121
 
122
122
  @Deprecated
123
- void addJSIModules(List<JSIModuleSpec> jsiModules);
123
+ <T extends JSIModule> void addJSIModules(List<JSIModuleSpec<T>> jsiModules);
124
124
 
125
125
  /**
126
126
  * Returns a hybrid object that contains a pointer to a JS CallInvoker, which is used to schedule
@@ -537,7 +537,8 @@ public class CatalystInstanceImpl implements CatalystInstance {
537
537
  public native RuntimeScheduler getRuntimeScheduler();
538
538
 
539
539
  @Override
540
- public void addJSIModules(List<JSIModuleSpec> jsiModules) {
540
+ @Deprecated
541
+ public <T extends JSIModule> void addJSIModules(List<JSIModuleSpec<T>> jsiModules) {
541
542
  mJSIModuleRegistry.registerModules(jsiModules);
542
543
  }
543
544