react-native 0.73.0-rc.2 → 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/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/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-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/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/android/app/build.gradle +1 -1
- package/template/android/app/src/main/java/com/helloworld/MainApplication.kt +3 -10
- package/template/package.json +1 -1
- package/third-party-podspecs/glog.podspec +14 -1
|
@@ -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",
|
|
@@ -291,32 +291,13 @@ class ReactNativePodsUtils
|
|
|
291
291
|
end
|
|
292
292
|
|
|
293
293
|
def self.updateOSDeploymentTarget(installer)
|
|
294
|
-
pod_to_update = Set.new([
|
|
295
|
-
"boost",
|
|
296
|
-
"CocoaAsyncSocket",
|
|
297
|
-
"Flipper",
|
|
298
|
-
"Flipper-DoubleConversion",
|
|
299
|
-
"Flipper-Fmt",
|
|
300
|
-
"Flipper-Boost-iOSX",
|
|
301
|
-
"Flipper-Folly",
|
|
302
|
-
"Flipper-Glog",
|
|
303
|
-
"Flipper-PeerTalk",
|
|
304
|
-
"FlipperKit",
|
|
305
|
-
"fmt",
|
|
306
|
-
"libevent",
|
|
307
|
-
"OpenSSL-Universal",
|
|
308
|
-
"RCT-Folly",
|
|
309
|
-
"SocketRocket",
|
|
310
|
-
"YogaKit"
|
|
311
|
-
])
|
|
312
|
-
|
|
313
294
|
installer.target_installation_results.pod_target_installation_results
|
|
314
295
|
.each do |pod_name, target_installation_result|
|
|
315
|
-
unless pod_to_update.include?(pod_name)
|
|
316
|
-
next
|
|
317
|
-
end
|
|
318
296
|
target_installation_result.native_target.build_configurations.each do |config|
|
|
319
|
-
config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"]
|
|
297
|
+
old_iphone_deploy_target = config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] ?
|
|
298
|
+
config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] :
|
|
299
|
+
Helpers::Constants.min_ios_version_supported
|
|
300
|
+
config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = [Helpers::Constants.min_ios_version_supported.to_f, old_iphone_deploy_target.to_f].max.to_s
|
|
320
301
|
end
|
|
321
302
|
end
|
|
322
303
|
end
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
const yargs = require('yargs');
|
|
13
13
|
const fs = require('fs');
|
|
14
|
+
const p = require('path');
|
|
14
15
|
|
|
15
16
|
const CONFIG_FILE_NAME = 'react-native.config.js';
|
|
16
17
|
const PROJECT_FIELD = 'project';
|
|
@@ -93,7 +94,11 @@ function extractComponentsNames(reactNativeConfig) {
|
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
function generateRCTLegacyInteropComponents() {
|
|
96
|
-
const
|
|
97
|
+
const cwd = process.cwd();
|
|
98
|
+
const configFilePath = p.join(cwd, appRoot, CONFIG_FILE_NAME);
|
|
99
|
+
console.log(
|
|
100
|
+
`Looking for a react-native.config.js file at ${configFilePath}...`,
|
|
101
|
+
);
|
|
97
102
|
let reactNativeConfig = null;
|
|
98
103
|
try {
|
|
99
104
|
reactNativeConfig = require(configFilePath);
|
|
@@ -107,7 +112,7 @@ function generateRCTLegacyInteropComponents() {
|
|
|
107
112
|
console.log('Skip LegacyInterop generation');
|
|
108
113
|
return;
|
|
109
114
|
}
|
|
110
|
-
|
|
115
|
+
console.log(`Components found: ${componentNames}`);
|
|
111
116
|
let componentsArray = componentNames.map(name => `\t\t\t@"${name}",`);
|
|
112
117
|
// Remove the last comma
|
|
113
118
|
if (componentsArray.length > 0) {
|
|
@@ -118,6 +123,7 @@ function generateRCTLegacyInteropComponents() {
|
|
|
118
123
|
|
|
119
124
|
const filePath = `${outputPath}/${OUTPUT_FILE_NAME}`;
|
|
120
125
|
fs.writeFileSync(filePath, fileBody(componentsArray.join('\n')));
|
|
126
|
+
console.log(`${filePath} updated!`);
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
generateRCTLegacyInteropComponents();
|
|
@@ -60,7 +60,13 @@ Pod::Spec.new do |spec|
|
|
|
60
60
|
:execution_position => :before_compile,
|
|
61
61
|
:script => <<-EOS
|
|
62
62
|
. "$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh"
|
|
63
|
-
|
|
63
|
+
|
|
64
|
+
CONFIG="Release"
|
|
65
|
+
if echo $GCC_PREPROCESSOR_DEFINITIONS | grep -q "DEBUG=1"; then
|
|
66
|
+
CONFIG="Debug"
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
"$NODE_BINARY" "$REACT_NATIVE_PATH/sdks/hermes-engine/utils/replace_hermes_version.js" -c "$CONFIG" -r "#{version}" -p "$PODS_ROOT"
|
|
64
70
|
EOS
|
|
65
71
|
}
|
|
66
72
|
end
|
|
@@ -125,7 +125,7 @@ def podspec_source_build_from_local_source_dir(react_native_path)
|
|
|
125
125
|
source_dir_path = ENV['REACT_NATIVE_OVERRIDE_HERMES_DIR']
|
|
126
126
|
if Dir.exist?(source_dir_path)
|
|
127
127
|
hermes_log("Using source code from local path: #{source_dir_path}")
|
|
128
|
-
tarball_path = File.join(
|
|
128
|
+
tarball_path = File.join(artifacts_dir(), "hermes-engine-from-local-source-dir.tar.gz")
|
|
129
129
|
exclude_paths = [
|
|
130
130
|
"__tests__",
|
|
131
131
|
"./external/flowtest",
|
|
@@ -192,6 +192,10 @@ end
|
|
|
192
192
|
|
|
193
193
|
# HELPERS
|
|
194
194
|
|
|
195
|
+
def artifacts_dir()
|
|
196
|
+
return File.join(Pod::Config.instance.project_pods_root, "hermes-engine-artifacts")
|
|
197
|
+
end
|
|
198
|
+
|
|
195
199
|
def hermestag_file(react_native_path)
|
|
196
200
|
return File.join(react_native_path, "sdks", ".hermesversion")
|
|
197
201
|
end
|
|
@@ -208,15 +212,14 @@ def download_stable_hermes(react_native_path, version, configuration)
|
|
|
208
212
|
end
|
|
209
213
|
|
|
210
214
|
def download_hermes_tarball(react_native_path, tarball_url, version, configuration)
|
|
211
|
-
destination_folder = "#{react_native_path}/sdks/downloads"
|
|
212
215
|
destination_path = configuration == nil ?
|
|
213
|
-
"#{
|
|
214
|
-
"#{
|
|
216
|
+
"#{artifacts_dir()}/hermes-ios-#{version}.tar.gz" :
|
|
217
|
+
"#{artifacts_dir()}/hermes-ios-#{version}-#{configuration}.tar.gz"
|
|
215
218
|
|
|
216
219
|
unless File.exist?(destination_path)
|
|
217
220
|
# Download to a temporary file first so we don't cache incomplete downloads.
|
|
218
|
-
tmp_file = "#{
|
|
219
|
-
`mkdir -p "#{
|
|
221
|
+
tmp_file = "#{artifacts_dir()}/hermes-ios.download"
|
|
222
|
+
`mkdir -p "#{artifacts_dir()}" && curl "#{tarball_url}" -Lo "#{tmp_file}" && mv "#{tmp_file}" "#{destination_path}"`
|
|
220
223
|
end
|
|
221
224
|
return destination_path
|
|
222
225
|
end
|