react-native 0.74.0-rc.4 → 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 (25) hide show
  1. package/Libraries/Core/ReactNativeVersion.js +1 -1
  2. package/React/Base/RCTVersion.m +1 -1
  3. package/ReactAndroid/api/ReactAndroid.api +15 -1
  4. package/ReactAndroid/build.gradle.kts +18 -6
  5. package/ReactAndroid/gradle.properties +1 -1
  6. package/ReactAndroid/hermes-engine/build.gradle.kts +2 -0
  7. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivity.java +4 -0
  8. package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +9 -35
  9. package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +88 -9
  10. package/ReactAndroid/src/main/java/com/facebook/react/ReactHost.kt +8 -0
  11. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +2 -1
  12. package/ReactAndroid/src/main/java/com/facebook/react/fabric/internal/interop/InteropUiBlockListener.kt +8 -2
  13. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  14. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java +64 -0
  15. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java +17 -1
  16. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +1 -1
  17. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  18. package/package.json +8 -8
  19. package/scripts/cocoapods/helpers.rb +4 -0
  20. package/scripts/cocoapods/utils.rb +26 -6
  21. package/scripts/react_native_pods.rb +2 -0
  22. package/sdks/hermesc/osx-bin/hermes +0 -0
  23. package/sdks/hermesc/osx-bin/hermesc +0 -0
  24. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  25. package/template/package.json +5 -5
@@ -17,7 +17,7 @@ const version: $ReadOnly<{
17
17
  major: 0,
18
18
  minor: 74,
19
19
  patch: 0,
20
- prerelease: 'rc.4',
20
+ prerelease: 'rc.5',
21
21
  };
22
22
 
23
23
  module.exports = {version};
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(74),
26
26
  RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"rc.4",
27
+ RCTVersionPrerelease: @"rc.5",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -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
@@ -2516,7 +2527,7 @@ public class com/facebook/react/fabric/FabricSoLoader {
2516
2527
  public static fun staticInit ()V
2517
2528
  }
2518
2529
 
2519
- 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 {
2520
2531
  public static final field ENABLE_FABRIC_LOGS Z
2521
2532
  public static final field ENABLE_FABRIC_PERF_LOGS Z
2522
2533
  public static final field IS_DEVELOPMENT_ENVIRONMENT Z
@@ -3646,12 +3657,15 @@ public class com/facebook/react/runtime/ReactHostImpl : com/facebook/react/React
3646
3657
  public fun getReactQueueConfiguration ()Lcom/facebook/react/bridge/queue/ReactQueueConfiguration;
3647
3658
  public fun onActivityResult (Landroid/app/Activity;IILandroid/content/Intent;)V
3648
3659
  public fun onBackPressed ()Z
3660
+ public fun onConfigurationChanged (Landroid/content/Context;)V
3649
3661
  public fun onHostDestroy ()V
3650
3662
  public fun onHostDestroy (Landroid/app/Activity;)V
3651
3663
  public fun onHostPause ()V
3652
3664
  public fun onHostPause (Landroid/app/Activity;)V
3653
3665
  public fun onHostResume (Landroid/app/Activity;)V
3654
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
3655
3669
  public fun reload (Ljava/lang/String;)Lcom/facebook/react/interfaces/TaskInterface;
3656
3670
  public fun removeBeforeDestroyListener (Lkotlin/jvm/functions/Function0;)V
3657
3671
  public fun removeReactInstanceEventListener (Lcom/facebook/react/ReactInstanceEventListener;)V
@@ -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.4
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;
@@ -81,6 +82,20 @@ public class ReactDelegate {
81
82
  mReactNativeHost = reactNativeHost;
82
83
  }
83
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
+
84
99
  public void onHostResume() {
85
100
  if (ReactFeatureFlags.enableBridgelessArchitecture) {
86
101
  if (mActivity instanceof DefaultHardwareBackBtnHandler) {
@@ -137,6 +152,19 @@ public class ReactDelegate {
137
152
  return false;
138
153
  }
139
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
+
140
168
  public void onActivityResult(
141
169
  int requestCode, int resultCode, Intent data, boolean shouldForwardToReactInstance) {
142
170
  if (ReactFeatureFlags.enableBridgelessArchitecture) {
@@ -150,6 +178,64 @@ public class ReactDelegate {
150
178
  }
151
179
  }
152
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
+
153
239
  public void loadApp() {
154
240
  loadApp(mMainComponentName);
155
241
  }
@@ -196,15 +282,8 @@ public class ReactDelegate {
196
282
  * application.
197
283
  */
198
284
  public boolean shouldShowDevMenuOrReload(int keyCode, KeyEvent event) {
199
- DevSupportManager devSupportManager = null;
200
- if (ReactFeatureFlags.enableBridgelessArchitecture
201
- && mReactHost != null
202
- && mReactHost.getDevSupportManager() != null) {
203
- devSupportManager = mReactHost.getDevSupportManager();
204
- } else if (getReactNativeHost().hasInstance()
205
- && getReactNativeHost().getUseDeveloperSupport()) {
206
- devSupportManager = getReactNativeHost().getReactInstanceManager().getDevSupportManager();
207
- } else {
285
+ DevSupportManager devSupportManager = getDevSupportManager();
286
+ if (devSupportManager == null) {
208
287
  return false;
209
288
  }
210
289
 
@@ -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)
@@ -57,6 +57,7 @@ import com.facebook.react.fabric.events.EventEmitterWrapper;
57
57
  import com.facebook.react.fabric.events.FabricEventEmitter;
58
58
  import com.facebook.react.fabric.internal.interop.InteropUIBlockListener;
59
59
  import com.facebook.react.fabric.interop.UIBlock;
60
+ import com.facebook.react.fabric.interop.UIBlockViewResolver;
60
61
  import com.facebook.react.fabric.mounting.MountItemDispatcher;
61
62
  import com.facebook.react.fabric.mounting.MountingManager;
62
63
  import com.facebook.react.fabric.mounting.SurfaceMountingManager;
@@ -99,7 +100,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
99
100
  */
100
101
  @SuppressLint("MissingNativeLoadLibrary")
101
102
  @DoNotStripAny
102
- public class FabricUIManager implements UIManager, LifecycleEventListener {
103
+ public class FabricUIManager implements UIManager, LifecycleEventListener, UIBlockViewResolver {
103
104
  public static final String TAG = FabricUIManager.class.getSimpleName();
104
105
 
105
106
  // The IS_DEVELOPMENT_ENVIRONMENT variable is used to log extra data when running fabric in a
@@ -37,6 +37,9 @@ internal class InteropUIBlockListener : UIManagerListener {
37
37
  }
38
38
 
39
39
  override fun willMountItems(uiManager: UIManager) {
40
+ if (beforeUIBlocks.isEmpty()) {
41
+ return
42
+ }
40
43
  beforeUIBlocks.forEach {
41
44
  if (uiManager is UIBlockViewResolver) {
42
45
  it.execute(uiManager)
@@ -46,6 +49,9 @@ internal class InteropUIBlockListener : UIManagerListener {
46
49
  }
47
50
 
48
51
  override fun didMountItems(uiManager: UIManager) {
52
+ if (afterUIBlocks.isEmpty()) {
53
+ return
54
+ }
49
55
  afterUIBlocks.forEach {
50
56
  if (uiManager is UIBlockViewResolver) {
51
57
  it.execute(uiManager)
@@ -54,9 +60,9 @@ internal class InteropUIBlockListener : UIManagerListener {
54
60
  afterUIBlocks.clear()
55
61
  }
56
62
 
57
- override fun willDispatchViewUpdates(uiManager: UIManager) = Unit
63
+ override fun didDispatchMountItems(uiManager: UIManager) = didMountItems(uiManager)
58
64
 
59
- override fun didDispatchMountItems(uiManager: UIManager) = Unit
65
+ override fun willDispatchViewUpdates(uiManager: UIManager) = willMountItems(uiManager)
60
66
 
61
67
  override fun didScheduleMountItems(uiManager: UIManager) = Unit
62
68
  }
@@ -18,5 +18,5 @@ public class ReactNativeVersion {
18
18
  "major", 0,
19
19
  "minor", 74,
20
20
  "patch", 0,
21
- "prerelease", "rc.4");
21
+ "prerelease", "rc.5");
22
22
  }
@@ -16,6 +16,8 @@ import static java.lang.Boolean.TRUE;
16
16
  import android.app.Activity;
17
17
  import android.content.Context;
18
18
  import android.content.Intent;
19
+ import android.net.Uri;
20
+ import android.nfc.NfcAdapter;
19
21
  import android.os.Bundle;
20
22
  import androidx.annotation.NonNull;
21
23
  import androidx.annotation.Nullable;
@@ -55,6 +57,7 @@ import com.facebook.react.fabric.FabricUIManager;
55
57
  import com.facebook.react.interfaces.TaskInterface;
56
58
  import com.facebook.react.interfaces.exceptionmanager.ReactJsExceptionHandler;
57
59
  import com.facebook.react.interfaces.fabric.ReactSurface;
60
+ import com.facebook.react.modules.appearance.AppearanceModule;
58
61
  import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
59
62
  import com.facebook.react.modules.core.DeviceEventManagerModule;
60
63
  import com.facebook.react.runtime.internal.bolts.Continuation;
@@ -647,6 +650,67 @@ public class ReactHostImpl implements ReactHost {
647
650
  "Tried to access onActivityResult while context is not ready"));
648
651
  }
649
652
 
653
+ /* To be called when focus has changed for the hosting window. */
654
+ @ThreadConfined(UI)
655
+ @Override
656
+ public void onWindowFocusChange(boolean hasFocus) {
657
+ final String method = "onWindowFocusChange(hasFocus = \"" + hasFocus + "\")";
658
+ log(method);
659
+
660
+ ReactContext currentContext = getCurrentReactContext();
661
+ if (currentContext != null) {
662
+ currentContext.onWindowFocusChange(hasFocus);
663
+ }
664
+ ReactSoftExceptionLogger.logSoftException(
665
+ TAG,
666
+ new ReactNoCrashSoftException(
667
+ "Tried to access onWindowFocusChange while context is not ready"));
668
+ }
669
+
670
+ /* This method will give JS the opportunity to receive intents via Linking.
671
+ *
672
+ * @param intent The incoming intent
673
+ */
674
+ @ThreadConfined(UI)
675
+ @Override
676
+ public void onNewIntent(Intent intent) {
677
+ log("onNewIntent()");
678
+
679
+ ReactContext currentContext = getCurrentReactContext();
680
+ if (currentContext != null) {
681
+ String action = intent.getAction();
682
+ Uri uri = intent.getData();
683
+
684
+ if (uri != null
685
+ && (Intent.ACTION_VIEW.equals(action)
686
+ || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action))) {
687
+ DeviceEventManagerModule deviceEventManagerModule =
688
+ currentContext.getNativeModule(DeviceEventManagerModule.class);
689
+ if (deviceEventManagerModule != null) {
690
+ deviceEventManagerModule.emitNewIntentReceived(uri);
691
+ }
692
+ }
693
+ currentContext.onNewIntent(getCurrentActivity(), intent);
694
+ }
695
+ ReactSoftExceptionLogger.logSoftException(
696
+ TAG,
697
+ new ReactNoCrashSoftException("Tried to access onNewIntent while context is not ready"));
698
+ }
699
+
700
+ @ThreadConfined(UI)
701
+ @Override
702
+ public void onConfigurationChanged(Context updatedContext) {
703
+ ReactContext currentReactContext = getCurrentReactContext();
704
+ if (currentReactContext != null) {
705
+ AppearanceModule appearanceModule =
706
+ currentReactContext.getNativeModule(AppearanceModule.class);
707
+
708
+ if (appearanceModule != null) {
709
+ appearanceModule.onConfigurationChanged(updatedContext);
710
+ }
711
+ }
712
+ }
713
+
650
714
  @Nullable
651
715
  JavaScriptContextHolder getJavaScriptContextHolder() {
652
716
  final ReactInstance reactInstance = mReactInstanceTaskRef.get().getResult();
@@ -53,16 +53,32 @@ public final class ViewManagerRegistry implements ComponentCallbacks2 {
53
53
  * @return the {@link ViewManager} registered to the className received as a parameter
54
54
  */
55
55
  public synchronized ViewManager get(String className) {
56
+ // 1. Try to get the manager without the prefix.
56
57
  ViewManager viewManager = mViewManagers.get(className);
57
58
  if (viewManager != null) {
58
59
  return viewManager;
59
60
  }
61
+
62
+ // 2. Try to get the manager with the RCT prefix.
63
+ String rctViewManagerName = "RCT" + className;
64
+ viewManager = mViewManagers.get(rctViewManagerName);
65
+ if (viewManager != null) {
66
+ return viewManager;
67
+ }
60
68
  if (mViewManagerResolver != null) {
69
+ // 1. Try to get the manager without the prefix.
61
70
  viewManager = getViewManagerFromResolver(className);
62
71
  if (viewManager != null) return viewManager;
72
+
73
+ // 2. Try to get the manager with the RCT prefix.
74
+ viewManager = getViewManagerFromResolver(rctViewManagerName);
75
+ if (viewManager != null) return viewManager;
76
+
63
77
  throw new IllegalViewOperationException(
64
- "ViewManagerResolver returned null for "
78
+ "ViewManagerResolver returned null for either "
65
79
  + className
80
+ + " or "
81
+ + rctViewManagerName
66
82
  + ", existing names are: "
67
83
  + mViewManagerResolver.getViewManagerNames());
68
84
  }
@@ -807,7 +807,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
807
807
  // more information.
808
808
 
809
809
  if (!mScroller.isFinished() && mScroller.getCurrX() != mScroller.getFinalX()) {
810
- int scrollRange = computeHorizontalScrollRange() - getWidth();
810
+ int scrollRange = Math.max(computeHorizontalScrollRange() - getWidth(), 0);
811
811
  if (scrollX >= scrollRange) {
812
812
  mScroller.abortAnimation();
813
813
  scrollX = scrollRange;
@@ -18,7 +18,7 @@ constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 74;
20
20
  int32_t Patch = 0;
21
- std::string_view Prerelease = "rc.4";
21
+ std::string_view Prerelease = "rc.5";
22
22
  } ReactNativeVersion;
23
23
 
24
24
  } // namespace facebook::react
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.74.0-rc.4",
3
+ "version": "0.74.0-rc.5",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -101,13 +101,13 @@
101
101
  "@react-native-community/cli": "13.6.2",
102
102
  "@react-native-community/cli-platform-android": "13.6.2",
103
103
  "@react-native-community/cli-platform-ios": "13.6.2",
104
- "@react-native/assets-registry": "0.74.75",
105
- "@react-native/codegen": "0.74.75",
106
- "@react-native/community-cli-plugin": "0.74.75",
107
- "@react-native/gradle-plugin": "0.74.75",
108
- "@react-native/js-polyfills": "0.74.75",
109
- "@react-native/normalize-colors": "0.74.75",
110
- "@react-native/virtualized-lists": "0.74.75",
104
+ "@react-native/assets-registry": "0.74.76",
105
+ "@react-native/codegen": "0.74.76",
106
+ "@react-native/community-cli-plugin": "0.74.76",
107
+ "@react-native/gradle-plugin": "0.74.76",
108
+ "@react-native/js-polyfills": "0.74.76",
109
+ "@react-native/normalize-colors": "0.74.76",
110
+ "@react-native/virtualized-lists": "0.74.76",
111
111
  "abort-controller": "^3.0.0",
112
112
  "anser": "^1.4.9",
113
113
  "ansi-regex": "^5.0.0",
@@ -41,6 +41,10 @@ module Helpers
41
41
  return '13.4'
42
42
  end
43
43
 
44
+ def self.min_xcode_version_supported
45
+ return '14.3'
46
+ end
47
+
44
48
  def self.folly_config
45
49
  return {
46
50
  :version => '2024.01.01.00',
@@ -407,19 +407,39 @@ class ReactNativePodsUtils
407
407
  def self.is_using_xcode15_0(xcodebuild_manager: Xcodebuild)
408
408
  xcodebuild_version = xcodebuild_manager.version
409
409
 
410
+ if version = self.parse_xcode_version(xcodebuild_version)
411
+ return version["major"] == 15 && version["minor"] == 0
412
+ end
413
+
414
+ return false
415
+ end
416
+
417
+ def self.parse_xcode_version(version_string)
410
418
  # The output of xcodebuild -version is something like
411
419
  # Xcode 15.0
412
420
  # or
413
421
  # Xcode 14.3.1
414
422
  # We want to capture the version digits
415
- regex = /(\d+)\.(\d+)(?:\.(\d+))?/
416
- if match_data = xcodebuild_version.match(regex)
417
- major = match_data[1].to_i
418
- minor = match_data[2].to_i
419
- return major == 15 && minor == 0
423
+ match = version_string.match(/(\d+)\.(\d+)(?:\.(\d+))?/)
424
+ return nil if match.nil?
425
+
426
+ return {"str" => match[0], "major" => match[1].to_i, "minor" => match[2].to_i};
427
+ end
428
+
429
+ def self.check_minimum_required_xcode(xcodebuild_manager: Xcodebuild)
430
+ version = self.parse_xcode_version(xcodebuild_manager.version)
431
+ if (version.nil? || !Gem::Version::correct?(version["str"]))
432
+ Pod::UI.warn "Unexpected XCode version string '#{xcodebuild_manager.version}'"
433
+ return
420
434
  end
421
435
 
422
- return false
436
+ current = version["str"]
437
+ min_required = Helpers::Constants.min_xcode_version_supported
438
+
439
+ if Gem::Version::new(current) < Gem::Version::new(min_required)
440
+ Pod::UI.puts "React Native requires XCode >= #{min_required}. Found #{current}.".red
441
+ raise "Please upgrade XCode"
442
+ end
423
443
  end
424
444
 
425
445
  def self.add_compiler_flag_to_project(installer, flag, configuration: nil)
@@ -80,6 +80,8 @@ def use_react_native! (
80
80
  ENV['APP_PATH'] = app_path
81
81
  ENV['REACT_NATIVE_PATH'] = path
82
82
 
83
+ ReactNativePodsUtils.check_minimum_required_xcode()
84
+
83
85
  # Current target definition is provided by Cocoapods and it refers to the target
84
86
  # that has invoked the `use_react_native!` function.
85
87
  ReactNativePodsUtils.detect_use_frameworks(current_target_definition)
Binary file
Binary file
Binary file
@@ -11,16 +11,16 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "react": "18.2.0",
14
- "react-native": "0.74.0-rc.4"
14
+ "react-native": "0.74.0-rc.5"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@babel/core": "^7.20.0",
18
18
  "@babel/preset-env": "^7.20.0",
19
19
  "@babel/runtime": "^7.20.0",
20
- "@react-native/babel-preset": "0.74.75",
21
- "@react-native/eslint-config": "0.74.75",
22
- "@react-native/metro-config": "0.74.75",
23
- "@react-native/typescript-config": "0.74.75",
20
+ "@react-native/babel-preset": "0.74.76",
21
+ "@react-native/eslint-config": "0.74.76",
22
+ "@react-native/metro-config": "0.74.76",
23
+ "@react-native/typescript-config": "0.74.76",
24
24
  "@types/react": "^18.2.6",
25
25
  "@types/react-test-renderer": "^18.0.0",
26
26
  "babel-jest": "^29.6.3",