react-native 0.72.0-rc.0 → 0.72.0-rc.2

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 (71) hide show
  1. package/Libraries/Components/View/ReactNativeStyleAttributes.js +0 -7
  2. package/Libraries/Core/ReactNativeVersion.js +1 -1
  3. package/Libraries/Core/ReactNativeVersionCheck.js +5 -1
  4. package/Libraries/NativeComponent/BaseViewConfig.android.js +0 -8
  5. package/Libraries/NativeComponent/BaseViewConfig.ios.js +0 -8
  6. package/Libraries/ReactNative/UIManager.js +27 -1
  7. package/Libraries/Renderer/implementations/ReactFabric-dev.js +26 -3
  8. package/Libraries/Renderer/implementations/ReactFabric-prod.js +13 -1
  9. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +13 -1
  10. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +0 -7
  11. package/Libraries/StyleSheet/StyleSheetTypes.js +0 -74
  12. package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +3 -3
  13. package/React/Base/RCTVersion.m +1 -1
  14. package/React/CoreModules/RCTDevMenu.mm +3 -3
  15. package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.mm +1 -1
  16. package/ReactAndroid/gradle.properties +1 -1
  17. package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +40 -1
  18. package/ReactAndroid/src/main/java/com/facebook/react/ReactFragment.java +22 -7
  19. package/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java +10 -0
  20. package/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java +29 -0
  21. package/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManagerListener.java +25 -2
  22. package/ReactAndroid/src/main/java/com/facebook/react/bridge/interop/InteropModuleRegistry.java +56 -0
  23. package/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java +11 -0
  24. package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt +1 -0
  25. package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactActivityDelegate.kt +4 -0
  26. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java +26 -8
  27. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +21 -0
  28. package/ReactAndroid/src/main/java/com/facebook/react/fabric/interop/InteropEvent.java +41 -0
  29. package/ReactAndroid/src/main/java/com/facebook/react/fabric/interop/InteropEventEmitter.java +65 -0
  30. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java +9 -0
  31. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  32. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ThemedReactContext.java +1 -0
  33. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelper.java +32 -0
  34. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/MaintainVisibleScrollPositionHelper.java +19 -0
  35. package/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLetterSpacingSpan.java +4 -0
  36. package/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomStyleSpan.java +4 -0
  37. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextUpdate.java +1 -5
  38. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +190 -134
  39. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +23 -10
  40. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundManager.java +5 -0
  41. package/ReactAndroid/src/main/jni/react/fabric/Binding.cpp +3 -0
  42. package/ReactCommon/React-rncore.podspec +12 -4
  43. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  44. package/ReactCommon/react/config/ReactNativeConfig.cpp +3 -0
  45. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h +4 -1
  46. package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm +49 -2
  47. package/ReactCommon/react/renderer/components/text/ParagraphLayoutManager.cpp +30 -5
  48. package/ReactCommon/react/renderer/components/text/ParagraphLayoutManager.h +12 -0
  49. package/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp +0 -21
  50. package/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp +0 -49
  51. package/ReactCommon/react/renderer/components/view/YogaStylableProps.h +0 -9
  52. package/ReactCommon/react/renderer/core/CoreFeatures.cpp +1 -0
  53. package/ReactCommon/react/renderer/core/CoreFeatures.h +5 -0
  54. package/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.cpp +5 -1
  55. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm +112 -83
  56. package/build.gradle.kts +17 -0
  57. package/gradle.properties +1 -0
  58. package/package.json +8 -8
  59. package/scripts/cocoapods/__tests__/codegen_utils-test.rb +9 -1
  60. package/scripts/cocoapods/__tests__/jsengine-test.rb +6 -2
  61. package/scripts/cocoapods/__tests__/test_utils/podSpy.rb +2 -1
  62. package/scripts/cocoapods/codegen_utils.rb +1 -1
  63. package/scripts/cocoapods/jsengine.rb +6 -1
  64. package/sdks/hermesc/linux64-bin/hermesc +0 -0
  65. package/sdks/hermesc/osx-bin/hermesc +0 -0
  66. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  67. package/settings.gradle.kts +30 -0
  68. package/template/android/app/build.gradle +7 -2
  69. package/template/metro.config.js +7 -13
  70. package/template/package.json +5 -3
  71. package/types/index.d.ts +4 -0
@@ -12,10 +12,33 @@ public interface UIManagerListener {
12
12
  /**
13
13
  * Called right before view updates are dispatched at the end of a batch. This is useful if a
14
14
  * module needs to add UIBlocks to the queue before it is flushed.
15
+ *
16
+ * <p>This is called by Paper only.
15
17
  */
16
18
  void willDispatchViewUpdates(UIManager uiManager);
17
- /* Called right after view updates are dispatched for a frame. */
19
+ /**
20
+ * Called on UIThread right before view updates are executed.
21
+ *
22
+ * <p>This is called by Fabric only.
23
+ */
24
+ void willMountItems(UIManager uiManager);
25
+ /**
26
+ * Called on UIThread right after view updates are executed.
27
+ *
28
+ * <p>This is called by Fabric only.
29
+ */
30
+ void didMountItems(UIManager uiManager);
31
+ /**
32
+ * Called on UIThread right after view updates are dispatched for a frame. Note that this will be
33
+ * called for every frame even if there are no updates.
34
+ *
35
+ * <p>This is called by Fabric only.
36
+ */
18
37
  void didDispatchMountItems(UIManager uiManager);
19
- /* Called right after scheduleMountItems is called in Fabric, after a new tree is committed. */
38
+ /**
39
+ * Called right after scheduleMountItems is called in Fabric, after a new tree is committed.
40
+ *
41
+ * <p>This is called by Fabric only.
42
+ */
20
43
  void didScheduleMountItems(UIManager uiManager);
21
44
  }
@@ -0,0 +1,56 @@
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
+ package com.facebook.react.bridge.interop;
9
+
10
+ import androidx.annotation.Nullable;
11
+ import com.facebook.react.bridge.JavaScriptModule;
12
+ import com.facebook.react.config.ReactFeatureFlags;
13
+ import java.util.HashMap;
14
+
15
+ /**
16
+ * A utility class that takes care of returning {@link JavaScriptModule} which are used for the
17
+ * Fabric Interop Layer. This allows us to override the returned classes once the user is invoking
18
+ * `ReactContext.getJsModule()`.
19
+ *
20
+ * <p>Currently we only support a `RCTEventEmitter` re-implementation, being `InteropEventEmitter`
21
+ * but this class can support other re-implementation in the future.
22
+ */
23
+ public class InteropModuleRegistry {
24
+
25
+ @SuppressWarnings("rawtypes")
26
+ private final HashMap<Class, Object> supportedModules;
27
+
28
+ public InteropModuleRegistry() {
29
+ this.supportedModules = new HashMap<>();
30
+ }
31
+
32
+ public <T extends JavaScriptModule> boolean shouldReturnInteropModule(Class<T> requestedModule) {
33
+ return checkReactFeatureFlagsConditions() && supportedModules.containsKey(requestedModule);
34
+ }
35
+
36
+ @Nullable
37
+ public <T extends JavaScriptModule> T getInteropModule(Class<T> requestedModule) {
38
+ if (checkReactFeatureFlagsConditions()) {
39
+ //noinspection unchecked
40
+ return (T) supportedModules.get(requestedModule);
41
+ } else {
42
+ return null;
43
+ }
44
+ }
45
+
46
+ public <T extends JavaScriptModule> void registerInteropModule(
47
+ Class<T> interopModuleInterface, Object interopModule) {
48
+ if (checkReactFeatureFlagsConditions()) {
49
+ supportedModules.put(interopModuleInterface, interopModule);
50
+ }
51
+ }
52
+
53
+ private boolean checkReactFeatureFlagsConditions() {
54
+ return ReactFeatureFlags.enableFabricRenderer && ReactFeatureFlags.unstable_useFabricInterop;
55
+ }
56
+ }
@@ -34,6 +34,14 @@ public class ReactFeatureFlags {
34
34
  */
35
35
  public static volatile boolean enableFabricRenderer = false;
36
36
 
37
+ /**
38
+ * Should this application enable the Fabric Interop Layer for Android? If yes, the application
39
+ * will behave so that it can accept non-Fabric components and render them on Fabric. This toggle
40
+ * is controlling extra logic such as custom event dispatching that are needed for the Fabric
41
+ * Interop Layer to work correctly.
42
+ */
43
+ public static volatile boolean unstable_useFabricInterop = false;
44
+
37
45
  /**
38
46
  * Feature flag to enable the new bridgeless architecture. Note: Enabling this will force enable
39
47
  * the following flags: `useTurboModules` & `enableFabricRenderer`.
@@ -75,6 +83,9 @@ public class ReactFeatureFlags {
75
83
  /** Feature Flag to enable the pending event queue in fabric before mounting views */
76
84
  public static boolean enableFabricPendingEventQueue = false;
77
85
 
86
+ /** Feature Flag to enable caching mechanism of text measurement at shadow node level */
87
+ public static boolean enableTextMeasureCachePerShadowNode = false;
88
+
78
89
  /**
79
90
  * Feature flag that controls how turbo modules are exposed to JS
80
91
  *
@@ -31,6 +31,7 @@ object DefaultNewArchitectureEntryPoint {
31
31
  ) {
32
32
  ReactFeatureFlags.useTurboModules = turboModulesEnabled
33
33
  ReactFeatureFlags.enableFabricRenderer = fabricEnabled
34
+ ReactFeatureFlags.unstable_useFabricInterop = fabricEnabled
34
35
 
35
36
  this.privateFabricEnabled = fabricEnabled
36
37
  this.privateTurboModulesEnabled = turboModulesEnabled
@@ -7,6 +7,7 @@
7
7
 
8
8
  package com.facebook.react.defaults
9
9
 
10
+ import android.os.Bundle
10
11
  import com.facebook.react.ReactActivity
11
12
  import com.facebook.react.ReactActivityDelegate
12
13
  import com.facebook.react.ReactRootView
@@ -43,4 +44,7 @@ open class DefaultReactActivityDelegate(
43
44
 
44
45
  override fun createRootView(): ReactRootView =
45
46
  ReactRootView(context).apply { setIsFabric(fabricEnabled) }
47
+
48
+ override fun createRootView(bundle: Bundle?): ReactRootView =
49
+ ReactRootView(context).apply { setIsFabric(fabricEnabled) }
46
50
  }
@@ -24,6 +24,7 @@ import android.util.Pair;
24
24
  import android.view.Gravity;
25
25
  import android.view.View;
26
26
  import android.widget.EditText;
27
+ import android.widget.LinearLayout;
27
28
  import android.widget.TextView;
28
29
  import android.widget.Toast;
29
30
  import androidx.annotation.Nullable;
@@ -553,17 +554,30 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
553
554
  return;
554
555
  }
555
556
 
556
- final TextView textView = new TextView(getApplicationContext());
557
- textView.setText("React Native DevMenu (" + getUniqueTag() + ")");
558
- textView.setPadding(0, 50, 0, 0);
559
- textView.setGravity(Gravity.CENTER);
560
- textView.setTextColor(Color.BLACK);
561
- textView.setTextSize(17);
562
- textView.setTypeface(textView.getTypeface(), Typeface.BOLD);
557
+ final LinearLayout header = new LinearLayout(getApplicationContext());
558
+ header.setOrientation(LinearLayout.VERTICAL);
559
+
560
+ final TextView title = new TextView(getApplicationContext());
561
+ title.setText("React Native Dev Menu (" + getUniqueTag() + ")");
562
+ title.setPadding(0, 50, 0, 0);
563
+ title.setGravity(Gravity.CENTER);
564
+ title.setTextColor(Color.DKGRAY);
565
+ title.setTextSize(16);
566
+ title.setTypeface(title.getTypeface(), Typeface.BOLD);
567
+
568
+ final TextView jsExecutorLabel = new TextView(getApplicationContext());
569
+ jsExecutorLabel.setText(getJSExecutorDescription());
570
+ jsExecutorLabel.setPadding(0, 20, 0, 0);
571
+ jsExecutorLabel.setGravity(Gravity.CENTER);
572
+ jsExecutorLabel.setTextColor(Color.GRAY);
573
+ jsExecutorLabel.setTextSize(14);
574
+
575
+ header.addView(title);
576
+ header.addView(jsExecutorLabel);
563
577
 
564
578
  mDevOptionsDialog =
565
579
  new AlertDialog.Builder(context)
566
- .setCustomTitle(textView)
580
+ .setCustomTitle(header)
567
581
  .setItems(
568
582
  options.keySet().toArray(new String[0]),
569
583
  new DialogInterface.OnClickListener() {
@@ -587,6 +601,10 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
587
601
  }
588
602
  }
589
603
 
604
+ private String getJSExecutorDescription() {
605
+ return "Running " + getReactInstanceDevHelper().getJavaScriptExecutorFactory().toString();
606
+ }
607
+
590
608
  /**
591
609
  * {@link ReactInstanceDevCommandsHandler} is responsible for enabling/disabling dev support when
592
610
  * a React view is attached/detached or when application state changes (e.g. the application is
@@ -56,6 +56,7 @@ import com.facebook.react.config.ReactFeatureFlags;
56
56
  import com.facebook.react.fabric.events.EventBeatManager;
57
57
  import com.facebook.react.fabric.events.EventEmitterWrapper;
58
58
  import com.facebook.react.fabric.events.FabricEventEmitter;
59
+ import com.facebook.react.fabric.interop.InteropEventEmitter;
59
60
  import com.facebook.react.fabric.mounting.MountItemDispatcher;
60
61
  import com.facebook.react.fabric.mounting.MountingManager;
61
62
  import com.facebook.react.fabric.mounting.SurfaceMountingManager;
@@ -81,6 +82,7 @@ import com.facebook.react.uimanager.ViewManagerRegistry;
81
82
  import com.facebook.react.uimanager.events.EventCategoryDef;
82
83
  import com.facebook.react.uimanager.events.EventDispatcher;
83
84
  import com.facebook.react.uimanager.events.EventDispatcherImpl;
85
+ import com.facebook.react.uimanager.events.RCTEventEmitter;
84
86
  import com.facebook.react.views.text.TextLayoutManager;
85
87
  import com.facebook.react.views.text.TextLayoutManagerMapBuffer;
86
88
  import java.util.HashMap;
@@ -390,6 +392,11 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
390
392
 
391
393
  ReactMarker.addFabricListener(mDevToolsReactPerfLogger);
392
394
  }
395
+ if (ReactFeatureFlags.unstable_useFabricInterop) {
396
+ InteropEventEmitter interopEventEmitter = new InteropEventEmitter(mReactApplicationContext);
397
+ mReactApplicationContext.internal_registerInteropModule(
398
+ RCTEventEmitter.class, interopEventEmitter);
399
+ }
393
400
  }
394
401
 
395
402
  // This is called on the JS thread (see CatalystInstanceImpl).
@@ -1171,6 +1178,20 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
1171
1178
  }
1172
1179
 
1173
1180
  private class MountItemDispatchListener implements MountItemDispatcher.ItemDispatchListener {
1181
+ @Override
1182
+ public void willMountItems() {
1183
+ for (UIManagerListener listener : mListeners) {
1184
+ listener.willMountItems(FabricUIManager.this);
1185
+ }
1186
+ }
1187
+
1188
+ @Override
1189
+ public void didMountItems() {
1190
+ for (UIManagerListener listener : mListeners) {
1191
+ listener.didMountItems(FabricUIManager.this);
1192
+ }
1193
+ }
1194
+
1174
1195
  @Override
1175
1196
  public void didDispatchMountItems() {
1176
1197
  for (UIManagerListener listener : mListeners) {
@@ -0,0 +1,41 @@
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
+ package com.facebook.react.fabric.interop;
9
+
10
+ import androidx.annotation.Nullable;
11
+ import com.facebook.react.bridge.WritableMap;
12
+ import com.facebook.react.common.annotations.VisibleForTesting;
13
+ import com.facebook.react.uimanager.events.Event;
14
+
15
+ /**
16
+ * An {@link Event} class used by the {@link InteropEventEmitter}. This class is just holding the
17
+ * event name and the data which is received by the `receiveEvent` method and will be passed over
18
+ * the the {@link com.facebook.react.uimanager.events.EventDispatcher}
19
+ */
20
+ class InteropEvent extends Event<InteropEvent> {
21
+
22
+ private final String mName;
23
+ private final WritableMap mEventData;
24
+
25
+ InteropEvent(String name, @Nullable WritableMap eventData, int surfaceId, int viewTag) {
26
+ super(surfaceId, viewTag);
27
+ mName = name;
28
+ mEventData = eventData;
29
+ }
30
+
31
+ @Override
32
+ public String getEventName() {
33
+ return mName;
34
+ }
35
+
36
+ @Override
37
+ @VisibleForTesting
38
+ public WritableMap getEventData() {
39
+ return mEventData;
40
+ }
41
+ }
@@ -0,0 +1,65 @@
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
+ package com.facebook.react.fabric.interop;
9
+
10
+ import androidx.annotation.Nullable;
11
+ import com.facebook.react.bridge.ReactContext;
12
+ import com.facebook.react.bridge.WritableArray;
13
+ import com.facebook.react.bridge.WritableMap;
14
+ import com.facebook.react.common.annotations.VisibleForTesting;
15
+ import com.facebook.react.uimanager.UIManagerHelper;
16
+ import com.facebook.react.uimanager.events.EventDispatcher;
17
+ import com.facebook.react.uimanager.events.RCTEventEmitter;
18
+
19
+ /**
20
+ * A reimplementation of {@link RCTEventEmitter} which is using a {@link EventDispatcher} under the
21
+ * hood.
22
+ *
23
+ * <p>On Fabric, you're supposed to use {@link EventDispatcher} to dispatch events. However, we
24
+ * provide an interop layer for non-Fabric migrated components.
25
+ *
26
+ * <p>This instance will be returned if the user is invoking `context.getJsModule(RCTEventEmitter)
27
+ * and is providing support for the `receiveEvent` method, so that non-Fabric ViewManagers can
28
+ * continue to deliver events also when Fabric is turned on.
29
+ */
30
+ public class InteropEventEmitter implements RCTEventEmitter {
31
+
32
+ private final ReactContext mReactContext;
33
+
34
+ private @Nullable EventDispatcher mEventDispatcherOverride;
35
+
36
+ public InteropEventEmitter(ReactContext reactContext) {
37
+ mReactContext = reactContext;
38
+ }
39
+
40
+ @Override
41
+ public void receiveEvent(int targetReactTag, String eventName, @Nullable WritableMap eventData) {
42
+ EventDispatcher dispatcher;
43
+ if (mEventDispatcherOverride != null) {
44
+ dispatcher = mEventDispatcherOverride;
45
+ } else {
46
+ dispatcher = UIManagerHelper.getEventDispatcherForReactTag(mReactContext, targetReactTag);
47
+ }
48
+ int surfaceId = UIManagerHelper.getSurfaceId(mReactContext);
49
+ if (dispatcher != null) {
50
+ dispatcher.dispatchEvent(new InteropEvent(eventName, eventData, surfaceId, targetReactTag));
51
+ }
52
+ }
53
+
54
+ @Override
55
+ public void receiveTouches(
56
+ String eventName, WritableArray touches, WritableArray changedIndices) {
57
+ throw new UnsupportedOperationException(
58
+ "EventEmitter#receiveTouches is not supported by the Fabric Interop Layer");
59
+ }
60
+
61
+ @VisibleForTesting
62
+ void overrideEventDispatcher(EventDispatcher eventDispatcherOverride) {
63
+ mEventDispatcherOverride = eventDispatcherOverride;
64
+ }
65
+ }
@@ -193,6 +193,8 @@ public class MountItemDispatcher {
193
193
  return false;
194
194
  }
195
195
 
196
+ mItemDispatchListener.willMountItems();
197
+
196
198
  // As an optimization, execute all ViewCommands first
197
199
  // This should be:
198
200
  // 1) Performant: ViewCommands are often a replacement for SetNativeProps, which we've always
@@ -299,6 +301,9 @@ public class MountItemDispatcher {
299
301
  }
300
302
  mBatchedExecutionTime += SystemClock.uptimeMillis() - batchedExecutionStartTime;
301
303
  }
304
+
305
+ mItemDispatchListener.didMountItems();
306
+
302
307
  Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
303
308
 
304
309
  return true;
@@ -415,6 +420,10 @@ public class MountItemDispatcher {
415
420
  }
416
421
 
417
422
  public interface ItemDispatchListener {
423
+ void willMountItems();
424
+
425
+ void didMountItems();
426
+
418
427
  void didDispatchMountItems();
419
428
  }
420
429
  }
@@ -18,5 +18,5 @@ public class ReactNativeVersion {
18
18
  "major", 0,
19
19
  "minor", 72,
20
20
  "patch", 0,
21
- "prerelease", "rc.0");
21
+ "prerelease", "rc.2");
22
22
  }
@@ -50,6 +50,7 @@ public class ThemedReactContext extends ReactContext {
50
50
  if (reactApplicationContext.hasCatalystInstance()) {
51
51
  initializeWithInstance(reactApplicationContext.getCatalystInstance());
52
52
  }
53
+ initializeInteropModules(reactApplicationContext);
53
54
  mReactApplicationContext = reactApplicationContext;
54
55
  mModuleName = moduleName;
55
56
  mSurfaceId = surfaceId;
@@ -10,11 +10,15 @@ package com.facebook.react.uimanager;
10
10
  import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
11
11
 
12
12
  import androidx.annotation.Nullable;
13
+ import androidx.annotation.VisibleForTesting;
13
14
  import com.facebook.react.common.MapBuilder;
15
+ import com.facebook.react.config.ReactFeatureFlags;
14
16
  import com.facebook.systrace.SystraceMessage;
15
17
  import java.util.ArrayList;
18
+ import java.util.HashSet;
16
19
  import java.util.List;
17
20
  import java.util.Map;
21
+ import java.util.Set;
18
22
 
19
23
  /**
20
24
  * Helps generate constants map for {@link UIManagerModule} by collecting and merging constants from
@@ -113,6 +117,13 @@ import java.util.Map;
113
117
 
114
118
  Map viewManagerBubblingEvents = viewManager.getExportedCustomBubblingEventTypeConstants();
115
119
  if (viewManagerBubblingEvents != null) {
120
+
121
+ if (ReactFeatureFlags.enableFabricRenderer && ReactFeatureFlags.unstable_useFabricInterop) {
122
+ // For Fabric, events needs to be fired with a "top" prefix.
123
+ // For the sake of Fabric Interop, here we normalize events adding "top" in their
124
+ // name if the user hasn't provided it.
125
+ normalizeEventTypes(viewManagerBubblingEvents);
126
+ }
116
127
  recursiveMerge(cumulativeBubblingEventTypes, viewManagerBubblingEvents);
117
128
  recursiveMerge(viewManagerBubblingEvents, defaultBubblingEvents);
118
129
  viewManagerConstants.put(BUBBLING_EVENTS_KEY, viewManagerBubblingEvents);
@@ -145,6 +156,27 @@ import java.util.Map;
145
156
  return viewManagerConstants;
146
157
  }
147
158
 
159
+ @VisibleForTesting
160
+ /* package */ static void normalizeEventTypes(Map events) {
161
+ if (events == null) {
162
+ return;
163
+ }
164
+ Set<String> keysToNormalize = new HashSet<>();
165
+ for (Object key : events.keySet()) {
166
+ if (key instanceof String) {
167
+ String keyString = (String) key;
168
+ if (!keyString.startsWith("top")) {
169
+ keysToNormalize.add(keyString);
170
+ }
171
+ }
172
+ }
173
+ for (String oldKey : keysToNormalize) {
174
+ Object value = events.get(oldKey);
175
+ String newKey = "top" + oldKey.substring(0, 1).toUpperCase() + oldKey.substring(1);
176
+ events.put(newKey, value);
177
+ }
178
+ }
179
+
148
180
  /** Merges {@param source} map into {@param dest} map recursively */
149
181
  private static void recursiveMerge(@Nullable Map dest, @Nullable Map source) {
150
182
  if (dest == null || source == null || source.isEmpty()) {
@@ -18,6 +18,7 @@ import com.facebook.react.bridge.UIManager;
18
18
  import com.facebook.react.bridge.UIManagerListener;
19
19
  import com.facebook.react.bridge.UiThreadUtil;
20
20
  import com.facebook.react.uimanager.UIManagerHelper;
21
+ import com.facebook.react.uimanager.common.UIManagerType;
21
22
  import com.facebook.react.uimanager.common.ViewUtil;
22
23
  import com.facebook.react.views.scroll.ReactScrollViewHelper.HasSmoothScroll;
23
24
  import com.facebook.react.views.view.ReactViewGroup;
@@ -89,6 +90,14 @@ public class MaintainVisibleScrollPositionHelper<ScrollViewT extends ViewGroup &
89
90
  * been updated.
90
91
  */
91
92
  public void updateScrollPosition() {
93
+ // On Fabric this will be called internally in `didMountItems`.
94
+ if (ViewUtil.getUIManagerType(mScrollView.getId()) == UIManagerType.FABRIC) {
95
+ return;
96
+ }
97
+ updateScrollPositionInternal();
98
+ }
99
+
100
+ private void updateScrollPositionInternal() {
92
101
  if (mConfig == null || mFirstVisibleView == null || mPrevFirstVisibleFrame == null) {
93
102
  return;
94
103
  }
@@ -169,6 +178,16 @@ public class MaintainVisibleScrollPositionHelper<ScrollViewT extends ViewGroup &
169
178
  });
170
179
  }
171
180
 
181
+ @Override
182
+ public void willMountItems(UIManager uiManager) {
183
+ computeTargetView();
184
+ }
185
+
186
+ @Override
187
+ public void didMountItems(UIManager uiManager) {
188
+ updateScrollPositionInternal();
189
+ }
190
+
172
191
  @Override
173
192
  public void didDispatchMountItems(UIManager uiManager) {
174
193
  // noop
@@ -37,6 +37,10 @@ public class CustomLetterSpacingSpan extends MetricAffectingSpan implements Reac
37
37
  apply(paint);
38
38
  }
39
39
 
40
+ public float getSpacing() {
41
+ return mLetterSpacing;
42
+ }
43
+
40
44
  private void apply(TextPaint paint) {
41
45
  if (!Float.isNaN(mLetterSpacing)) {
42
46
  paint.setLetterSpacing(mLetterSpacing);
@@ -71,6 +71,10 @@ public class CustomStyleSpan extends MetricAffectingSpan implements ReactSpan {
71
71
  return mFontFamily;
72
72
  }
73
73
 
74
+ public @Nullable String getFontFeatureSettings() {
75
+ return mFeatureSettings;
76
+ }
77
+
74
78
  private static void apply(
75
79
  Paint paint,
76
80
  int style,
@@ -31,8 +31,6 @@ public class ReactTextUpdate {
31
31
  private final int mSelectionEnd;
32
32
  private final int mJustificationMode;
33
33
 
34
- public boolean mContainsMultipleFragments;
35
-
36
34
  /**
37
35
  * @deprecated Use a non-deprecated constructor for ReactTextUpdate instead. This one remains
38
36
  * because it's being used by a unit test that isn't currently open source.
@@ -142,13 +140,11 @@ public class ReactTextUpdate {
142
140
  int jsEventCounter,
143
141
  int textAlign,
144
142
  int textBreakStrategy,
145
- int justificationMode,
146
- boolean containsMultipleFragments) {
143
+ int justificationMode) {
147
144
 
148
145
  ReactTextUpdate reactTextUpdate =
149
146
  new ReactTextUpdate(
150
147
  text, jsEventCounter, false, textAlign, textBreakStrategy, justificationMode);
151
- reactTextUpdate.mContainsMultipleFragments = containsMultipleFragments;
152
148
  return reactTextUpdate;
153
149
  }
154
150