react-native 0.73.0-rc.1 → 0.73.0-rc.3
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.
- package/Libraries/AppDelegate/RCTAppDelegate.mm +1 -1
- package/Libraries/AppDelegate/React-RCTAppDelegate.podspec +6 -2
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/LogBox/Data/LogBoxData.js +2 -1
- package/Libraries/NativeComponent/NativeComponentRegistry.js +10 -4
- package/Libraries/promiseRejectionTrackingOptions.js +21 -7
- package/React/Base/RCTBridgeProxy.mm +11 -3
- package/React/Base/RCTConstants.h +1 -1
- package/React/Base/RCTConstants.m +1 -1
- package/React/Base/RCTVersion.m +1 -1
- package/React/Base/Surface/RCTSurfaceRootShadowView.h +1 -1
- package/React/Base/Surface/RCTSurfaceRootShadowView.m +1 -1
- package/React/CoreModules/RCTDeviceInfo.mm +1 -1
- package/React/CoreModules/React-CoreModules.podspec +1 -1
- package/React/Modules/RCTUIManager.h +7 -0
- package/React/Modules/RCTUIManager.m +1 -1
- package/React/UIUtils/RCTUIUtils.h +1 -1
- package/React/Views/RCTComponentData.m +1 -1
- package/React/Views/RCTLayout.h +1 -1
- package/React/Views/RCTRootShadowView.h +1 -1
- package/React/Views/RCTRootShadowView.m +1 -1
- package/React/Views/RCTShadowView.m +1 -1
- package/React/Views/ScrollView/RCTScrollView.m +1 -1
- package/React/Views/UIView+React.m +30 -23
- package/React-Core.podspec +1 -1
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +0 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactApplication.kt +0 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +0 -1
- package/ReactAndroid/src/main/java/com/facebook/react/{interfaces/ReactHost.kt → ReactHost.kt} +2 -3
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/common/annotations/UnstableReactNativeAPI.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHost.kt +58 -8
- package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactNativeHost.kt +16 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/devloading/DevLoadingModule.java +3 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.java +8 -0
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/CoreReactPackage.java +5 -0
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java +5 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/FabricViewStateManager.java +95 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNodeImpl.java +25 -6
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java +33 -23
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/hermes/executor/HermesExecutorFactory.cpp +10 -7
- package/ReactCommon/react/bridging/Object.h +1 -1
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm +8 -0
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h +3 -1
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm +42 -10
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +17 -17
- package/gradle/libs.versions.toml +1 -1
- package/package.json +4 -4
- package/scripts/cocoapods/utils.rb +4 -23
- package/scripts/codegen/generate-legacy-interop-components.js +8 -2
- package/sdks/hermes-engine/hermes-engine.podspec +7 -1
- package/sdks/hermes-engine/hermes-utils.rb +9 -6
- package/sdks/hermes-engine/utils/replace_hermes_version.js +8 -8
- package/sdks/hermesc/osx-bin/hermes +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/template/Gemfile +2 -1
- package/template/android/app/build.gradle +1 -1
- package/template/android/app/src/main/java/com/helloworld/MainApplication.kt +3 -10
- package/template/index.js +0 -9
- package/template/package.json +1 -1
- package/third-party-podspecs/glog.podspec +14 -1
|
@@ -22,6 +22,7 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
|
|
22
22
|
import com.facebook.react.bridge.ReactNoCrashBridgeNotAllowedSoftException;
|
|
23
23
|
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
|
24
24
|
import com.facebook.react.bridge.WritableNativeArray;
|
|
25
|
+
import com.facebook.react.config.ReactFeatureFlags;
|
|
25
26
|
import com.facebook.react.devsupport.interfaces.DevSupportManager;
|
|
26
27
|
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
|
|
27
28
|
import com.facebook.react.uimanager.events.EventDispatcher;
|
|
@@ -49,6 +50,9 @@ class BridgelessReactContext extends ReactApplicationContext implements EventDis
|
|
|
49
50
|
BridgelessReactContext(Context context, ReactHostImpl host) {
|
|
50
51
|
super(context);
|
|
51
52
|
mReactHost = host;
|
|
53
|
+
if (ReactFeatureFlags.unstable_useFabricInterop) {
|
|
54
|
+
initializeInteropModules();
|
|
55
|
+
}
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
@Override
|
|
@@ -124,6 +128,10 @@ class BridgelessReactContext extends ReactApplicationContext implements EventDis
|
|
|
124
128
|
|
|
125
129
|
@Override
|
|
126
130
|
public <T extends JavaScriptModule> T getJSModule(Class<T> jsInterface) {
|
|
131
|
+
if (mInteropModuleRegistry != null
|
|
132
|
+
&& mInteropModuleRegistry.shouldReturnInteropModule(jsInterface)) {
|
|
133
|
+
return mInteropModuleRegistry.getInteropModule(jsInterface);
|
|
134
|
+
}
|
|
127
135
|
JavaScriptModule interfaceProxy =
|
|
128
136
|
(JavaScriptModule)
|
|
129
137
|
Proxy.newProxyInstance(
|
|
@@ -19,6 +19,7 @@ import com.facebook.react.module.model.ReactModuleInfo;
|
|
|
19
19
|
import com.facebook.react.module.model.ReactModuleInfoProvider;
|
|
20
20
|
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
|
|
21
21
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
22
|
+
import com.facebook.react.modules.core.ExceptionsManagerModule;
|
|
22
23
|
import com.facebook.react.modules.debug.DevSettingsModule;
|
|
23
24
|
import com.facebook.react.modules.debug.SourceCodeModule;
|
|
24
25
|
import com.facebook.react.modules.deviceinfo.DeviceInfoModule;
|
|
@@ -36,6 +37,7 @@ import java.util.Map;
|
|
|
36
37
|
SourceCodeModule.class,
|
|
37
38
|
LogBoxModule.class,
|
|
38
39
|
DeviceEventManagerModule.class,
|
|
40
|
+
ExceptionsManagerModule.class,
|
|
39
41
|
})
|
|
40
42
|
class CoreReactPackage extends TurboReactPackage {
|
|
41
43
|
|
|
@@ -63,6 +65,8 @@ class CoreReactPackage extends TurboReactPackage {
|
|
|
63
65
|
return new DeviceEventManagerModule(reactContext, mHardwareBackBtnHandler);
|
|
64
66
|
case LogBoxModule.NAME:
|
|
65
67
|
return new LogBoxModule(reactContext, mDevSupportManager);
|
|
68
|
+
case ExceptionsManagerModule.NAME:
|
|
69
|
+
return new ExceptionsManagerModule(mDevSupportManager);
|
|
66
70
|
default:
|
|
67
71
|
throw new IllegalArgumentException(
|
|
68
72
|
"In BridgelessReactPackage, could not find Native module for " + name);
|
|
@@ -85,6 +89,7 @@ class CoreReactPackage extends TurboReactPackage {
|
|
|
85
89
|
DevSettingsModule.class,
|
|
86
90
|
DeviceEventManagerModule.class,
|
|
87
91
|
LogBoxModule.class,
|
|
92
|
+
ExceptionsManagerModule.class,
|
|
88
93
|
};
|
|
89
94
|
final Map<String, ReactModuleInfo> reactModuleInfoMap = new HashMap<>();
|
|
90
95
|
for (Class<? extends NativeModule> moduleClass : moduleList) {
|
|
@@ -25,6 +25,7 @@ import com.facebook.infer.annotation.ThreadConfined;
|
|
|
25
25
|
import com.facebook.infer.annotation.ThreadSafe;
|
|
26
26
|
import com.facebook.react.JSEngineResolutionAlgorithm;
|
|
27
27
|
import com.facebook.react.MemoryPressureRouter;
|
|
28
|
+
import com.facebook.react.ReactHost;
|
|
28
29
|
import com.facebook.react.ReactInstanceEventListener;
|
|
29
30
|
import com.facebook.react.bridge.Callback;
|
|
30
31
|
import com.facebook.react.bridge.JSBundleLoader;
|
|
@@ -48,7 +49,6 @@ import com.facebook.react.devsupport.DisabledDevSupportManager;
|
|
|
48
49
|
import com.facebook.react.devsupport.interfaces.DevSupportManager;
|
|
49
50
|
import com.facebook.react.fabric.ComponentFactory;
|
|
50
51
|
import com.facebook.react.fabric.FabricUIManager;
|
|
51
|
-
import com.facebook.react.interfaces.ReactHost;
|
|
52
52
|
import com.facebook.react.interfaces.TaskInterface;
|
|
53
53
|
import com.facebook.react.interfaces.exceptionmanager.ReactJsExceptionHandler;
|
|
54
54
|
import com.facebook.react.interfaces.fabric.ReactSurface;
|
|
@@ -26,6 +26,7 @@ import com.facebook.react.modules.blob.BlobModule;
|
|
|
26
26
|
import com.facebook.react.modules.blob.FileReaderModule;
|
|
27
27
|
import com.facebook.react.modules.camera.ImageStoreManager;
|
|
28
28
|
import com.facebook.react.modules.clipboard.ClipboardModule;
|
|
29
|
+
import com.facebook.react.modules.devloading.DevLoadingModule;
|
|
29
30
|
import com.facebook.react.modules.devtoolssettings.DevToolsSettingsManagerModule;
|
|
30
31
|
import com.facebook.react.modules.dialog.DialogModule;
|
|
31
32
|
import com.facebook.react.modules.fresco.FrescoModule;
|
|
@@ -73,6 +74,7 @@ import javax.inject.Provider;
|
|
|
73
74
|
AppearanceModule.class,
|
|
74
75
|
AppStateModule.class,
|
|
75
76
|
BlobModule.class,
|
|
77
|
+
DevLoadingModule.class,
|
|
76
78
|
FileReaderModule.class,
|
|
77
79
|
ClipboardModule.class,
|
|
78
80
|
DialogModule.class,
|
|
@@ -114,6 +116,8 @@ public class MainReactPackage extends TurboReactPackage implements ViewManagerOn
|
|
|
114
116
|
return new AppStateModule(context);
|
|
115
117
|
case BlobModule.NAME:
|
|
116
118
|
return new BlobModule(context);
|
|
119
|
+
case DevLoadingModule.NAME:
|
|
120
|
+
return new DevLoadingModule(context);
|
|
117
121
|
case FileReaderModule.NAME:
|
|
118
122
|
return new FileReaderModule(context);
|
|
119
123
|
case ClipboardModule.NAME:
|
|
@@ -260,6 +264,7 @@ public class MainReactPackage extends TurboReactPackage implements ViewManagerOn
|
|
|
260
264
|
AppearanceModule.class,
|
|
261
265
|
AppStateModule.class,
|
|
262
266
|
BlobModule.class,
|
|
267
|
+
DevLoadingModule.class,
|
|
263
268
|
FileReaderModule.class,
|
|
264
269
|
ClipboardModule.class,
|
|
265
270
|
DialogModule.class,
|
|
@@ -0,0 +1,95 @@
|
|
|
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.uimanager;
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Nullable;
|
|
11
|
+
import com.facebook.common.logging.FLog;
|
|
12
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
13
|
+
import com.facebook.react.bridge.WritableMap;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* This is a helper base class for ViewGroups that use Fabric State.
|
|
17
|
+
*
|
|
18
|
+
* <p>Reason to use this: UpdateState calls from the View layer to the Fabric core can fail, and
|
|
19
|
+
* optionally Fabric will call a "failure callback" if that happens. This class abstracts that and
|
|
20
|
+
* makes it easier ensure that State in Fabric is always up-to-date.
|
|
21
|
+
*
|
|
22
|
+
* <p>1. Whenever ViewManager.updateState is called, call View.setStateWrapper. 2. Instead of
|
|
23
|
+
* calling StateWrapper.updateState directly, call View.setState and it will automatically keep
|
|
24
|
+
* retrying the UpdateState call until it succeeds; or you call setState again; or the View layer is
|
|
25
|
+
* updated with a newer StateWrapper.
|
|
26
|
+
*/
|
|
27
|
+
@Deprecated(
|
|
28
|
+
since =
|
|
29
|
+
"Deprecated class since v0.73.0, please use com.facebook.react.uimanager.StateWrapper instead.",
|
|
30
|
+
forRemoval = true)
|
|
31
|
+
public class FabricViewStateManager {
|
|
32
|
+
private static final String TAG = "FabricViewStateManager";
|
|
33
|
+
|
|
34
|
+
@Deprecated
|
|
35
|
+
public interface HasFabricViewStateManager {
|
|
36
|
+
FabricViewStateManager getFabricViewStateManager();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@Deprecated
|
|
40
|
+
public interface StateUpdateCallback {
|
|
41
|
+
WritableMap getStateUpdate();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@Nullable private StateWrapper mStateWrapper = null;
|
|
45
|
+
|
|
46
|
+
@Deprecated
|
|
47
|
+
public void setStateWrapper(StateWrapper stateWrapper) {
|
|
48
|
+
mStateWrapper = stateWrapper;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@Deprecated
|
|
52
|
+
public boolean hasStateWrapper() {
|
|
53
|
+
return mStateWrapper != null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private void setState(
|
|
57
|
+
@Nullable final StateWrapper stateWrapper,
|
|
58
|
+
final StateUpdateCallback stateUpdateCallback,
|
|
59
|
+
final int numTries) {
|
|
60
|
+
// The StateWrapper will change, breaking the async loop, whenever the UpdateState MountItem
|
|
61
|
+
// is executed.
|
|
62
|
+
// The caller is responsible for detecting if data is up-to-date, and doing nothing, or
|
|
63
|
+
// detecting if state is stale and calling setState again.
|
|
64
|
+
if (stateWrapper == null) {
|
|
65
|
+
FLog.e(TAG, "setState called without a StateWrapper");
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (stateWrapper != mStateWrapper) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
// We bail out after an arbitrary number of tries. In practice this should never go higher
|
|
72
|
+
// than 2 or 3, but there's nothing guaranteeing that.
|
|
73
|
+
if (numTries > 60) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@Nullable WritableMap stateUpdate = stateUpdateCallback.getStateUpdate();
|
|
78
|
+
if (stateUpdate == null) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// TODO: State update cannot fail; remove `failureRunnable` and custom retrying logic.
|
|
83
|
+
stateWrapper.updateState(stateUpdate);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@Deprecated
|
|
87
|
+
public void setState(final StateUpdateCallback stateUpdateCallback) {
|
|
88
|
+
setState(mStateWrapper, stateUpdateCallback, 0);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@Deprecated
|
|
92
|
+
public @Nullable ReadableMap getStateData() {
|
|
93
|
+
return mStateWrapper != null ? mStateWrapper.getStateData() : null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -123,9 +123,9 @@ public interface ReactShadowNode<T extends ReactShadowNode> {
|
|
|
123
123
|
*/
|
|
124
124
|
void onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue);
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
/* package */ boolean dispatchUpdatesWillChangeLayout(float absoluteX, float absoluteY);
|
|
127
127
|
|
|
128
|
-
/* package */
|
|
128
|
+
/* package */ void dispatchUpdates(
|
|
129
129
|
float absoluteX,
|
|
130
130
|
float absoluteY,
|
|
131
131
|
UIViewOperationQueue uiViewOperationQueue,
|
|
@@ -337,9 +337,32 @@ public class ReactShadowNodeImpl implements ReactShadowNode<ReactShadowNodeImpl>
|
|
|
337
337
|
@Override
|
|
338
338
|
public void onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue) {}
|
|
339
339
|
|
|
340
|
-
/** @return true if layout (position or dimensions) changed, false otherwise. */
|
|
341
340
|
@Override
|
|
342
|
-
public boolean
|
|
341
|
+
public boolean dispatchUpdatesWillChangeLayout(float absoluteX, float absoluteY) {
|
|
342
|
+
if (!hasNewLayout()) {
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
float layoutX = getLayoutX();
|
|
347
|
+
float layoutY = getLayoutY();
|
|
348
|
+
int newAbsoluteLeft = Math.round(absoluteX + layoutX);
|
|
349
|
+
int newAbsoluteTop = Math.round(absoluteY + layoutY);
|
|
350
|
+
int newAbsoluteRight = Math.round(absoluteX + layoutX + getLayoutWidth());
|
|
351
|
+
int newAbsoluteBottom = Math.round(absoluteY + layoutY + getLayoutHeight());
|
|
352
|
+
|
|
353
|
+
int newScreenX = Math.round(layoutX);
|
|
354
|
+
int newScreenY = Math.round(layoutY);
|
|
355
|
+
int newScreenWidth = newAbsoluteRight - newAbsoluteLeft;
|
|
356
|
+
int newScreenHeight = newAbsoluteBottom - newAbsoluteTop;
|
|
357
|
+
|
|
358
|
+
return newScreenX != mScreenX
|
|
359
|
+
|| newScreenY != mScreenY
|
|
360
|
+
|| newScreenWidth != mScreenWidth
|
|
361
|
+
|| newScreenHeight != mScreenHeight;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
@Override
|
|
365
|
+
public void dispatchUpdates(
|
|
343
366
|
float absoluteX,
|
|
344
367
|
float absoluteY,
|
|
345
368
|
UIViewOperationQueue uiViewOperationQueue,
|
|
@@ -386,10 +409,6 @@ public class ReactShadowNodeImpl implements ReactShadowNode<ReactShadowNodeImpl>
|
|
|
386
409
|
getScreenHeight());
|
|
387
410
|
}
|
|
388
411
|
}
|
|
389
|
-
|
|
390
|
-
return layoutHasChanged;
|
|
391
|
-
} else {
|
|
392
|
-
return false;
|
|
393
412
|
}
|
|
394
413
|
}
|
|
395
414
|
|
|
@@ -29,7 +29,9 @@ import com.facebook.systrace.Systrace;
|
|
|
29
29
|
import com.facebook.systrace.SystraceMessage;
|
|
30
30
|
import com.facebook.yoga.YogaConstants;
|
|
31
31
|
import com.facebook.yoga.YogaDirection;
|
|
32
|
+
import java.util.ArrayList;
|
|
32
33
|
import java.util.Arrays;
|
|
34
|
+
import java.util.List;
|
|
33
35
|
import java.util.Map;
|
|
34
36
|
|
|
35
37
|
/**
|
|
@@ -665,7 +667,20 @@ public class UIImplementation {
|
|
|
665
667
|
.arg("rootTag", cssRoot.getReactTag())
|
|
666
668
|
.flush();
|
|
667
669
|
try {
|
|
668
|
-
|
|
670
|
+
List<ReactShadowNode> onLayoutNodes = new ArrayList<>();
|
|
671
|
+
applyUpdatesRecursive(cssRoot, 0f, 0f, onLayoutNodes);
|
|
672
|
+
|
|
673
|
+
for (ReactShadowNode node : onLayoutNodes) {
|
|
674
|
+
mEventDispatcher.dispatchEvent(
|
|
675
|
+
OnLayoutEvent.obtain(
|
|
676
|
+
-1, /* surfaceId not used in classic renderer */
|
|
677
|
+
node.getReactTag(),
|
|
678
|
+
node.getScreenX(),
|
|
679
|
+
node.getScreenY(),
|
|
680
|
+
node.getScreenWidth(),
|
|
681
|
+
node.getScreenHeight()));
|
|
682
|
+
}
|
|
683
|
+
|
|
669
684
|
} finally {
|
|
670
685
|
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
|
671
686
|
}
|
|
@@ -951,39 +966,34 @@ public class UIImplementation {
|
|
|
951
966
|
}
|
|
952
967
|
}
|
|
953
968
|
|
|
954
|
-
protected void applyUpdatesRecursive(
|
|
969
|
+
protected void applyUpdatesRecursive(
|
|
970
|
+
ReactShadowNode cssNode,
|
|
971
|
+
float absoluteX,
|
|
972
|
+
float absoluteY,
|
|
973
|
+
List<ReactShadowNode> onLayoutNodes) {
|
|
955
974
|
if (!cssNode.hasUpdates()) {
|
|
956
975
|
return;
|
|
957
976
|
}
|
|
958
977
|
|
|
978
|
+
if (cssNode.dispatchUpdatesWillChangeLayout(absoluteX, absoluteY)
|
|
979
|
+
&& cssNode.shouldNotifyOnLayout()
|
|
980
|
+
&& !mShadowNodeRegistry.isRootNode(cssNode.getReactTag())) {
|
|
981
|
+
onLayoutNodes.add(cssNode);
|
|
982
|
+
}
|
|
983
|
+
|
|
959
984
|
Iterable<? extends ReactShadowNode> cssChildren = cssNode.calculateLayoutOnChildren();
|
|
960
985
|
if (cssChildren != null) {
|
|
961
986
|
for (ReactShadowNode cssChild : cssChildren) {
|
|
962
987
|
applyUpdatesRecursive(
|
|
963
|
-
cssChild,
|
|
988
|
+
cssChild,
|
|
989
|
+
absoluteX + cssNode.getLayoutX(),
|
|
990
|
+
absoluteY + cssNode.getLayoutY(),
|
|
991
|
+
onLayoutNodes);
|
|
964
992
|
}
|
|
965
993
|
}
|
|
966
994
|
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
boolean frameDidChange =
|
|
970
|
-
cssNode.dispatchUpdates(
|
|
971
|
-
absoluteX, absoluteY, mOperationsQueue, mNativeViewHierarchyOptimizer);
|
|
972
|
-
|
|
973
|
-
// Notify JS about layout event if requested
|
|
974
|
-
// and if the position or dimensions actually changed
|
|
975
|
-
// (consistent with iOS).
|
|
976
|
-
if (frameDidChange && cssNode.shouldNotifyOnLayout()) {
|
|
977
|
-
mEventDispatcher.dispatchEvent(
|
|
978
|
-
OnLayoutEvent.obtain(
|
|
979
|
-
-1, /* surfaceId not used in classic renderer */
|
|
980
|
-
tag,
|
|
981
|
-
cssNode.getScreenX(),
|
|
982
|
-
cssNode.getScreenY(),
|
|
983
|
-
cssNode.getScreenWidth(),
|
|
984
|
-
cssNode.getScreenHeight()));
|
|
985
|
-
}
|
|
986
|
-
}
|
|
995
|
+
cssNode.dispatchUpdates(absoluteX, absoluteY, mOperationsQueue, mNativeViewHierarchyOptimizer);
|
|
996
|
+
|
|
987
997
|
cssNode.markUpdateSeen();
|
|
988
998
|
mNativeViewHierarchyOptimizer.onViewUpdatesCompleted(cssNode);
|
|
989
999
|
}
|
|
@@ -43,13 +43,16 @@ class HermesExecutorRuntimeAdapter
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
void tickleJs() override {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
thread_->runOnQueue(
|
|
47
|
+
[weakRuntime = std::weak_ptr<HermesRuntime>(runtime_)]() {
|
|
48
|
+
auto runtime = weakRuntime.lock();
|
|
49
|
+
if (!runtime) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
jsi::Function func =
|
|
53
|
+
runtime->global().getPropertyAsFunction(*runtime, "__tickleJs");
|
|
54
|
+
func.call(*runtime);
|
|
55
|
+
});
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
private:
|
|
@@ -31,7 +31,7 @@ struct Bridging<
|
|
|
31
31
|
std::shared_ptr<T>,
|
|
32
32
|
std::enable_if_t<std::is_base_of_v<jsi::HostObject, T>>> {
|
|
33
33
|
static std::shared_ptr<T> fromJs(jsi::Runtime& rt, const jsi::Object& value) {
|
|
34
|
-
return value.
|
|
34
|
+
return value.getHostObject<T>(rt);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
static jsi::Object toJs(jsi::Runtime& rt, std::shared_ptr<T> value) {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#include "LegacyViewManagerInteropComponentDescriptor.h"
|
|
9
9
|
#include <React/RCTBridge.h>
|
|
10
10
|
#include <React/RCTBridgeModuleDecorator.h>
|
|
11
|
+
#include <React/RCTBridgeProxy.h>
|
|
11
12
|
#include <React/RCTComponentData.h>
|
|
12
13
|
#include <React/RCTEventDispatcher.h>
|
|
13
14
|
#include <React/RCTModuleData.h>
|
|
@@ -86,6 +87,12 @@ static const std::shared_ptr<void> constructCoordinator(
|
|
|
86
87
|
bridge = unwrapManagedObjectWeakly(optionalBridge.value());
|
|
87
88
|
}
|
|
88
89
|
|
|
90
|
+
RCTBridgeProxy *bridgeProxy;
|
|
91
|
+
auto optionalBridgeProxy = contextContainer->find<std::shared_ptr<void>>("RCTBridgeProxy");
|
|
92
|
+
if (optionalBridgeProxy) {
|
|
93
|
+
bridgeProxy = unwrapManagedObjectWeakly(optionalBridgeProxy.value());
|
|
94
|
+
}
|
|
95
|
+
|
|
89
96
|
auto optionalEventDispatcher = contextContainer->find<std::shared_ptr<void>>("RCTEventDispatcher");
|
|
90
97
|
RCTEventDispatcher *eventDispatcher;
|
|
91
98
|
if (optionalEventDispatcher) {
|
|
@@ -104,6 +111,7 @@ static const std::shared_ptr<void> constructCoordinator(
|
|
|
104
111
|
return wrapManagedObject([[RCTLegacyViewManagerInteropCoordinator alloc]
|
|
105
112
|
initWithComponentData:componentData
|
|
106
113
|
bridge:bridge
|
|
114
|
+
bridgeProxy:bridgeProxy
|
|
107
115
|
bridgelessInteropData:bridgeModuleDecorator]);
|
|
108
116
|
}
|
|
109
117
|
|
|
@@ -14,13 +14,15 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
14
14
|
|
|
15
15
|
@class RCTComponentData;
|
|
16
16
|
@class RCTBridge;
|
|
17
|
+
@class RCTBridgeProxy;
|
|
17
18
|
|
|
18
19
|
typedef void (^InterceptorBlock)(std::string eventName, folly::dynamic event);
|
|
19
20
|
|
|
20
21
|
@interface RCTLegacyViewManagerInteropCoordinator : NSObject
|
|
21
22
|
|
|
22
23
|
- (instancetype)initWithComponentData:(RCTComponentData *)componentData
|
|
23
|
-
bridge:(RCTBridge *)bridge
|
|
24
|
+
bridge:(nullable RCTBridge *)bridge
|
|
25
|
+
bridgeProxy:(nullable RCTBridgeProxy *)bridgeProxy
|
|
24
26
|
bridgelessInteropData:(RCTBridgeModuleDecorator *)bridgelessInteropData;
|
|
25
27
|
|
|
26
28
|
- (UIView *)createPaperViewWithTag:(NSInteger)tag;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#include "RCTLegacyViewManagerInteropCoordinator.h"
|
|
9
9
|
#include <React/RCTBridge+Private.h>
|
|
10
10
|
#include <React/RCTBridgeMethod.h>
|
|
11
|
+
#include <React/RCTBridgeProxy.h>
|
|
11
12
|
#include <React/RCTComponentData.h>
|
|
12
13
|
#include <React/RCTEventDispatcherProtocol.h>
|
|
13
14
|
#include <React/RCTFollyConvert.h>
|
|
@@ -16,6 +17,7 @@
|
|
|
16
17
|
#include <React/RCTUIManager.h>
|
|
17
18
|
#include <React/RCTUIManagerUtils.h>
|
|
18
19
|
#include <React/RCTUtils.h>
|
|
20
|
+
#include <React/RCTViewManager.h>
|
|
19
21
|
#include <folly/json.h>
|
|
20
22
|
#include <objc/runtime.h>
|
|
21
23
|
|
|
@@ -25,6 +27,8 @@ using namespace facebook::react;
|
|
|
25
27
|
RCTComponentData *_componentData;
|
|
26
28
|
__weak RCTBridge *_bridge;
|
|
27
29
|
__weak RCTBridgeModuleDecorator *_bridgelessInteropData;
|
|
30
|
+
__weak RCTBridgeProxy *_bridgeProxy;
|
|
31
|
+
|
|
28
32
|
/*
|
|
29
33
|
Each instance of `RCTLegacyViewManagerInteropComponentView` registers a block to which events are dispatched.
|
|
30
34
|
This is the container that maps unretained UIView pointer to a block to which the event is dispatched.
|
|
@@ -40,13 +44,16 @@ using namespace facebook::react;
|
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
- (instancetype)initWithComponentData:(RCTComponentData *)componentData
|
|
43
|
-
bridge:(RCTBridge *)bridge
|
|
47
|
+
bridge:(nullable RCTBridge *)bridge
|
|
48
|
+
bridgeProxy:(nullable RCTBridgeProxy *)bridgeProxy
|
|
44
49
|
bridgelessInteropData:(RCTBridgeModuleDecorator *)bridgelessInteropData;
|
|
45
50
|
{
|
|
46
51
|
if (self = [super init]) {
|
|
47
52
|
_componentData = componentData;
|
|
48
53
|
_bridge = bridge;
|
|
49
54
|
_bridgelessInteropData = bridgelessInteropData;
|
|
55
|
+
_bridgeProxy = bridgeProxy;
|
|
56
|
+
|
|
50
57
|
if (bridgelessInteropData) {
|
|
51
58
|
// During bridge mode, RCTBridgeModules will be decorated with these APIs by the bridge.
|
|
52
59
|
RCTAssert(
|
|
@@ -62,7 +69,9 @@ using namespace facebook::react;
|
|
|
62
69
|
if (strongSelf) {
|
|
63
70
|
InterceptorBlock block = [strongSelf->_eventInterceptors objectForKey:reactTag];
|
|
64
71
|
if (block) {
|
|
65
|
-
block(
|
|
72
|
+
block(
|
|
73
|
+
std::string([RCTNormalizeInputEventName(eventName) UTF8String]),
|
|
74
|
+
convertIdToFollyDynamic(event ? event : @{}));
|
|
66
75
|
}
|
|
67
76
|
}
|
|
68
77
|
};
|
|
@@ -131,15 +140,9 @@ using namespace facebook::react;
|
|
|
131
140
|
NSArray *newArgs = [@[ [NSNumber numberWithInteger:tag] ] arrayByAddingObjectsFromArray:args];
|
|
132
141
|
|
|
133
142
|
if (_bridge) {
|
|
134
|
-
[
|
|
135
|
-
dispatchBlock:^{
|
|
136
|
-
[method invokeWithBridge:self->_bridge module:self->_componentData.manager arguments:newArgs];
|
|
137
|
-
[self->_bridge.uiManager setNeedsLayout];
|
|
138
|
-
}
|
|
139
|
-
queue:RCTGetUIManagerQueue()];
|
|
143
|
+
[self _handleCommandsOnBridge:method withArgs:newArgs];
|
|
140
144
|
} else {
|
|
141
|
-
|
|
142
|
-
[method invokeWithBridge:nil module:self->_componentData.manager arguments:newArgs];
|
|
145
|
+
[self _handleCommandsOnBridgeless:method withArgs:newArgs];
|
|
143
146
|
}
|
|
144
147
|
}
|
|
145
148
|
|
|
@@ -169,8 +172,37 @@ using namespace facebook::react;
|
|
|
169
172
|
}
|
|
170
173
|
|
|
171
174
|
#pragma mark - Private
|
|
175
|
+
- (void)_handleCommandsOnBridge:(id<RCTBridgeMethod>)method withArgs:(NSArray *)newArgs
|
|
176
|
+
{
|
|
177
|
+
[_bridge.batchedBridge
|
|
178
|
+
dispatchBlock:^{
|
|
179
|
+
[method invokeWithBridge:self->_bridge module:self->_componentData.manager arguments:newArgs];
|
|
180
|
+
[self->_bridge.uiManager setNeedsLayout];
|
|
181
|
+
}
|
|
182
|
+
queue:RCTGetUIManagerQueue()];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
- (void)_handleCommandsOnBridgeless:(id<RCTBridgeMethod>)method withArgs:(NSArray *)newArgs
|
|
186
|
+
{
|
|
187
|
+
RCTViewManager *componentViewManager = self->_componentData.manager;
|
|
188
|
+
[componentViewManager setValue:_bridgeProxy forKey:@"bridge"];
|
|
189
|
+
|
|
190
|
+
[self->_bridgeProxy.uiManager
|
|
191
|
+
addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
192
|
+
[method invokeWithBridge:nil module:componentViewManager arguments:newArgs];
|
|
193
|
+
}];
|
|
194
|
+
}
|
|
172
195
|
|
|
173
196
|
- (void)_addUIBlock:(RCTViewManagerUIBlock)block
|
|
197
|
+
{
|
|
198
|
+
if (_bridge) {
|
|
199
|
+
[self _addUIBlockOnBridge:block];
|
|
200
|
+
} else {
|
|
201
|
+
[self->_bridgeProxy.uiManager addUIBlock:block];
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
- (void)_addUIBlockOnBridge:(RCTViewManagerUIBlock)block
|
|
174
206
|
{
|
|
175
207
|
__weak __typeof__(self) weakSelf = self;
|
|
176
208
|
[_bridge.batchedBridge
|
|
@@ -227,24 +227,23 @@ void RCTInstanceSetRuntimeDiagnosticFlags(NSString *flags)
|
|
|
227
227
|
RuntimeExecutor bufferedRuntimeExecutor = _reactInstance->getBufferedRuntimeExecutor();
|
|
228
228
|
timerManager->setRuntimeExecutor(bufferedRuntimeExecutor);
|
|
229
229
|
|
|
230
|
-
RCTBridgeProxy *bridgeProxy =
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
230
|
+
RCTBridgeProxy *bridgeProxy =
|
|
231
|
+
[[RCTBridgeProxy alloc] initWithViewRegistry:_bridgeModuleDecorator.viewRegistry_DEPRECATED
|
|
232
|
+
moduleRegistry:_bridgeModuleDecorator.moduleRegistry
|
|
233
|
+
bundleManager:_bridgeModuleDecorator.bundleManager
|
|
234
|
+
callableJSModules:_bridgeModuleDecorator.callableJSModules
|
|
235
|
+
dispatchToJSThread:^(dispatch_block_t block) {
|
|
236
|
+
__strong __typeof(self) strongSelf = weakSelf;
|
|
237
|
+
if (strongSelf && strongSelf->_valid) {
|
|
238
|
+
strongSelf->_reactInstance->getBufferedRuntimeExecutor()([=](jsi::Runtime &runtime) { block(); });
|
|
240
239
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
|
|
240
|
+
}
|
|
241
|
+
registerSegmentWithId:^(NSNumber *segmentId, NSString *path) {
|
|
242
|
+
__strong __typeof(self) strongSelf = weakSelf;
|
|
243
|
+
if (strongSelf && strongSelf->_valid) {
|
|
244
|
+
[strongSelf registerSegmentWithId:segmentId path:path];
|
|
245
|
+
}
|
|
246
|
+
}];
|
|
248
247
|
|
|
249
248
|
// Set up TurboModules
|
|
250
249
|
_turboModuleManager = [[RCTTurboModuleManager alloc]
|
|
@@ -269,6 +268,7 @@ void RCTInstanceSetRuntimeDiagnosticFlags(NSString *flags)
|
|
|
269
268
|
facebook::react::wrapManagedObject([_turboModuleManager moduleForName:"RCTEventDispatcher"]));
|
|
270
269
|
contextContainer->insert("RCTBridgeModuleDecorator", facebook::react::wrapManagedObject(_bridgeModuleDecorator));
|
|
271
270
|
contextContainer->insert("RuntimeScheduler", std::weak_ptr<RuntimeScheduler>(_reactInstance->getRuntimeScheduler()));
|
|
271
|
+
contextContainer->insert("RCTBridgeProxy", facebook::react::wrapManagedObject(bridgeProxy));
|
|
272
272
|
|
|
273
273
|
_surfacePresenter = [[RCTSurfacePresenter alloc]
|
|
274
274
|
initWithContextContainer:contextContainer
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native",
|
|
3
|
-
"version": "0.73.0-rc.
|
|
3
|
+
"version": "0.73.0-rc.3",
|
|
4
4
|
"description": "A framework for building native apps using React",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -97,12 +97,12 @@
|
|
|
97
97
|
"@react-native-community/cli-platform-android": "12.0.0-alpha.17",
|
|
98
98
|
"@react-native-community/cli-platform-ios": "12.0.0-alpha.17",
|
|
99
99
|
"@react-native/assets-registry": "^0.73.1",
|
|
100
|
-
"@react-native/community-cli-plugin": "^0.73.
|
|
100
|
+
"@react-native/community-cli-plugin": "^0.73.7",
|
|
101
101
|
"@react-native/codegen": "^0.73.1",
|
|
102
|
-
"@react-native/gradle-plugin": "^0.73.
|
|
102
|
+
"@react-native/gradle-plugin": "^0.73.2",
|
|
103
103
|
"@react-native/js-polyfills": "^0.73.1",
|
|
104
104
|
"@react-native/normalize-colors": "^0.73.2",
|
|
105
|
-
"@react-native/virtualized-lists": "^0.73.
|
|
105
|
+
"@react-native/virtualized-lists": "^0.73.2",
|
|
106
106
|
"abort-controller": "^3.0.0",
|
|
107
107
|
"anser": "^1.4.9",
|
|
108
108
|
"ansi-regex": "^5.0.0",
|