From ce3ade82bfc514922242debfd0352b0a648550ea Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Mon, 29 May 2023 06:52:31 -0700 Subject: [PATCH 01/33] Move LayoutMetrics and LayoutPrimitives from core to graphics folder (#37609) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37609 changelog: [internal] Moving LayoutMetrics and LayoutPrimitives from core to graphics module. This is to enable different implementation for different platforms. Reviewed By: rubennorte Differential Revision: D45904748 fbshipit-source-id: a4e666d7c7390e87abdb09235f96655b63f451f9 --- .../Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h | 2 +- .../React/Fabric/Mounting/RCTComponentViewProtocol.h | 2 +- packages/react-native/React/Fabric/RCTConversions.h | 2 +- .../renderer/animations/LayoutAnimationKeyFrameManager.cpp | 2 +- .../react/renderer/attributedstring/TextAttributes.h | 2 +- .../renderer/components/scrollview/ScrollViewShadowNode.cpp | 2 +- .../react/renderer/components/view/TouchEventEmitter.h | 2 +- .../react/renderer/components/view/ViewEventEmitter.h | 2 +- .../ReactCommon/react/renderer/components/view/ViewProps.h | 2 +- .../ReactCommon/react/renderer/components/view/conversions.h | 2 +- .../ReactCommon/react/renderer/core/LayoutConstraints.h | 2 +- .../ReactCommon/react/renderer/core/LayoutableShadowNode.cpp | 2 +- .../ReactCommon/react/renderer/core/LayoutableShadowNode.h | 2 +- .../react-native/ReactCommon/react/renderer/core/conversions.h | 2 +- .../react/renderer/{core => graphics}/LayoutMetrics.cpp | 0 .../react/renderer/{core => graphics}/LayoutMetrics.h | 2 +- .../react/renderer/{core => graphics}/LayoutPrimitives.h | 0 .../ReactCommon/react/renderer/mounting/ShadowTree.cpp | 1 - .../ReactCommon/react/renderer/mounting/ShadowView.cpp | 2 +- .../ReactCommon/react/renderer/mounting/ShadowView.h | 2 +- .../react-native/ReactCommon/react/renderer/mounting/StubView.h | 2 +- .../ReactCommon/react/renderer/timeline/TimelineFrame.h | 2 +- .../ReactCommon/react/renderer/timeline/TimelineHandler.h | 1 - 23 files changed, 19 insertions(+), 21 deletions(-) rename packages/react-native/ReactCommon/react/renderer/{core => graphics}/LayoutMetrics.cpp (100%) rename packages/react-native/ReactCommon/react/renderer/{core => graphics}/LayoutMetrics.h (98%) rename packages/react-native/ReactCommon/react/renderer/{core => graphics}/LayoutPrimitives.h (100%) diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h index f2aff61c92c38f..010f3ecf9f4509 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h @@ -14,8 +14,8 @@ #import #import #import -#import #import +#import NS_ASSUME_NONNULL_BEGIN diff --git a/packages/react-native/React/Fabric/Mounting/RCTComponentViewProtocol.h b/packages/react-native/React/Fabric/Mounting/RCTComponentViewProtocol.h index 50d7d434f560ff..38215a22900733 100644 --- a/packages/react-native/React/Fabric/Mounting/RCTComponentViewProtocol.h +++ b/packages/react-native/React/Fabric/Mounting/RCTComponentViewProtocol.h @@ -9,9 +9,9 @@ #import #import -#import #import #import +#import NS_ASSUME_NONNULL_BEGIN diff --git a/packages/react-native/React/Fabric/RCTConversions.h b/packages/react-native/React/Fabric/RCTConversions.h index ca5cd623f46f44..f0b847ec09756a 100644 --- a/packages/react-native/React/Fabric/RCTConversions.h +++ b/packages/react-native/React/Fabric/RCTConversions.h @@ -9,8 +9,8 @@ #import #import -#import #import +#import #import NS_ASSUME_NONNULL_BEGIN diff --git a/packages/react-native/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp b/packages/react-native/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp index 34aed3a676046f..957f6e3850a8f2 100644 --- a/packages/react-native/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp +++ b/packages/react-native/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp @@ -20,10 +20,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.h b/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.h index a681e9b4837145..5ba43ae62f7cb7 100644 --- a/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.h +++ b/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.h @@ -14,11 +14,11 @@ #include #include #include -#include #include #include #include #include +#include #include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.cpp b/packages/react-native/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.cpp index 7fe5a502133b0b..57b1be60aad49e 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.cpp @@ -8,7 +8,7 @@ #include "ScrollViewShadowNode.h" #include -#include +#include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/TouchEventEmitter.h b/packages/react-native/ReactCommon/react/renderer/components/view/TouchEventEmitter.h index ad42dfa7674eac..75f09d612d11a4 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/TouchEventEmitter.h +++ b/packages/react-native/ReactCommon/react/renderer/components/view/TouchEventEmitter.h @@ -10,9 +10,9 @@ #include #include #include -#include #include #include +#include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/ViewEventEmitter.h b/packages/react-native/ReactCommon/react/renderer/components/view/ViewEventEmitter.h index 2267fac1ed08eb..ad43403b5ee72b 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/ViewEventEmitter.h +++ b/packages/react-native/ReactCommon/react/renderer/components/view/ViewEventEmitter.h @@ -10,8 +10,8 @@ #include #include -#include #include +#include #include "TouchEventEmitter.h" diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/ViewProps.h b/packages/react-native/ReactCommon/react/renderer/components/view/ViewProps.h index 8b6a8445fe82d8..9851ec65c1c088 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/ViewProps.h +++ b/packages/react-native/ReactCommon/react/renderer/components/view/ViewProps.h @@ -10,10 +10,10 @@ #include #include #include -#include #include #include #include +#include #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/conversions.h b/packages/react-native/ReactCommon/react/renderer/components/view/conversions.h index 85191d843731df..2f2747e22cdf81 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/conversions.h +++ b/packages/react-native/ReactCommon/react/renderer/components/view/conversions.h @@ -13,8 +13,8 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/core/LayoutConstraints.h b/packages/react-native/ReactCommon/react/renderer/core/LayoutConstraints.h index 96089757f189bf..0456686b802906 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/LayoutConstraints.h +++ b/packages/react-native/ReactCommon/react/renderer/core/LayoutConstraints.h @@ -10,7 +10,7 @@ #include #include -#include +#include #include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp b/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp index 41b31772b18cd1..9393ae8c984c1c 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp @@ -9,11 +9,11 @@ #include #include -#include #include #include #include #include +#include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.h b/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.h index ed0dc70088697b..5e53b90271f6a0 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.h +++ b/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.h @@ -14,10 +14,10 @@ #include #include -#include #include #include #include +#include #include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/core/conversions.h b/packages/react-native/ReactCommon/react/renderer/core/conversions.h index 8723d5e23d1c9f..22cb3c3d050bba 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/conversions.h +++ b/packages/react-native/ReactCommon/react/renderer/core/conversions.h @@ -7,7 +7,7 @@ #pragma once -#include +#include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/core/LayoutMetrics.cpp b/packages/react-native/ReactCommon/react/renderer/graphics/LayoutMetrics.cpp similarity index 100% rename from packages/react-native/ReactCommon/react/renderer/core/LayoutMetrics.cpp rename to packages/react-native/ReactCommon/react/renderer/graphics/LayoutMetrics.cpp diff --git a/packages/react-native/ReactCommon/react/renderer/core/LayoutMetrics.h b/packages/react-native/ReactCommon/react/renderer/graphics/LayoutMetrics.h similarity index 98% rename from packages/react-native/ReactCommon/react/renderer/core/LayoutMetrics.h rename to packages/react-native/ReactCommon/react/renderer/graphics/LayoutMetrics.h index 16faa8bc78c6e2..a225835366e412 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/LayoutMetrics.h +++ b/packages/react-native/ReactCommon/react/renderer/graphics/LayoutMetrics.h @@ -8,9 +8,9 @@ #pragma once #include -#include #include #include +#include #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/core/LayoutPrimitives.h b/packages/react-native/ReactCommon/react/renderer/graphics/LayoutPrimitives.h similarity index 100% rename from packages/react-native/ReactCommon/react/renderer/core/LayoutPrimitives.h rename to packages/react-native/ReactCommon/react/renderer/graphics/LayoutPrimitives.h diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp index 0b9106bbb5d2b0..0d4ba5e6228a7e 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp +++ b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowView.cpp b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowView.cpp index 68a48d8e429325..21621ede498498 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowView.cpp +++ b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowView.cpp @@ -7,9 +7,9 @@ #include "ShadowView.h" -#include #include #include +#include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowView.h b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowView.h index b963d81e61c3a6..fddc1a153822b6 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowView.h +++ b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowView.h @@ -10,11 +10,11 @@ #include #include #include -#include #include #include #include #include +#include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/StubView.h b/packages/react-native/ReactCommon/react/renderer/mounting/StubView.h index 472e6c0d100241..4d5e7ea8a3a1b7 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/StubView.h +++ b/packages/react-native/ReactCommon/react/renderer/mounting/StubView.h @@ -10,9 +10,9 @@ #include #include -#include #include #include +#include #include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/timeline/TimelineFrame.h b/packages/react-native/ReactCommon/react/renderer/timeline/TimelineFrame.h index c732948356c9e5..e676ec10c10738 100644 --- a/packages/react-native/ReactCommon/react/renderer/timeline/TimelineFrame.h +++ b/packages/react-native/ReactCommon/react/renderer/timeline/TimelineFrame.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/timeline/TimelineHandler.h b/packages/react-native/ReactCommon/react/renderer/timeline/TimelineHandler.h index 2be8f825801e36..f37e5773cfb806 100644 --- a/packages/react-native/ReactCommon/react/renderer/timeline/TimelineHandler.h +++ b/packages/react-native/ReactCommon/react/renderer/timeline/TimelineHandler.h @@ -7,7 +7,6 @@ #pragma once -#include #include #include From 9084ee133a060ac2b2e5b140476e6924fd1225ad Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Mon, 29 May 2023 07:27:36 -0700 Subject: [PATCH 02/33] Revert D45904748: Move LayoutMetrics and LayoutPrimitives from core to graphics folder Differential Revision: D45904748 Original commit changeset: a4e666d7c739 Original Phabricator Diff: D45904748 fbshipit-source-id: c2da28836cb51966854c81d4e380a2abeb742cda --- .../Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h | 2 +- .../React/Fabric/Mounting/RCTComponentViewProtocol.h | 2 +- packages/react-native/React/Fabric/RCTConversions.h | 2 +- .../renderer/animations/LayoutAnimationKeyFrameManager.cpp | 2 +- .../react/renderer/attributedstring/TextAttributes.h | 2 +- .../renderer/components/scrollview/ScrollViewShadowNode.cpp | 2 +- .../react/renderer/components/view/TouchEventEmitter.h | 2 +- .../react/renderer/components/view/ViewEventEmitter.h | 2 +- .../ReactCommon/react/renderer/components/view/ViewProps.h | 2 +- .../ReactCommon/react/renderer/components/view/conversions.h | 2 +- .../ReactCommon/react/renderer/core/LayoutConstraints.h | 2 +- .../react/renderer/{graphics => core}/LayoutMetrics.cpp | 0 .../react/renderer/{graphics => core}/LayoutMetrics.h | 2 +- .../react/renderer/{graphics => core}/LayoutPrimitives.h | 0 .../ReactCommon/react/renderer/core/LayoutableShadowNode.cpp | 2 +- .../ReactCommon/react/renderer/core/LayoutableShadowNode.h | 2 +- .../react-native/ReactCommon/react/renderer/core/conversions.h | 2 +- .../ReactCommon/react/renderer/mounting/ShadowTree.cpp | 1 + .../ReactCommon/react/renderer/mounting/ShadowView.cpp | 2 +- .../ReactCommon/react/renderer/mounting/ShadowView.h | 2 +- .../react-native/ReactCommon/react/renderer/mounting/StubView.h | 2 +- .../ReactCommon/react/renderer/timeline/TimelineFrame.h | 2 +- .../ReactCommon/react/renderer/timeline/TimelineHandler.h | 1 + 23 files changed, 21 insertions(+), 19 deletions(-) rename packages/react-native/ReactCommon/react/renderer/{graphics => core}/LayoutMetrics.cpp (100%) rename packages/react-native/ReactCommon/react/renderer/{graphics => core}/LayoutMetrics.h (98%) rename packages/react-native/ReactCommon/react/renderer/{graphics => core}/LayoutPrimitives.h (100%) diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h index 010f3ecf9f4509..f2aff61c92c38f 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h @@ -14,8 +14,8 @@ #import #import #import +#import #import -#import NS_ASSUME_NONNULL_BEGIN diff --git a/packages/react-native/React/Fabric/Mounting/RCTComponentViewProtocol.h b/packages/react-native/React/Fabric/Mounting/RCTComponentViewProtocol.h index 38215a22900733..50d7d434f560ff 100644 --- a/packages/react-native/React/Fabric/Mounting/RCTComponentViewProtocol.h +++ b/packages/react-native/React/Fabric/Mounting/RCTComponentViewProtocol.h @@ -9,9 +9,9 @@ #import #import +#import #import #import -#import NS_ASSUME_NONNULL_BEGIN diff --git a/packages/react-native/React/Fabric/RCTConversions.h b/packages/react-native/React/Fabric/RCTConversions.h index f0b847ec09756a..ca5cd623f46f44 100644 --- a/packages/react-native/React/Fabric/RCTConversions.h +++ b/packages/react-native/React/Fabric/RCTConversions.h @@ -9,8 +9,8 @@ #import #import +#import #import -#import #import NS_ASSUME_NONNULL_BEGIN diff --git a/packages/react-native/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp b/packages/react-native/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp index 957f6e3850a8f2..34aed3a676046f 100644 --- a/packages/react-native/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp +++ b/packages/react-native/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp @@ -20,10 +20,10 @@ #include #include #include +#include #include #include #include -#include #include #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.h b/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.h index 5ba43ae62f7cb7..a681e9b4837145 100644 --- a/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.h +++ b/packages/react-native/ReactCommon/react/renderer/attributedstring/TextAttributes.h @@ -14,11 +14,11 @@ #include #include #include +#include #include #include #include #include -#include #include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.cpp b/packages/react-native/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.cpp index 57b1be60aad49e..7fe5a502133b0b 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.cpp @@ -8,7 +8,7 @@ #include "ScrollViewShadowNode.h" #include -#include +#include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/TouchEventEmitter.h b/packages/react-native/ReactCommon/react/renderer/components/view/TouchEventEmitter.h index 75f09d612d11a4..ad42dfa7674eac 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/TouchEventEmitter.h +++ b/packages/react-native/ReactCommon/react/renderer/components/view/TouchEventEmitter.h @@ -10,9 +10,9 @@ #include #include #include +#include #include #include -#include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/ViewEventEmitter.h b/packages/react-native/ReactCommon/react/renderer/components/view/ViewEventEmitter.h index ad43403b5ee72b..2267fac1ed08eb 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/ViewEventEmitter.h +++ b/packages/react-native/ReactCommon/react/renderer/components/view/ViewEventEmitter.h @@ -10,8 +10,8 @@ #include #include +#include #include -#include #include "TouchEventEmitter.h" diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/ViewProps.h b/packages/react-native/ReactCommon/react/renderer/components/view/ViewProps.h index 9851ec65c1c088..8b6a8445fe82d8 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/ViewProps.h +++ b/packages/react-native/ReactCommon/react/renderer/components/view/ViewProps.h @@ -10,10 +10,10 @@ #include #include #include +#include #include #include #include -#include #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/conversions.h b/packages/react-native/ReactCommon/react/renderer/components/view/conversions.h index 2f2747e22cdf81..85191d843731df 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/conversions.h +++ b/packages/react-native/ReactCommon/react/renderer/components/view/conversions.h @@ -13,8 +13,8 @@ #include #include #include +#include #include -#include #include #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/core/LayoutConstraints.h b/packages/react-native/ReactCommon/react/renderer/core/LayoutConstraints.h index 0456686b802906..96089757f189bf 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/LayoutConstraints.h +++ b/packages/react-native/ReactCommon/react/renderer/core/LayoutConstraints.h @@ -10,7 +10,7 @@ #include #include -#include +#include #include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/graphics/LayoutMetrics.cpp b/packages/react-native/ReactCommon/react/renderer/core/LayoutMetrics.cpp similarity index 100% rename from packages/react-native/ReactCommon/react/renderer/graphics/LayoutMetrics.cpp rename to packages/react-native/ReactCommon/react/renderer/core/LayoutMetrics.cpp diff --git a/packages/react-native/ReactCommon/react/renderer/graphics/LayoutMetrics.h b/packages/react-native/ReactCommon/react/renderer/core/LayoutMetrics.h similarity index 98% rename from packages/react-native/ReactCommon/react/renderer/graphics/LayoutMetrics.h rename to packages/react-native/ReactCommon/react/renderer/core/LayoutMetrics.h index a225835366e412..16faa8bc78c6e2 100644 --- a/packages/react-native/ReactCommon/react/renderer/graphics/LayoutMetrics.h +++ b/packages/react-native/ReactCommon/react/renderer/core/LayoutMetrics.h @@ -8,9 +8,9 @@ #pragma once #include +#include #include #include -#include #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/graphics/LayoutPrimitives.h b/packages/react-native/ReactCommon/react/renderer/core/LayoutPrimitives.h similarity index 100% rename from packages/react-native/ReactCommon/react/renderer/graphics/LayoutPrimitives.h rename to packages/react-native/ReactCommon/react/renderer/core/LayoutPrimitives.h diff --git a/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp b/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp index 9393ae8c984c1c..41b31772b18cd1 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp +++ b/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp @@ -9,11 +9,11 @@ #include #include +#include #include #include #include #include -#include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.h b/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.h index 5e53b90271f6a0..ed0dc70088697b 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.h +++ b/packages/react-native/ReactCommon/react/renderer/core/LayoutableShadowNode.h @@ -14,10 +14,10 @@ #include #include +#include #include #include #include -#include #include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/core/conversions.h b/packages/react-native/ReactCommon/react/renderer/core/conversions.h index 22cb3c3d050bba..8723d5e23d1c9f 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/conversions.h +++ b/packages/react-native/ReactCommon/react/renderer/core/conversions.h @@ -7,7 +7,7 @@ #pragma once -#include +#include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp index 0d4ba5e6228a7e..0b9106bbb5d2b0 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp +++ b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowTree.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowView.cpp b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowView.cpp index 21621ede498498..68a48d8e429325 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowView.cpp +++ b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowView.cpp @@ -7,9 +7,9 @@ #include "ShadowView.h" +#include #include #include -#include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowView.h b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowView.h index fddc1a153822b6..b963d81e61c3a6 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/ShadowView.h +++ b/packages/react-native/ReactCommon/react/renderer/mounting/ShadowView.h @@ -10,11 +10,11 @@ #include #include #include +#include #include #include #include #include -#include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/mounting/StubView.h b/packages/react-native/ReactCommon/react/renderer/mounting/StubView.h index 4d5e7ea8a3a1b7..472e6c0d100241 100644 --- a/packages/react-native/ReactCommon/react/renderer/mounting/StubView.h +++ b/packages/react-native/ReactCommon/react/renderer/mounting/StubView.h @@ -10,9 +10,9 @@ #include #include +#include #include #include -#include #include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/timeline/TimelineFrame.h b/packages/react-native/ReactCommon/react/renderer/timeline/TimelineFrame.h index e676ec10c10738..c732948356c9e5 100644 --- a/packages/react-native/ReactCommon/react/renderer/timeline/TimelineFrame.h +++ b/packages/react-native/ReactCommon/react/renderer/timeline/TimelineFrame.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/timeline/TimelineHandler.h b/packages/react-native/ReactCommon/react/renderer/timeline/TimelineHandler.h index f37e5773cfb806..2be8f825801e36 100644 --- a/packages/react-native/ReactCommon/react/renderer/timeline/TimelineHandler.h +++ b/packages/react-native/ReactCommon/react/renderer/timeline/TimelineHandler.h @@ -7,6 +7,7 @@ #pragma once +#include #include #include From 551bbbc234734f52e89cf24dc0ac07c78094c4c7 Mon Sep 17 00:00:00 2001 From: Intl Scheduler <> Date: Mon, 29 May 2023 21:34:22 -0700 Subject: [PATCH 03/33] translation auto-update for i18n/fb4a.config.json on master Summary: Chronos Job Instance ID: 1125907889493757 Sandcastle Job Instance ID: 36028797978627335 allow-large-files ignore-conflict-markers opt-out-review Differential Revision: D46270525 fbshipit-source-id: 26beec108aa03c970338fdc4561af24798813acf --- .../ReactAndroid/src/main/res/devsupport/values-sq/strings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-native/ReactAndroid/src/main/res/devsupport/values-sq/strings.xml b/packages/react-native/ReactAndroid/src/main/res/devsupport/values-sq/strings.xml index 96e5af862b88ab..3f0f8caa0523c7 100644 --- a/packages/react-native/ReactAndroid/src/main/res/devsupport/values-sq/strings.xml +++ b/packages/react-native/ReactAndroid/src/main/res/devsupport/values-sq/strings.xml @@ -4,4 +4,5 @@ Menyja e zhvilluesit e React Native (%1$s) + Duke ekzekutuar %1$s From 680cbe757b250fd9a05862040c080f063b2197a7 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Tue, 30 May 2023 04:10:17 -0700 Subject: [PATCH 04/33] Make RNTester use RCTAppDelegate (#37572) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37572 Currently, RNTester was using a completely custom AppDelegate and not leveraging the RCTAppDelegate we use in the OSS. This resulted in a misalignment between the two setups and duplicated work to test stuff internally furst and then in the OSS, with some more time needed to understand why one setup was working and the other wasn't. With this change, we are aligning the two, bringing RNTester closer to the OSS setup. There are still small differences, but we can iterate over those. ## Changelog: [iOS][Changed] - Make RNTester use RCTAppDelegate Reviewed By: cortinico Differential Revision: D46182888 fbshipit-source-id: 7c55b06de1a317b1f2d4ad0d18a390dc4d3356a4 --- .../AppDelegate/RCTLegacyInteropComponents.mm | 3 +- packages/rn-tester/RNTester/AppDelegate.h | 8 +- packages/rn-tester/RNTester/AppDelegate.mm | 271 ++---------------- .../RNTester/RNTesterTurboModuleProvider.h | 26 -- .../RNTester/RNTesterTurboModuleProvider.mm | 43 --- .../RNTesterPods.xcodeproj/project.pbxproj | 6 - packages/rn-tester/react-native.config.js | 1 + 7 files changed, 21 insertions(+), 337 deletions(-) delete mode 100644 packages/rn-tester/RNTester/RNTesterTurboModuleProvider.h delete mode 100644 packages/rn-tester/RNTester/RNTesterTurboModuleProvider.mm diff --git a/packages/react-native/Libraries/AppDelegate/RCTLegacyInteropComponents.mm b/packages/react-native/Libraries/AppDelegate/RCTLegacyInteropComponents.mm index d1d68376b08493..549e41a9b91b5f 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTLegacyInteropComponents.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTLegacyInteropComponents.mm @@ -1,3 +1,4 @@ + /* * Copyright (c) Meta Platforms, Inc. and affiliates. * @@ -11,7 +12,7 @@ @implementation RCTLegacyInteropComponents + (NSArray *)legacyInteropComponents { - return @[]; + return @[ @"RNTMyLegacyNativeView" ]; } @end diff --git a/packages/rn-tester/RNTester/AppDelegate.h b/packages/rn-tester/RNTester/AppDelegate.h index 55625d8693c2a8..d172167ee1d627 100644 --- a/packages/rn-tester/RNTester/AppDelegate.h +++ b/packages/rn-tester/RNTester/AppDelegate.h @@ -5,13 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +#import #import -@class RCTBridge; - -@interface AppDelegate : UIResponder - -@property (nonatomic, strong) UIWindow *window; -@property (nonatomic, readonly) RCTBridge *bridge; +@interface AppDelegate : RCTAppDelegate @end diff --git a/packages/rn-tester/RNTester/AppDelegate.mm b/packages/rn-tester/RNTester/AppDelegate.mm index a04050d75f9127..f4e8d4006c5416 100644 --- a/packages/rn-tester/RNTester/AppDelegate.mm +++ b/packages/rn-tester/RNTester/AppDelegate.mm @@ -7,161 +7,30 @@ #import "AppDelegate.h" -#ifndef RCT_USE_HERMES -#if __has_include() -#define RCT_USE_HERMES 1 -#else -#define RCT_USE_HERMES 0 -#endif -#endif - -#ifdef RCT_NEW_ARCH_ENABLED -#ifndef RN_FABRIC_ENABLED -#define RN_FABRIC_ENABLED -#endif -#endif - -#if RCT_USE_HERMES -#import -#else -#import -#endif - -#import #import -#import -#import -#import -#import -#import -#import -#import -#import #import -#import -#import -#import -#import -#import -#import -#import - -#import +#import +#import #if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC #import #endif -#ifdef RN_FABRIC_ENABLED -#import -#import -#import -#import - -#import -#import -#import -#endif - #if RCT_NEW_ARCH_ENABLED +#import #import #endif -#if DEBUG -#ifdef FB_SONARKIT_ENABLED -#import -#import -#import -#import -#import -#import -#import -#endif -#endif - -#import -#import "RNTesterTurboModuleProvider.h" - -@interface RCTBridge () -- (std::shared_ptr)jsMessageThread; -- (void)invokeAsync:(std::function &&)func; -@end - -using namespace facebook::react; - -@interface AppDelegate () { - std::shared_ptr _runtimeScheduler; -#ifdef RN_FABRIC_ENABLED - RCTSurfacePresenterBridgeAdapter *_bridgeAdapter; - std::shared_ptr _reactNativeConfig; - facebook::react::ContextContainer::Shared _contextContainer; -#endif -} -@end - -#if RCT_NEW_ARCH_ENABLED -/// Declare conformance to `RCTComponentViewFactoryComponentProvider` -@interface AppDelegate () -@end -#endif - -static NSString *const kRNConcurrentRoot = @"concurrentRoot"; - @implementation AppDelegate -#ifdef RN_FABRIC_ENABLED -- (instancetype)init +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - if (self = [super init]) { - _contextContainer = std::make_shared(); - _reactNativeConfig = std::make_shared(); - _contextContainer->insert("ReactNativeConfig", _reactNativeConfig); - } - return self; -} -#endif - -- (BOOL)application:(__unused UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - RCTEnableTurboModule(YES); - - _bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; - - // Appetizer.io params check - NSDictionary *initProps = [self prepareInitialProps]; - -#if RCT_NEW_ARCH_ENABLED - [RCTComponentViewFactory currentComponentViewFactory].thirdPartyFabricComponentsProvider = self; -#endif - -#ifdef RN_FABRIC_ENABLED - _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:_bridge contextContainer:_contextContainer]; - - _bridge.surfacePresenter = _bridgeAdapter.surfacePresenter; - - UIView *rootView = [[RCTFabricSurfaceHostingProxyRootView alloc] initWithBridge:_bridge - moduleName:@"RNTesterApp" - initialProperties:initProps]; + self.moduleName = @"RNTesterApp"; + // You can add your custom initial props in the dictionary below. + // They will be passed down to the ViewController used by React Native. + self.initialProps = [self prepareInitialProps]; - [self registerPaperComponents:@[ @"RNTMyLegacyNativeView" ]]; -#else - UIView *rootView = [[RCTRootView alloc] initWithBridge:_bridge moduleName:@"RNTesterApp" initialProperties:initProps]; -#endif - - self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - UIViewController *rootViewController = [UIViewController new]; - rootViewController.view = rootView; - self.window.rootViewController = rootViewController; - [self.window makeKeyAndVisible]; - [self initializeFlipper:application]; - - return YES; -} - -- (BOOL)concurrentRootEnabled -{ - // Switch this bool to turn on and off the concurrent root - return true; + return [super application:application didFinishLaunchingWithOptions:launchOptions]; } - (NSDictionary *)prepareInitialProps @@ -173,34 +42,14 @@ - (NSDictionary *)prepareInitialProps initProps[@"exampleFromAppetizeParams"] = [NSString stringWithFormat:@"rntester://example/%@Example", _routeUri]; } -#ifdef RN_FABRIC_ENABLED - initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]); -#endif - return initProps; } -- (NSURL *)sourceURLForBridge:(__unused RCTBridge *)bridge +- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"js/RNTesterApp.ios"]; } -- (void)initializeFlipper:(UIApplication *)application -{ -#if DEBUG -#ifdef FB_SONARKIT_ENABLED - FlipperClient *client = [FlipperClient sharedClient]; - SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; - [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application - withDescriptorMapper:layoutDescriptorMapper]]; - [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; - [client addPlugin:[FlipperKitReactPlugin new]]; - [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; - [client start]; -#endif -#endif -} - - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options @@ -215,108 +64,20 @@ - (void)loadSourceForBridge:(RCTBridge *)bridge [RCTJavaScriptLoader loadBundleAtURL:[self sourceURLForBridge:bridge] onProgress:onProgress onComplete:loadCallback]; } -#pragma mark - RCTCxxBridgeDelegate - -// This function is called during -// `[[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];` -- (std::unique_ptr)jsExecutorFactoryForBridge:(RCTBridge *)bridge -{ - std::shared_ptr callInvoker = bridge.jsCallInvoker; - _runtimeScheduler = std::make_shared(RCTRuntimeExecutorFromBridge(bridge)); - -#ifdef RN_FABRIC_ENABLED - _contextContainer->erase("RuntimeScheduler"); - _contextContainer->insert("RuntimeScheduler", _runtimeScheduler); - callInvoker = std::make_shared(_runtimeScheduler); -#endif - - RCTTurboModuleManager *turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge - delegate:self - jsInvoker:callInvoker]; - [bridge setRCTTurboModuleRegistry:turboModuleManager]; - -#if RCT_DEV - /** - * Eagerly initialize RCTDevMenu so CMD + d, CMD + i, and CMD + r work. - * This is a stop gap until we have a system to eagerly init Turbo Modules. - */ - [turboModuleManager moduleForName:"RCTDevMenu"]; -#endif - - __weak __typeof(self) weakSelf = self; - -#if RCT_USE_HERMES - return std::make_unique( -#else - return std::make_unique( -#endif - facebook::react::RCTJSIExecutorRuntimeInstaller([weakSelf, bridge, turboModuleManager]( - facebook::jsi::Runtime &runtime) { - if (!bridge) { - return; - } - - __typeof(self) strongSelf = weakSelf; - if (strongSelf && strongSelf->_runtimeScheduler) { - facebook::react::RuntimeSchedulerBinding::createAndInstallIfNeeded(runtime, strongSelf->_runtimeScheduler); - } - - facebook::react::RuntimeExecutor syncRuntimeExecutor = - [&](std::function &&callback) { callback(runtime); }; - [turboModuleManager installJSBindingWithRuntimeExecutor:syncRuntimeExecutor]; - })); -} - -#pragma mark - RCTTurboModuleManagerDelegate - -- (Class)getModuleClassFromName:(const char *)name -{ - return facebook::react::RNTesterTurboModuleClassProvider(name); -} - - (std::shared_ptr)getTurboModule:(const std::string &)name jsInvoker:(std::shared_ptr)jsInvoker { - return facebook::react::RNTesterTurboModuleProvider(name, jsInvoker); -} - -- (id)getModuleInstanceFromClass:(Class)moduleClass -{ - // Set up the default RCTImageLoader and RCTNetworking modules. - if (moduleClass == RCTImageLoader.class) { - return [[moduleClass alloc] initWithRedirectDelegate:nil - loadersProvider:^NSArray> *(RCTModuleRegistry *) { - return @[ [RCTLocalAssetImageLoader new] ]; - } - decodersProvider:^NSArray> *(RCTModuleRegistry *) { - return @[ [RCTGIFImageDecoder new] ]; - }]; - } else if (moduleClass == RCTNetworking.class) { - return [[moduleClass alloc] initWithHandlersProvider:^NSArray> *(RCTModuleRegistry *) { - return @[ - [RCTHTTPRequestHandler new], - [RCTDataRequestHandler new], - [RCTFileRequestHandler new], - ]; - }]; + if (name == std::string([@"SampleTurboCxxModule" UTF8String])) { + return std::make_shared(jsInvoker); } - // No custom initializer here. - return [moduleClass new]; -} - -#pragma mark - Interop layer - -- (void)registerPaperComponents:(NSArray *)components -{ -#if RCT_NEW_ARCH_ENABLED - for (NSString *component in components) { - [RCTLegacyViewManagerInteropComponentView supportLegacyViewManagerWithName:component]; +#ifdef RCT_NEW_ARCH_ENABLED + if (name == std::string([@"NativeCxxModuleExampleCxx" UTF8String])) { + return std::make_shared(jsInvoker); } #endif + return nullptr; } -#pragma mark - Push Notifications - #if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC // Required to register for notifications diff --git a/packages/rn-tester/RNTester/RNTesterTurboModuleProvider.h b/packages/rn-tester/RNTester/RNTesterTurboModuleProvider.h deleted file mode 100644 index 3ca84512719340..00000000000000 --- a/packages/rn-tester/RNTester/RNTesterTurboModuleProvider.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -namespace facebook { -namespace react { - -/** - * Provide the TurboModule class for the given name. - */ -Class RNTesterTurboModuleClassProvider(const char *name); - -/** - * Provide a pure C++ instance of a TurboModule, specific to this app. - */ -std::shared_ptr RNTesterTurboModuleProvider( - const std::string &name, - std::shared_ptr jsInvoker); - -} // namespace react -} // namespace facebook diff --git a/packages/rn-tester/RNTester/RNTesterTurboModuleProvider.mm b/packages/rn-tester/RNTester/RNTesterTurboModuleProvider.mm deleted file mode 100644 index 32e5c3418013a9..00000000000000 --- a/packages/rn-tester/RNTester/RNTesterTurboModuleProvider.mm +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RNTesterTurboModuleProvider.h" - -#ifdef RCT_NEW_ARCH_ENABLED -#import -#endif -#import -#import -#import - -// NOTE: This entire file should be codegen'ed. - -namespace facebook { -namespace react { - -Class RNTesterTurboModuleClassProvider(const char *name) -{ - return RCTCoreModulesClassProvider(name); -} - -std::shared_ptr RNTesterTurboModuleProvider( - const std::string &name, - std::shared_ptr jsInvoker) -{ - if (name == "SampleTurboCxxModule") { - return std::make_shared(jsInvoker); - } -#ifdef RCT_NEW_ARCH_ENABLED - if (name == "NativeCxxModuleExampleCxx") { - return std::make_shared(jsInvoker); - } -#endif - return nullptr; -} - -} // namespace react -} // namespace facebook diff --git a/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj b/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj index 4e5505f231fb69..01af6ae1065c2d 100644 --- a/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj +++ b/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj @@ -15,7 +15,6 @@ 383889DA23A7398900D06C3E /* RCTConvert_UIColorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 383889D923A7398900D06C3E /* RCTConvert_UIColorTests.m */; }; 3D2AFAF51D646CF80089D1A3 /* legacy_image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */; }; 5C60EB1C226440DB0018C04F /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C60EB1B226440DB0018C04F /* AppDelegate.mm */; }; - 5CB07C9B226467E60039471C /* RNTesterTurboModuleProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB07C99226467E60039471C /* RNTesterTurboModuleProvider.mm */; }; 8145AE06241172D900A3F8DA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8145AE05241172D900A3F8DA /* LaunchScreen.storyboard */; }; 953D44E0A849F5064163EA24 /* libPods-RNTesterIntegrationTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F4A7C4C85AB0198A25D51E4 /* libPods-RNTesterIntegrationTests.a */; }; BE3BEE3556275C62F33864C8 /* libPods-RNTesterUnitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6144DEEE56C6C17B301A90E4 /* libPods-RNTesterUnitTests.a */; }; @@ -96,8 +95,6 @@ 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "legacy_image@2x.png"; path = "RNTester/legacy_image@2x.png"; sourceTree = ""; }; 4F4A7C4C85AB0198A25D51E4 /* libPods-RNTesterIntegrationTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTesterIntegrationTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 5C60EB1B226440DB0018C04F /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = RNTester/AppDelegate.mm; sourceTree = ""; }; - 5CB07C99226467E60039471C /* RNTesterTurboModuleProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RNTesterTurboModuleProvider.mm; path = RNTester/RNTesterTurboModuleProvider.mm; sourceTree = ""; }; - 5CB07C9A226467E60039471C /* RNTesterTurboModuleProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNTesterTurboModuleProvider.h; path = RNTester/RNTesterTurboModuleProvider.h; sourceTree = ""; }; 6144DEEE56C6C17B301A90E4 /* libPods-RNTesterUnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTesterUnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 7FC437025B5EE3899315628B /* Pods-RNTester.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTester.release.xcconfig"; path = "Target Support Files/Pods-RNTester/Pods-RNTester.release.xcconfig"; sourceTree = ""; }; 8145AE05241172D900A3F8DA /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = RNTester/LaunchScreen.storyboard; sourceTree = ""; }; @@ -230,8 +227,6 @@ E771AEEA22B44E3100EA1189 /* Info.plist */, 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 5C60EB1B226440DB0018C04F /* AppDelegate.mm */, - 5CB07C9A226467E60039471C /* RNTesterTurboModuleProvider.h */, - 5CB07C99226467E60039471C /* RNTesterTurboModuleProvider.mm */, 13B07FB71A68108700A75B9A /* main.m */, 2DDEF00F1F84BF7B00DBDF73 /* Images.xcassets */, 8145AE05241172D900A3F8DA /* LaunchScreen.storyboard */, @@ -762,7 +757,6 @@ buildActionMask = 2147483647; files = ( 272E6B3F1BEA849E001FCF37 /* UpdatePropertiesExampleView.m in Sources */, - 5CB07C9B226467E60039471C /* RNTesterTurboModuleProvider.mm in Sources */, 27F441EC1BEBE5030039B79C /* FlexibleSizeExampleView.m in Sources */, 5C60EB1C226440DB0018C04F /* AppDelegate.mm in Sources */, 13B07FC11A68108700A75B9A /* main.m in Sources */, diff --git a/packages/rn-tester/react-native.config.js b/packages/rn-tester/react-native.config.js index 099000c501058d..b3ad6adb66f61b 100644 --- a/packages/rn-tester/react-native.config.js +++ b/packages/rn-tester/react-native.config.js @@ -28,6 +28,7 @@ module.exports = { project: { ios: { sourceDir: '.', + unstable_reactLegacyComponentNames: ['RNTMyLegacyNativeView'], }, android: { sourceDir: '../../', From 323b7f85363aa59699e1e5fdcb4ce9b8cfcb770c Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Tue, 30 May 2023 04:10:17 -0700 Subject: [PATCH 05/33] Backporting a fix for hermesc on linux (#37596) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37596 This commit is a backport of this [commit](https://github.com/facebook/react-native/commit/32327cc17779659bc441580d44784a60a74ede32) so that we build the right version of hermes in CI. This also bumps the hermes keys to make sure that we are building it properly from now on. ## Changelog: [Internal] - Fix Hermes versioning and bump hermes workspace keys Reviewed By: cortinico Differential Revision: D46225179 fbshipit-source-id: f00c9d20d37f3bd5689e0742063f98e3bfe373c2 --- .circleci/config.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6ce5e972848378..8babd32c1d91da 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -59,7 +59,7 @@ references: checkout_cache_key: &checkout_cache_key v1-checkout gems_cache_key: &gems_cache_key v1-gems-{{ checksum "Gemfile.lock" }} gradle_cache_key: &gradle_cache_key v1-gradle-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "packages/react-native/ReactAndroid/gradle.properties" }} - hermes_workspace_cache_key: &hermes_workspace_cache_key v4-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }} + hermes_workspace_cache_key: &hermes_workspace_cache_key v5-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }} hermes_workspace_debug_cache_key: &hermes_workspace_debug_cache_key v2-hermes-{{ .Environment.CIRCLE_JOB }}-debug-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }} hermes_workspace_release_cache_key: &hermes_workspace_release_cache_key v2-hermes-{{ .Environment.CIRCLE_JOB }}-release-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }} hermes_linux_cache_key: &hermes_linux_cache_key v1-hermes-{{ .Environment.CIRCLE_JOB }}-linux-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }} @@ -1109,7 +1109,7 @@ jobs: - image: debian:11 environment: - HERMES_WS_DIR: *hermes_workspace_root - - HERMES_VERSION_FILE: "sdks/.hermesversion" + - HERMES_VERSION_FILE: "packages/react-native/sdks/.hermesversion" - BUILD_FROM_SOURCE: true steps: - run: @@ -1128,8 +1128,11 @@ jobs: mkdir -p "/tmp/hermes" "/tmp/hermes/download" "/tmp/hermes/hermes" if [ -f "$HERMES_VERSION_FILE" ]; then + echo "Hermes Version file found! Using this version for the build:" cat $HERMES_VERSION_FILE > /tmp/hermes/hermesversion else + echo "Hermes Version file not found!!!" + echo "Using the last commit from main for the build:" HERMES_TAG_SHA=$(git ls-remote https://github.com/facebook/hermes main | cut -f 1 | tr -d '[:space:]') echo $HERMES_TAG_SHA > /tmp/hermes/hermesversion fi From 5eadd935e8be0d3460c05d2d2919836ba1d6b4b0 Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Tue, 30 May 2023 04:12:38 -0700 Subject: [PATCH 06/33] Attempt at fixing crash when blurring image on iOS (#37614) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37614 changelog: [internal] We do not control what `vImageBoxConvolve_ARGB8888` returns, it may return 0. If it does return 0, we will allocate memory chunk of size 0. Yes, malloc will let you do that. Well, it depends on the implementation, but according to the spec it is legal. The only requirement is to by able to call free on that without crash. If `vImageBoxConvolve_ARGB8888` does return 0 and we allocate memory of size 0. Call to `vImageBoxConvolve_ARGB8888` with tempBuffer of size 0 will lead to a crash. [The documentation](https://developer.apple.com/documentation/accelerate/1515945-vimageboxconvolve_argb8888#discussion) for `vImageBoxConvolve_ARGB8888` and tempBuffer states: > To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which **should be a positive value**. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size. I think the keyword word there is "should be a positive value". 0 is not a positive value. Reviewed By: javache, yungsters Differential Revision: D46263204 fbshipit-source-id: baa8fac5b3be6fb5bed02800cd725cc4cf43485a --- packages/react-native/Libraries/Image/RCTImageBlurUtils.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/Libraries/Image/RCTImageBlurUtils.m b/packages/react-native/Libraries/Image/RCTImageBlurUtils.m index 7214a87d4c860a..e5a17309473b12 100644 --- a/packages/react-native/Libraries/Image/RCTImageBlurUtils.m +++ b/packages/react-native/Libraries/Image/RCTImageBlurUtils.m @@ -54,7 +54,7 @@ // create temp buffer vImage_Error tempBufferSize = vImageBoxConvolve_ARGB8888( &buffer1, &buffer2, NULL, 0, 0, boxSize, boxSize, NULL, kvImageGetTempBufferSize | kvImageEdgeExtend); - if (tempBufferSize < 0) { + if (tempBufferSize <= 0) { free(buffer1.data); free(buffer2.data); return inputImage; From d3e35992e904d191224d8cc949c2e7e3b3cacbe5 Mon Sep 17 00:00:00 2001 From: Douglas Lowder Date: Tue, 30 May 2023 06:44:49 -0700 Subject: [PATCH 07/33] Fix Fabric issue with React-Core pod when Xcode project has multiple targets (#37581) Summary: In Xcode projects with multiple targets, and in particular when targets are for different platforms (e.g. iOS and macOS), Cocoapods may add a suffix to a Pod name like `React-Core`. When this happens, the code in `new_architecture.rb` (which was looking for a pod with exact name `React-Core`) would not add the preprocessor definitions for Fabric as expected. This change fixes this issue. Fixes https://github.com/facebook/react-native/issues/37102 . ## Changelog: [iOS] [Fixed] - Fix Fabric issue with React-Core pod when Xcode project has multiple targets Pull Request resolved: https://github.com/facebook/react-native/pull/37581 Test Plan: Tested that this change fixes this issue which occurs 100% of the time in React Native TV projects. Reviewed By: dmytrorykun Differential Revision: D46264704 Pulled By: cipolleschi fbshipit-source-id: 8dfc8e342b5a110ef1f028636e01e5c5f2b6e2f0 --- packages/react-native/scripts/cocoapods/new_architecture.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/react-native/scripts/cocoapods/new_architecture.rb b/packages/react-native/scripts/cocoapods/new_architecture.rb index 1b66a14684cec6..192d2702645a9f 100644 --- a/packages/react-native/scripts/cocoapods/new_architecture.rb +++ b/packages/react-native/scripts/cocoapods/new_architecture.rb @@ -16,7 +16,8 @@ def self.set_clang_cxx_language_standard_if_needed(installer) language_standard = nil installer.pods_project.targets.each do |target| - if target.name == 'React-Core' + # The React-Core pod may have a suffix added by Cocoapods, so we test whether 'React-Core' is a substring, and do not require exact match + if target.name.include? 'React-Core' language_standard = target.resolved_build_setting("CLANG_CXX_LANGUAGE_STANDARD", resolve_against_xcconfig: true).values[0] end end @@ -61,7 +62,8 @@ def self.modify_flags_for_new_architecture(installer, is_new_arch_enabled) # Add RCT_NEW_ARCH_ENABLED to generated pod target projects installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result| - if pod_name == 'React-Core' + # The React-Core pod may have a suffix added by Cocoapods, so we test whether 'React-Core' is a substring, and do not require exact match + if pod_name.include? 'React-Core' target_installation_result.native_target.build_configurations.each do |config| config.build_settings['OTHER_CPLUSPLUSFLAGS'] = @@new_arch_cpp_flags end From 50992be4054f78b8277665a8355391b5f3fa836f Mon Sep 17 00:00:00 2001 From: Pranav Yadav Date: Tue, 30 May 2023 07:14:25 -0700 Subject: [PATCH 08/33] Remove `greet.yml` action (#37587) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: This (`greet.yml`) action requires some _changes_ to "repo" settings which are _out of maintainers' controls_. So, instead of wasting compute; let's just delete this action :( 🤗🌏 ## Changelog: [GENERAL] [REMOVED] - [Actions] Remove `greet.yml` action Pull Request resolved: https://github.com/facebook/react-native/pull/37587 Test Plan: - Not needed. Reviewed By: cortinico Differential Revision: D46275607 Pulled By: cipolleschi fbshipit-source-id: 80880568cbae1158006445e078e638e4e375cb73 --- .github/workflows/greet.yml | 50 ------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 .github/workflows/greet.yml diff --git a/.github/workflows/greet.yml b/.github/workflows/greet.yml deleted file mode 100644 index 7828f08ed188f8..00000000000000 --- a/.github/workflows/greet.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: 🎉 Greet First Time Contributors 🎉 -# This workflow is triggered on pull requests. - -on: - pull_request: - types: [opened] - -permissions: - contents: read - -jobs: - check_for_first_contribution: - name: '🎉 Greet First Time Contributors' - permissions: - contents: read - pull-requests: write # for actions/first-interaction to comment on PR - runs-on: ubuntu-latest - steps: - - uses: actions/first-interaction@v1.1.1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - pr-message: | - "### Hi there, :wave: - - ### Congratulations :tada: on your **_'First Pull Request'_** to [React Native](https://github.com/facebook/react-native)! :partying_face: - - Thank you, :pray: for taking the time to contribute to this project and share your ideas. - - Someone from the team will review your PR and get back to you _as soon as possible_ with feedback if any. :blush: Post review, and if all tests are passing, your PR will be _imported_ to internal FB phabricator and should be merged if it also passes all internal tests. :partying_face: - -
- P.S.: In the meantime, you should go through below checklist: (click to expand) - - - 1. Make sure you have _signed_ the [CLA](https://code.facebook.com/cla) :balance_scale:, - 2. There are _no_ typos :sweat_smile:, - 3. There are _no_ warnings reported by the **Danger** workflow :robot:, - 4. You ran `yarn prettier` and `yarn lint` :nail_care:, - 5. All tests :test_tube: are _passing_. i.e. The CI checks should be green :green_circle:, and - 6. You have _added_ necessary tests for your code, if it's a refactor or a new functionality. :test_tube: - -
- - --- - - - - [Contributing Guidelines](https://reactnative.dev/contributing/overview) | [React Native Website](https://reactnative.dev/) | [Framework discussions, proposals and RFCs](https://github.com/react-native-community/discussions-and-proposals/discussions) - - " From b0864fd9df18bde34208b0ce343c97e1d6e9d928 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Tue, 30 May 2023 07:15:02 -0700 Subject: [PATCH 09/33] Add tests in CI not to break Hermes-Xcode integration (#37616) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37616 Add tests in CircleCI to avoid that changes in Hermes can break the Xcode integration. ## Changelog: [Internal] - Add CI tests to avoid to break the Hermes-Xcode integration Reviewed By: cortinico Differential Revision: D46265656 fbshipit-source-id: 176f1a33fe6944a68fb14b62e5c626fe30d296cc --- .circleci/config.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8babd32c1d91da..8a7d38a0b3f1df 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -922,6 +922,32 @@ jobs: # ------------------------- # JOBS: Test iOS RNTester # ------------------------- + # This job builds configures Xcode so that Hermes is built from source + # (but only the iphonesimulator slice) and integrated with the Xcode + # build toolchain. The `test_ios_rntester` job, instead, takes the + # same prebuilt for Hermes that we are going to use in the Release. + test_ios_rntester_hermes_xcode_integration: + executor: reactnativeios + steps: + - checkout_code_with_cache + - run_yarn + - brew_install: + package: cmake + - run: + name: Pod install + command: | + cd packages/rn-tester + rm -rf Pods Podfile.lock + bundle install + RCT_NEW_ARCH_ENABLED=1 bundle exec pod install + - run: + name: Build RNTester + command: | + xcodebuild build \ + -workspace packages/rn-tester/RNTesterPods.xcworkspace \ + -scheme RNTester \ + -sdk iphonesimulator + test_ios_rntester: executor: reactnativeios parameters: @@ -1600,6 +1626,7 @@ workflows: - equal: [ false, << pipeline.parameters.run_nightly_workflow >> ] jobs: - prepare_hermes_workspace + - test_ios_rntester_hermes_xcode_integration - build_hermesc_linux: requires: - prepare_hermes_workspace From da3dcd73262e8285715990d4c23a537a9e9223f3 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Tue, 30 May 2023 07:20:25 -0700 Subject: [PATCH 10/33] Use SurfaceRegistry globals whenever available (#37410) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37410 Incremental adoption of new bridgeless API's, where they are semantically equivalent to the old one. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D45736529 fbshipit-source-id: e41f6840e7c329f6051530e53773fae760584842 --- .../uimanager/SurfaceRegistryBinding.cpp | 120 +++++++----------- 1 file changed, 47 insertions(+), 73 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/SurfaceRegistryBinding.cpp b/packages/react-native/ReactCommon/react/renderer/uimanager/SurfaceRegistryBinding.cpp index 14cb0235ed3317..91125c1f9a595d 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/SurfaceRegistryBinding.cpp +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/SurfaceRegistryBinding.cpp @@ -13,6 +13,22 @@ namespace facebook::react { +namespace { + +void throwIfBridgeless( + jsi::Runtime &runtime, + jsi::Object &global, + const char *methodName) { + auto isBridgeless = global.getProperty(runtime, "RN$Bridgeless"); + if (isBridgeless.isBool() && isBridgeless.asBool()) { + throw std::runtime_error( + "SurfaceRegistryBinding::" + std::string(methodName) + + " failed. Global was not installed."); + } +} + +} // namespace + void SurfaceRegistryBinding::startSurface( jsi::Runtime &runtime, SurfaceId surfaceId, @@ -26,43 +42,24 @@ void SurfaceRegistryBinding::startSurface( parameters["fabric"] = true; auto global = runtime.global(); - auto isBridgeless = global.hasProperty(runtime, "RN$Bridgeless") && - global.getProperty(runtime, "RN$Bridgeless").asBool(); - - if (isBridgeless) { - if (!global.hasProperty(runtime, "RN$SurfaceRegistry")) { - throw std::runtime_error( - "SurfaceRegistryBinding::startSurface: Failed to start Surface \"" + - moduleName + "\". global.RN$SurfaceRegistry was not installed."); - } - - auto registry = global.getPropertyAsObject(runtime, "RN$SurfaceRegistry"); - auto method = registry.getPropertyAsFunction(runtime, "renderSurface"); + auto registry = global.getProperty(runtime, "RN$AppRegistry"); + if (registry.isObject()) { + auto method = std::move(registry).asObject(runtime).getPropertyAsFunction( + runtime, "runApplication"); method.call( runtime, {jsi::String::createFromUtf8(runtime, moduleName), jsi::valueFromDynamic(runtime, parameters), jsi::Value(runtime, displayModeToInt(displayMode))}); } else { - if (moduleName != "LogBox" && - global.hasProperty(runtime, "RN$SurfaceRegistry")) { - auto registry = global.getPropertyAsObject(runtime, "RN$SurfaceRegistry"); - auto method = registry.getPropertyAsFunction(runtime, "renderSurface"); - - method.call( - runtime, - {jsi::String::createFromUtf8(runtime, moduleName), - jsi::valueFromDynamic(runtime, parameters), - jsi::Value(runtime, displayModeToInt(displayMode))}); - } else { - callMethodOfModule( - runtime, - "AppRegistry", - "runApplication", - {jsi::String::createFromUtf8(runtime, moduleName), - jsi::valueFromDynamic(runtime, parameters), - jsi::Value(runtime, displayModeToInt(displayMode))}); - } + throwIfBridgeless(runtime, global, "startSurface"); + callMethodOfModule( + runtime, + "AppRegistry", + "runApplication", + {jsi::String::createFromUtf8(runtime, moduleName), + jsi::valueFromDynamic(runtime, parameters), + jsi::Value(runtime, displayModeToInt(displayMode))}); } } @@ -79,44 +76,24 @@ void SurfaceRegistryBinding::setSurfaceProps( parameters["fabric"] = true; auto global = runtime.global(); - auto isBridgeless = global.hasProperty(runtime, "RN$Bridgeless") && - global.getProperty(runtime, "RN$Bridgeless").asBool(); - - if (isBridgeless) { - if (!global.hasProperty(runtime, "RN$SurfaceRegistry")) { - throw std::runtime_error( - "SurfaceRegistryBinding::setSurfaceProps: Failed to set Surface props for \"" + - moduleName + "\". global.RN$SurfaceRegistry was not installed."); - } - - auto registry = global.getPropertyAsObject(runtime, "RN$SurfaceRegistry"); - auto method = registry.getPropertyAsFunction(runtime, "setSurfaceProps"); - + auto registry = global.getProperty(runtime, "RN$AppRegistry"); + if (registry.isObject()) { + auto method = std::move(registry).asObject(runtime).getPropertyAsFunction( + runtime, "setSurfaceProps"); method.call( runtime, {jsi::String::createFromUtf8(runtime, moduleName), jsi::valueFromDynamic(runtime, parameters), jsi::Value(runtime, displayModeToInt(displayMode))}); } else { - if (moduleName != "LogBox" && - global.hasProperty(runtime, "RN$SurfaceRegistry")) { - auto registry = global.getPropertyAsObject(runtime, "RN$SurfaceRegistry"); - auto method = registry.getPropertyAsFunction(runtime, "setSurfaceProps"); - - method.call( - runtime, - {jsi::String::createFromUtf8(runtime, moduleName), - jsi::valueFromDynamic(runtime, parameters), - jsi::Value(runtime, displayModeToInt(displayMode))}); - } else { - callMethodOfModule( - runtime, - "AppRegistry", - "setSurfaceProps", - {jsi::String::createFromUtf8(runtime, moduleName), - jsi::valueFromDynamic(runtime, parameters), - jsi::Value(runtime, displayModeToInt(displayMode))}); - } + throwIfBridgeless(runtime, global, "setSurfaceProps"); + callMethodOfModule( + runtime, + "AppRegistry", + "setSurfaceProps", + {jsi::String::createFromUtf8(runtime, moduleName), + jsi::valueFromDynamic(runtime, parameters), + jsi::Value(runtime, displayModeToInt(displayMode))}); } } @@ -124,18 +101,15 @@ void SurfaceRegistryBinding::stopSurface( jsi::Runtime &runtime, SurfaceId surfaceId) { auto global = runtime.global(); - auto isBridgeless = global.hasProperty(runtime, "RN$Bridgeless") && - global.getProperty(runtime, "RN$Bridgeless").asBool(); - - if (isBridgeless) { - if (!global.hasProperty(runtime, "RN$stopSurface")) { - // ReactFabric module has not been loaded yet; there's no surface to stop. - return; - } - // Bridgeless mode uses a custom JSI binding instead of callable module. - global.getPropertyAsFunction(runtime, "RN$stopSurface") + auto stopFunction = global.getProperty(runtime, "RN$stopSurface"); + if (stopFunction.isObject() && + stopFunction.asObject(runtime).isFunction(runtime)) { + std::move(stopFunction) + .asObject(runtime) + .asFunction(runtime) .call(runtime, {jsi::Value{surfaceId}}); } else { + throwIfBridgeless(runtime, global, "stopSurface"); callMethodOfModule( runtime, "ReactFabric", From 7f22db8ea034d1aed74103542b04af2a8a11caa1 Mon Sep 17 00:00:00 2001 From: Dmitry Rykun Date: Tue, 30 May 2023 08:04:23 -0700 Subject: [PATCH 11/33] Introduce __nativeComponentRegistry__getNativeViewConfig (#37522) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37522 This diff adds cross-platform Cxx binding helper and iOS specific implementation of `__nativeComponentRegistry__getNativeViewConfig` to JS runtime. This function provides native view config for a native component in bridgeless mode. Changelog: [Internal] - Introduce `__nativeComponentRegistry__getNativeViewConfig` in iOS. Reviewed By: javache Differential Revision: D43538804 fbshipit-source-id: 0aeca40c1c2a625eca5d60e466eb24df30453ba7 --- .../react-native/React/Base/RCTConstants.h | 6 ++ .../react-native/React/Base/RCTConstants.m | 15 +++++ .../react-native/React/Modules/RCTUIManager.h | 7 +++ .../react-native/React/Modules/RCTUIManager.m | 28 ++++++--- .../React/Views/RCTComponentData.h | 3 + .../React/Views/RCTComponentData.m | 29 ++++++---- .../NativeViewConfigProviderBinding.cpp | 30 ++++++++++ .../NativeViewConfigProviderBinding.h | 20 +++++++ .../platform/ios/Core/RCTInstance.mm | 6 ++ .../RCTNativeViewConfigProvider.h | 17 ++++++ .../RCTNativeViewConfigProvider.mm | 58 +++++++++++++++++++ 11 files changed, 199 insertions(+), 20 deletions(-) create mode 100644 packages/react-native/ReactCommon/react/bridgeless/nativeviewconfig/NativeViewConfigProviderBinding.cpp create mode 100644 packages/react-native/ReactCommon/react/bridgeless/nativeviewconfig/NativeViewConfigProviderBinding.h create mode 100644 packages/react-native/ReactCommon/react/bridgeless/platform/ios/NativeViewConfig/RCTNativeViewConfigProvider.h create mode 100644 packages/react-native/ReactCommon/react/bridgeless/platform/ios/NativeViewConfig/RCTNativeViewConfigProvider.mm diff --git a/packages/react-native/React/Base/RCTConstants.h b/packages/react-native/React/Base/RCTConstants.h index 217b7aabc21a10..b1c244ac93c228 100644 --- a/packages/react-native/React/Base/RCTConstants.h +++ b/packages/react-native/React/Base/RCTConstants.h @@ -81,3 +81,9 @@ RCT_EXTERN void RCTSetMemoryPressureUnloadLevel(int value); */ RCT_EXTERN BOOL RCTGetParseUnhandledJSErrorStackNatively(void); RCT_EXTERN void RCTSetParseUnhandledJSErrorStackNatively(BOOL value); + +/* + * Use native view configs in bridgeless mode + */ +RCT_EXTERN BOOL RCTGetUseNativeViewConfigsInBridgelessMode(void); +RCT_EXTERN void RCTSetUseNativeViewConfigsInBridgelessMode(BOOL value); diff --git a/packages/react-native/React/Base/RCTConstants.m b/packages/react-native/React/Base/RCTConstants.m index de1095f00187f8..81b8741d583fe8 100644 --- a/packages/react-native/React/Base/RCTConstants.m +++ b/packages/react-native/React/Base/RCTConstants.m @@ -81,3 +81,18 @@ void RCTSetParseUnhandledJSErrorStackNatively(BOOL value) { RCTParseUnhandledJSErrorStackNatively = value; } + +/* + * Use native view configs in bridgeless mode + */ +static BOOL RCTUseNativeViewConfigsInBridgelessMode = NO; + +BOOL RCTGetUseNativeViewConfigsInBridgelessMode(void) +{ + return RCTUseNativeViewConfigsInBridgelessMode; +} + +void RCTSetUseNativeViewConfigsInBridgelessMode(BOOL value) +{ + RCTUseNativeViewConfigsInBridgelessMode = value; +} diff --git a/packages/react-native/React/Modules/RCTUIManager.h b/packages/react-native/React/Modules/RCTUIManager.h index 77472622f3f863..67fc4289b62395 100644 --- a/packages/react-native/React/Modules/RCTUIManager.h +++ b/packages/react-native/React/Modules/RCTUIManager.h @@ -172,3 +172,10 @@ RCT_EXTERN NSString *const RCTUIManagerWillUpdateViewsDueToContentSizeMultiplier @property (nonatomic, readonly) RCTUIManager *uiManager; @end + +RCT_EXTERN NSMutableDictionary *RCTModuleConstantsForDestructuredComponent( + NSMutableDictionary *directEvents, + NSMutableDictionary *bubblingEvents, + Class managerClass, + NSString *name, + NSDictionary *viewConfig); diff --git a/packages/react-native/React/Modules/RCTUIManager.m b/packages/react-native/React/Modules/RCTUIManager.m index 3b8a8518c68456..6f03df143f1e9e 100644 --- a/packages/react-native/React/Modules/RCTUIManager.m +++ b/packages/react-native/React/Modules/RCTUIManager.m @@ -1463,10 +1463,12 @@ static void RCTMeasureLayout(RCTShadowView *view, RCTShadowView *ancestor, RCTRe }]; } -static NSMutableDictionary *moduleConstantsForComponent( +NSMutableDictionary *RCTModuleConstantsForDestructuredComponent( NSMutableDictionary *directEvents, NSMutableDictionary *bubblingEvents, - RCTComponentData *componentData) + Class managerClass, + NSString *name, + NSDictionary *viewConfig) { NSMutableDictionary *moduleConstants = [NSMutableDictionary new]; @@ -1476,10 +1478,9 @@ static void RCTMeasureLayout(RCTShadowView *view, RCTShadowView *ancestor, RCTRe NSMutableDictionary *directEventTypes = [NSMutableDictionary new]; // Add manager class - moduleConstants[@"Manager"] = RCTBridgeModuleNameForClass(componentData.managerClass); + moduleConstants[@"Manager"] = RCTBridgeModuleNameForClass(managerClass); // Add native props - NSDictionary *viewConfig = [componentData viewConfig]; moduleConstants[@"NativeProps"] = viewConfig[@"propTypes"]; moduleConstants[@"baseModuleName"] = viewConfig[@"baseModuleName"]; moduleConstants[@"bubblingEventTypes"] = bubblingEventTypes; @@ -1497,7 +1498,7 @@ static void RCTMeasureLayout(RCTShadowView *view, RCTShadowView *ancestor, RCTRe RCTLogError( @"Component '%@' re-registered bubbling event '%@' as a " "direct event", - componentData.name, + name, eventName); } } @@ -1518,7 +1519,7 @@ static void RCTMeasureLayout(RCTShadowView *view, RCTShadowView *ancestor, RCTRe RCTLogError( @"Component '%@' re-registered direct event '%@' as a " "bubbling event", - componentData.name, + name, eventName); } } @@ -1540,7 +1541,7 @@ static void RCTMeasureLayout(RCTShadowView *view, RCTShadowView *ancestor, RCTRe RCTLogError( @"Component '%@' re-registered direct event '%@' as a " "bubbling event", - componentData.name, + name, eventName); } } @@ -1548,6 +1549,15 @@ static void RCTMeasureLayout(RCTShadowView *view, RCTShadowView *ancestor, RCTRe return moduleConstants; } +static NSMutableDictionary *moduleConstantsForComponentData( + NSMutableDictionary *directEvents, + NSMutableDictionary *bubblingEvents, + RCTComponentData *componentData) +{ + return RCTModuleConstantsForDestructuredComponent( + directEvents, bubblingEvents, componentData.managerClass, componentData.name, componentData.viewConfig); +} + - (NSDictionary *)constantsToExport { return [self getConstants]; @@ -1563,7 +1573,7 @@ static void RCTMeasureLayout(RCTShadowView *view, RCTShadowView *ancestor, RCTRe enumerateKeysAndObjectsUsingBlock:^(NSString *name, RCTComponentData *componentData, __unused BOOL *stop) { RCTAssert(!constants[name], @"UIManager already has constants for %@", componentData.name); NSMutableDictionary *moduleConstants = - moduleConstantsForComponent(directEvents, bubblingEvents, componentData); + moduleConstantsForComponentData(directEvents, bubblingEvents, componentData); constants[name] = moduleConstants; }]; @@ -1611,7 +1621,7 @@ static void RCTMeasureLayout(RCTShadowView *view, RCTShadowView *ancestor, RCTRe NSMutableDictionary *directEvents = [NSMutableDictionary new]; NSMutableDictionary *bubblingEvents = [NSMutableDictionary new]; NSMutableDictionary *moduleConstants = - moduleConstantsForComponent(directEvents, bubblingEvents, componentData); + moduleConstantsForComponentData(directEvents, bubblingEvents, componentData); return @{ @"viewConfig" : moduleConstants, }; diff --git a/packages/react-native/React/Views/RCTComponentData.h b/packages/react-native/React/Views/RCTComponentData.h index 352f8262506d4b..1dd11977835026 100644 --- a/packages/react-native/React/Views/RCTComponentData.h +++ b/packages/react-native/React/Views/RCTComponentData.h @@ -42,8 +42,11 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, copy, nullable) void (^eventInterceptor) (NSString *eventName, NSDictionary *event, NSNumber *reactTag); ++ (NSDictionary *)viewConfigForViewMangerClass:(Class)managerClass; - (NSDictionary *)viewConfig; @end +RCT_EXTERN NSString *RCTViewManagerModuleNameForClass(Class managerClass); + NS_ASSUME_NONNULL_END diff --git a/packages/react-native/React/Views/RCTComponentData.m b/packages/react-native/React/Views/RCTComponentData.m index 8b345905809eb2..94b30a63480523 100644 --- a/packages/react-native/React/Views/RCTComponentData.m +++ b/packages/react-native/React/Views/RCTComponentData.m @@ -55,7 +55,7 @@ - (instancetype)initWithManagerClass:(Class)managerClass _viewPropBlocks = [NSMutableDictionary new]; _shadowPropBlocks = [NSMutableDictionary new]; - _name = moduleNameForClass(managerClass); + _name = RCTViewManagerModuleNameForClass(managerClass); } return self; } @@ -385,7 +385,7 @@ - (void)setProps:(NSDictionary *)props forShadowView:(RCTShadowV }]; } -- (NSDictionary *)viewConfig ++ (NSDictionary *)viewConfigForViewMangerClass:(Class)managerClass { NSMutableArray *bubblingEvents = [NSMutableArray new]; NSMutableArray *capturingEvents = [NSMutableArray new]; @@ -393,8 +393,8 @@ - (void)setProps:(NSDictionary *)props forShadowView:(RCTShadowV #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - if (RCTClassOverridesInstanceMethod(_managerClass, @selector(customBubblingEventTypes))) { - NSArray *events = [self.manager customBubblingEventTypes]; + if (RCTClassOverridesInstanceMethod(managerClass, @selector(customBubblingEventTypes))) { + NSArray *events = [[managerClass new] customBubblingEventTypes]; for (NSString *event in events) { [bubblingEvents addObject:RCTNormalizeInputEventName(event)]; } @@ -403,7 +403,7 @@ - (void)setProps:(NSDictionary *)props forShadowView:(RCTShadowV unsigned int count = 0; NSMutableDictionary *propTypes = [NSMutableDictionary new]; - Method *methods = class_copyMethodList(object_getClass(_managerClass), &count); + Method *methods = class_copyMethodList(object_getClass(managerClass), &count); for (unsigned int i = 0; i < count; i++) { SEL selector = method_getName(methods[i]); const char *selectorName = sel_getName(selector); @@ -418,13 +418,13 @@ - (void)setProps:(NSDictionary *)props forShadowView:(RCTShadowV } NSString *name = @(underscorePos + 1); - NSString *type = ((NSArray * (*)(id, SEL)) objc_msgSend)(_managerClass, selector)[0]; + NSString *type = ((NSArray * (*)(id, SEL)) objc_msgSend)(managerClass, selector)[0]; if (RCT_DEBUG && propTypes[name] && ![propTypes[name] isEqualToString:type]) { RCTLogError( @"Property '%@' of component '%@' redefined from '%@' " "to '%@'", name, - _name, + RCTViewManagerModuleNameForClass(managerClass), propTypes[name], type); } @@ -450,24 +450,31 @@ - (void)setProps:(NSDictionary *)props forShadowView:(RCTShadowV RCTLogError( @"Component '%@' registered '%@' as both a bubbling event " "and a direct event", - _name, + RCTViewManagerModuleNameForClass(managerClass), event); } } #endif - Class superClass = [_managerClass superclass]; + Class superClass = [managerClass superclass]; return @{ @"propTypes" : propTypes, @"directEvents" : directEvents, @"bubblingEvents" : bubblingEvents, @"capturingEvents" : capturingEvents, - @"baseModuleName" : superClass == [NSObject class] ? (id)kCFNull : moduleNameForClass(superClass), + @"baseModuleName" : superClass == [NSObject class] ? (id)kCFNull : RCTViewManagerModuleNameForClass(superClass), }; } -static NSString *moduleNameForClass(Class managerClass) +- (NSDictionary *)viewConfig +{ + // Make sure the manager is initialized before accessing view config. + [self manager]; + return [RCTComponentData viewConfigForViewMangerClass:_managerClass]; +} + +NSString *RCTViewManagerModuleNameForClass(Class managerClass) { // Hackety hack, this partially re-implements RCTBridgeModuleNameForClass // We want to get rid of RCT and RK prefixes, but a lot of JS code still references diff --git a/packages/react-native/ReactCommon/react/bridgeless/nativeviewconfig/NativeViewConfigProviderBinding.cpp b/packages/react-native/ReactCommon/react/bridgeless/nativeviewconfig/NativeViewConfigProviderBinding.cpp new file mode 100644 index 00000000000000..d29eca015d1087 --- /dev/null +++ b/packages/react-native/ReactCommon/react/bridgeless/nativeviewconfig/NativeViewConfigProviderBinding.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include "NativeViewConfigProviderBinding.h" + +namespace facebook::react::NativeViewConfigProviderBinding { + +void install(jsi::Runtime &runtime, ProviderType &&provider) { + auto name = "RN$NativeComponentRegistry_getNativeViewConfig"; + auto hostFunction = [provider = std::move(provider)]( + jsi::Runtime &runtime, + jsi::Value const & /*thisValue*/, + jsi::Value const *args, + size_t count) -> jsi::Value { + if (count != 1 || !args[0].isString()) { + throw new jsi::JSError(runtime, "1 argument of type String expected."); + } + return provider(args[0].getString(runtime).utf8(runtime)); + }; + + auto jsiFunction = jsi::Function::createFromHostFunction( + runtime, jsi::PropNameID::forAscii(runtime, name), 2, hostFunction); + + runtime.global().setProperty(runtime, name, jsiFunction); +} +} // namespace facebook::react::NativeViewConfigProviderBinding diff --git a/packages/react-native/ReactCommon/react/bridgeless/nativeviewconfig/NativeViewConfigProviderBinding.h b/packages/react-native/ReactCommon/react/bridgeless/nativeviewconfig/NativeViewConfigProviderBinding.h new file mode 100644 index 00000000000000..b635eab8777117 --- /dev/null +++ b/packages/react-native/ReactCommon/react/bridgeless/nativeviewconfig/NativeViewConfigProviderBinding.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include + +namespace facebook::react::NativeViewConfigProviderBinding { + +using ProviderType = std::function; + +/* + * Installs native view config provider into JavaScript runtime. + */ +void install(jsi::Runtime &runtime, ProviderType &&provider); +} // namespace facebook::react::NativeViewConfigProviderBinding diff --git a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.mm b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.mm index 3873592bf54517..20b4d77c8da5de 100644 --- a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.mm +++ b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.mm @@ -14,6 +14,7 @@ #import #import #import +#import #import #import #import @@ -25,6 +26,7 @@ #import #import #import +#import #import #import #import @@ -283,6 +285,10 @@ - (void)_start }); RCTInstallNativeComponentRegistryBinding(runtime); + if (RCTGetUseNativeViewConfigsInBridgelessMode()) { + installNativeViewConfigProviderBinding(runtime); + } + if (strongSelf->_bindingsInstallFunc) { strongSelf->_bindingsInstallFunc(runtime); } diff --git a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/NativeViewConfig/RCTNativeViewConfigProvider.h b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/NativeViewConfig/RCTNativeViewConfigProvider.h new file mode 100644 index 00000000000000..2f5c555581a294 --- /dev/null +++ b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/NativeViewConfig/RCTNativeViewConfigProvider.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include + +namespace facebook::react { +/* + * Installs native view config provider into JavaScript runtime. + */ +void installNativeViewConfigProviderBinding(jsi::Runtime &runtime); +} // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/NativeViewConfig/RCTNativeViewConfigProvider.mm b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/NativeViewConfig/RCTNativeViewConfigProvider.mm new file mode 100644 index 00000000000000..97108934347076 --- /dev/null +++ b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/NativeViewConfig/RCTNativeViewConfigProvider.mm @@ -0,0 +1,58 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include "RCTNativeViewConfigProvider.h" + +#import +#import +#import +#import +#import +#import + +namespace facebook::react { +namespace { + +// This function eagerly loads module constants for every RCTViewManager subclass. +// This is not compatible with lazily loaded modules, but we don't have them in OSS, so that's fine for now. +NSDictionary *eagerViewConfigs() +{ + static NSMutableDictionary *result = [NSMutableDictionary new]; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + auto directEvents = [NSMutableDictionary new]; + auto bubblingEvents = [NSMutableDictionary new]; + for (Class moduleClass in RCTGetModuleClasses()) { + if ([moduleClass isSubclassOfClass:RCTViewManager.class]) { + auto name = RCTViewManagerModuleNameForClass(moduleClass); + auto viewConfig = [RCTComponentData viewConfigForViewMangerClass:moduleClass]; + auto moduleConstants = + RCTModuleConstantsForDestructuredComponent(directEvents, bubblingEvents, moduleClass, name, viewConfig); + result[name] = moduleConstants; + } + } + }); + return result; +} + +jsi::Value provideNativeViewConfig(facebook::jsi::Runtime &runtime, std::string const &name) +{ + auto componentName = [NSString stringWithCString:name.c_str() encoding:NSASCIIStringEncoding]; + auto viewConfig = eagerViewConfigs()[componentName]; + return TurboModuleConvertUtils::convertObjCObjectToJSIValue(runtime, viewConfig); +}; + +} // namespace + +void installNativeViewConfigProviderBinding(jsi::Runtime &runtime) +{ + auto nativeViewConfigProvider = [&runtime](std::string const &name) -> jsi::Value { + return provideNativeViewConfig(runtime, name); + }; + NativeViewConfigProviderBinding::install(runtime, std::move(nativeViewConfigProvider)); +} +} // namespace facebook::react From 02a73ca85653ff4de5c350410a68061426ecf587 Mon Sep 17 00:00:00 2001 From: Kevin VanGelder Date: Tue, 30 May 2023 12:13:12 -0700 Subject: [PATCH 12/33] Fix missing `atomic` import (#37621) Summary: Native error: `Declaration of 'atomic_bool' must be imported from module 'std.atomic' before it is required.` ## Changelog: [IOS] [FIXED] - Add missing `atomic` import Pull Request resolved: https://github.com/facebook/react-native/pull/37621 Test Plan: This build error appears to only occur when other build errors occur, but it supersedes the other build errors, increasing the difficulty of debugging the root build error(s). Reviewed By: NickGerleman Differential Revision: D46284208 Pulled By: sammy-SC fbshipit-source-id: b36cb3a9166b1e7cef0121a2e635a191bd7c3a5e --- packages/react-native/React/CxxBridge/RCTMessageThread.h | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-native/React/CxxBridge/RCTMessageThread.h b/packages/react-native/React/CxxBridge/RCTMessageThread.h index cbd85025c9f8e4..1232a9e6bc2b39 100644 --- a/packages/react-native/React/CxxBridge/RCTMessageThread.h +++ b/packages/react-native/React/CxxBridge/RCTMessageThread.h @@ -12,6 +12,7 @@ #import #import +#import namespace facebook::react { From 88eef42cabcc0b0c5ba5a884bbb3ffd30e8b5726 Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Tue, 30 May 2023 13:00:07 -0700 Subject: [PATCH 13/33] Back out "Enable RuntimeScheduler in old architecture" (#37623) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37623 Original commit changeset: 5f18cbe60e6c Original Phabricator Diff: D46078324 changelog: [internal] Resolves S344737 Reviewed By: FieryRobot Differential Revision: D46281951 fbshipit-source-id: dae1f7afe549686e3d5bbacf786c088bbfa49cca --- .../Libraries/AppDelegate/RCTAppDelegate.mm | 19 +- .../Libraries/AppDelegate/RCTAppSetupUtils.h | 10 +- .../Libraries/AppDelegate/RCTAppSetupUtils.mm | 26 +- .../AppDelegate/React-RCTAppDelegate.podspec | 6 - packages/react-native/React-Core.podspec | 10 +- .../React/Base/RCTRuntimeExecutorFromBridge.h | 19 - .../Base/RCTRuntimeExecutorFromBridge.mm | 56 -- .../Fabric/RCTSurfacePresenterBridgeAdapter.h | 3 + .../RCTSurfacePresenterBridgeAdapter.mm | 38 +- .../React/React-RCTFabric.podspec | 6 +- .../ReactCommon/React-Fabric.podspec | 23 + .../ReactCommon/ReactCommon.podspec | 4 + .../cxxreact/React-cxxreact.podspec | 2 +- .../react/debug/React-debug.podspec | 36 -- .../platform/ios/React-ImageManager.podspec | 4 - .../React-runtimescheduler.podspec | 66 -- .../RuntimeSchedulerBinding.cpp | 1 - .../RuntimeSchedulerBinding.h | 3 +- .../RuntimeSchedulerCallInvoker.cpp | 1 - .../RuntimeSchedulerCallInvoker.h | 3 +- .../renderer/runtimescheduler/primitives.h | 2 + .../renderer/scheduler/SchedulerToolbox.h | 2 +- .../react/utils/React-utils.podspec | 57 -- .../cocoapods/__tests__/codegen_utils-test.rb | 7 +- .../__tests__/new_architecture-test.rb | 6 +- .../scripts/cocoapods/codegen_utils.rb | 6 +- .../scripts/cocoapods/new_architecture.rb | 4 - .../react-native/scripts/react_native_pods.rb | 3 - packages/rn-tester/Podfile.lock | 575 +++++------------- packages/rn-tester/RNTester/AppDelegate.mm | 112 ++++ 30 files changed, 347 insertions(+), 763 deletions(-) delete mode 100644 packages/react-native/React/Base/RCTRuntimeExecutorFromBridge.h delete mode 100644 packages/react-native/React/Base/RCTRuntimeExecutorFromBridge.mm delete mode 100644 packages/react-native/ReactCommon/react/debug/React-debug.podspec delete mode 100644 packages/react-native/ReactCommon/react/renderer/runtimescheduler/React-runtimescheduler.podspec delete mode 100644 packages/react-native/ReactCommon/react/utils/React-utils.podspec diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm index f5cd8bcc2b2a2a..a6fcb5094765fa 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm @@ -6,41 +6,38 @@ */ #import "RCTAppDelegate.h" -#import #import -#import -#import - #import "RCTAppSetupUtils.h" #if RCT_NEW_ARCH_ENABLED #import #import #import +#import #import #import #import #import #import #import +#import #import #import "RCTLegacyInteropComponents.h" static NSString *const kRNConcurrentRoot = @"concurrentRoot"; -@interface RCTAppDelegate () { +@interface RCTAppDelegate () < + RCTTurboModuleManagerDelegate, + RCTCxxBridgeDelegate, + RCTComponentViewFactoryComponentProvider> { std::shared_ptr _reactNativeConfig; facebook::react::ContextContainer::Shared _contextContainer; + std::shared_ptr _runtimeScheduler; } @end #endif -@interface RCTAppDelegate () { - std::shared_ptr _runtimeScheduler; -} -@end - @implementation RCTAppDelegate #if RCT_NEW_ARCH_ENABLED @@ -158,8 +155,6 @@ - (BOOL)runtimeSchedulerEnabled #endif } -#if RCT_NEW_ARCH_ENABLED - #pragma mark - RCTTurboModuleManagerDelegate - (Class)getModuleClassFromName:(const char *)name diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h b/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h index 6558a849e01299..990fb77ef1a224 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h +++ b/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h @@ -11,7 +11,7 @@ #ifdef __cplusplus -#import +#if RCT_NEW_ARCH_ENABLED #ifndef RCT_USE_HERMES #if __has_include() @@ -27,27 +27,21 @@ #import #endif -#if RCT_NEW_ARCH_ENABLED #import #endif +#if RCT_NEW_ARCH_ENABLED // Forward declaration to decrease compilation coupling namespace facebook::react { class RuntimeScheduler; } -#if RCT_NEW_ARCH_ENABLED RCT_EXTERN id RCTAppSetupDefaultModuleFromClass(Class moduleClass); std::unique_ptr RCTAppSetupDefaultJsExecutorFactory( RCTBridge *bridge, RCTTurboModuleManager *turboModuleManager, std::shared_ptr const &runtimeScheduler); - -#else -std::unique_ptr RCTAppSetupJsExecutorFactoryForOldArch( - RCTBridge *bridge, - std::shared_ptr const &runtimeScheduler); #endif #endif // __cplusplus diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm b/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm index 419a386d05af7c..c7701867ecf9c7 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm @@ -7,10 +7,6 @@ #import "RCTAppSetupUtils.h" -#import -#import -#import - #if RCT_NEW_ARCH_ENABLED // Turbo Module #import @@ -19,6 +15,7 @@ #import #import #import +#import #import #import @@ -138,25 +135,4 @@ void RCTAppSetupPrepareApp(UIApplication *application, BOOL turboModuleEnabled) })); } -#else - -std::unique_ptr RCTAppSetupJsExecutorFactoryForOldArch( - RCTBridge *bridge, - std::shared_ptr const &runtimeScheduler) -{ -#if RCT_USE_HERMES - return std::make_unique( -#else - return std::make_unique( -#endif - facebook::react::RCTJSIExecutorRuntimeInstaller([bridge, runtimeScheduler](facebook::jsi::Runtime &runtime) { - if (!bridge) { - return; - } - if (runtimeScheduler) { - facebook::react::RuntimeSchedulerBinding::createAndInstallIfNeeded(runtime, runtimeScheduler); - } - })); -} - #endif diff --git a/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec b/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec index 88da0d9fe7d5d5..a98f3aea404347 100644 --- a/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec +++ b/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec @@ -48,9 +48,6 @@ header_search_paths = [ "$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core", "$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers", "$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers/", - "$(PODS_CONFIGURATION_BUILD_DIR)/React-utils/React_utils.framework/Headers/", - "$(PODS_CONFIGURATION_BUILD_DIR)/React-debug/React_debug.framework/Headers/", - "$(PODS_CONFIGURATION_BUILD_DIR)/React-runtimescheduler/React_runtimescheduler.framework/Headers/", ] : []).map{|p| "\"#{p}\""}.join(" ") Pod::Spec.new do |s| @@ -83,7 +80,6 @@ Pod::Spec.new do |s| s.dependency "React-RCTImage" s.dependency "React-NativeModulesApple" s.dependency "React-CoreModules" - s.dependency "React-runtimescheduler" if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1" s.dependency "React-hermes" @@ -95,8 +91,6 @@ Pod::Spec.new do |s| s.dependency "React-Fabric" s.dependency "React-RCTFabric" s.dependency "React-graphics" - s.dependency "React-utils" - s.dependency "React-debug" s.script_phases = { :name => "Generate Legacy Components Interop", diff --git a/packages/react-native/React-Core.podspec b/packages/react-native/React-Core.podspec index 0db3ff3186e1a5..720e115e0b76b0 100644 --- a/packages/react-native/React-Core.podspec +++ b/packages/react-native/React-Core.podspec @@ -126,13 +126,11 @@ Pod::Spec.new do |s| end s.dependency "RCT-Folly", folly_version - s.dependency "React-cxxreact" - s.dependency "React-perflogger" - s.dependency "React-jsi" - s.dependency "React-jsiexecutor" - s.dependency "React-utils" + s.dependency "React-cxxreact", version + s.dependency "React-perflogger", version + s.dependency "React-jsi", version + s.dependency "React-jsiexecutor", version s.dependency "SocketRocket", socket_rocket_version - s.dependency "React-runtimeexecutor" s.dependency "Yoga" s.dependency "glog" diff --git a/packages/react-native/React/Base/RCTRuntimeExecutorFromBridge.h b/packages/react-native/React/Base/RCTRuntimeExecutorFromBridge.h deleted file mode 100644 index 11968c8d887e89..00000000000000 --- a/packages/react-native/React/Base/RCTRuntimeExecutorFromBridge.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#ifdef __cplusplus -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RCTBridge; - -facebook::react::RuntimeExecutor RCTRuntimeExecutorFromBridge(RCTBridge *bridge); - -NS_ASSUME_NONNULL_END -#endif diff --git a/packages/react-native/React/Base/RCTRuntimeExecutorFromBridge.mm b/packages/react-native/React/Base/RCTRuntimeExecutorFromBridge.mm deleted file mode 100644 index b38c043da2433a..00000000000000 --- a/packages/react-native/React/Base/RCTRuntimeExecutorFromBridge.mm +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTRuntimeExecutorFromBridge.h" -#import -#import -#import -#import - -using namespace facebook::react; - -@interface RCTBridge () -- (std::shared_ptr)jsMessageThread; -- (void)invokeAsync:(std::function &&)func; -@end - -RuntimeExecutor RCTRuntimeExecutorFromBridge(RCTBridge *bridge) -{ - RCTAssert(bridge, @"RCTRuntimeExecutorFromBridge: Bridge must not be nil."); - - auto bridgeWeakWrapper = wrapManagedObjectWeakly([bridge batchedBridge] ?: bridge); - - RuntimeExecutor runtimeExecutor = [bridgeWeakWrapper]( - std::function &&callback) { - RCTBridge *bridge = unwrapManagedObjectWeakly(bridgeWeakWrapper); - - RCTAssert(bridge, @"RCTRuntimeExecutorFromBridge: Bridge must not be nil at the moment of scheduling a call."); - - [bridge invokeAsync:[bridgeWeakWrapper, callback = std::move(callback)]() { - RCTCxxBridge *batchedBridge = (RCTCxxBridge *)unwrapManagedObjectWeakly(bridgeWeakWrapper); - - RCTAssert(batchedBridge, @"RCTRuntimeExecutorFromBridge: Bridge must not be nil at the moment of invocation."); - - if (!batchedBridge) { - return; - } - - auto runtime = (facebook::jsi::Runtime *)(batchedBridge.runtime); - - RCTAssert( - runtime, @"RCTRuntimeExecutorFromBridge: Bridge must have a valid jsi::Runtime at the moment of invocation."); - - if (!runtime) { - return; - } - - callback(*runtime); - }]; - }; - - return runtimeExecutor; -} diff --git a/packages/react-native/React/Fabric/RCTSurfacePresenterBridgeAdapter.h b/packages/react-native/React/Fabric/RCTSurfacePresenterBridgeAdapter.h index 5c4c22bd5efb7b..188d19992c6760 100644 --- a/packages/react-native/React/Fabric/RCTSurfacePresenterBridgeAdapter.h +++ b/packages/react-native/React/Fabric/RCTSurfacePresenterBridgeAdapter.h @@ -6,6 +6,7 @@ */ #import +#import #import #import @@ -14,6 +15,8 @@ NS_ASSUME_NONNULL_BEGIN @class RCTSurfacePresenter; @class RCTBridge; +facebook::react::RuntimeExecutor RCTRuntimeExecutorFromBridge(RCTBridge *bridge); + /* * Controls a life-cycle of a Surface Presenter based on Bridge's life-cycle. * We are moving away from using Bridge. diff --git a/packages/react-native/React/Fabric/RCTSurfacePresenterBridgeAdapter.mm b/packages/react-native/React/Fabric/RCTSurfacePresenterBridgeAdapter.mm index 0c3c8a92aa989b..b456b80a385b0c 100644 --- a/packages/react-native/React/Fabric/RCTSurfacePresenterBridgeAdapter.mm +++ b/packages/react-native/React/Fabric/RCTSurfacePresenterBridgeAdapter.mm @@ -15,7 +15,6 @@ #import #import #import -#import #import #import @@ -43,6 +42,43 @@ - (void)invokeAsync:(std::function &&)func; return contextContainer; } +RuntimeExecutor RCTRuntimeExecutorFromBridge(RCTBridge *bridge) +{ + RCTAssert(bridge, @"RCTRuntimeExecutorFromBridge: Bridge must not be nil."); + + auto bridgeWeakWrapper = wrapManagedObjectWeakly([bridge batchedBridge] ?: bridge); + + RuntimeExecutor runtimeExecutor = [bridgeWeakWrapper]( + std::function &&callback) { + RCTBridge *bridge = unwrapManagedObjectWeakly(bridgeWeakWrapper); + + RCTAssert(bridge, @"RCTRuntimeExecutorFromBridge: Bridge must not be nil at the moment of scheduling a call."); + + [bridge invokeAsync:[bridgeWeakWrapper, callback = std::move(callback)]() { + RCTCxxBridge *batchedBridge = (RCTCxxBridge *)unwrapManagedObjectWeakly(bridgeWeakWrapper); + + RCTAssert(batchedBridge, @"RCTRuntimeExecutorFromBridge: Bridge must not be nil at the moment of invocation."); + + if (!batchedBridge) { + return; + } + + auto runtime = (facebook::jsi::Runtime *)(batchedBridge.runtime); + + RCTAssert( + runtime, @"RCTRuntimeExecutorFromBridge: Bridge must have a valid jsi::Runtime at the moment of invocation."); + + if (!runtime) { + return; + } + + callback(*runtime); + }]; + }; + + return runtimeExecutor; +} + @implementation RCTSurfacePresenterBridgeAdapter { RCTSurfacePresenter *_Nullable _surfacePresenter; __weak RCTBridge *_bridge; diff --git a/packages/react-native/React/React-RCTFabric.podspec b/packages/react-native/React/React-RCTFabric.podspec index f9d9368394d8e6..0c399c1797afd3 100644 --- a/packages/react-native/React/React-RCTFabric.podspec +++ b/packages/react-native/React/React-RCTFabric.podspec @@ -30,6 +30,7 @@ header_search_paths = [ "\"$(PODS_ROOT)/Headers/Private/Yoga\"", "\"$(PODS_ROOT)/Headers/Public/React-Codegen\"", "\"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\"", + ] if ENV['USE_FRAMEWORKS'] @@ -42,9 +43,6 @@ if ENV['USE_FRAMEWORKS'] header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\"" header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-ImageManager/React_ImageManager.framework/Headers\"" header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\"" - header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\"" - header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-utils/React_utils.framework/Headers\"" - header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-runtimescheduler/React_runtimescheduler.framework/Headers\"" end Pod::Spec.new do |s| @@ -81,8 +79,6 @@ Pod::Spec.new do |s| s.dependency "Yoga" s.dependency "React-RCTText" s.dependency "React-FabricImage" - s.dependency "React-utils" - s.dependency "React-runtimescheduler" if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1" s.dependency "hermes-engine" diff --git a/packages/react-native/ReactCommon/React-Fabric.podspec b/packages/react-native/ReactCommon/React-Fabric.podspec index 1347d9dad3e03a..9ad649073b39ff 100644 --- a/packages/react-native/ReactCommon/React-Fabric.podspec +++ b/packages/react-native/ReactCommon/React-Fabric.podspec @@ -232,6 +232,14 @@ Pod::Spec.new do |s| end end + s.subspec "debug_core" do |ss| + ss.dependency folly_dep_name, folly_version + ss.compiler_flags = folly_compiler_flags + ss.source_files = "react/debug/**/*.{m,mm,cpp,h}" + ss.exclude_files = "react/debug/tests" + ss.header_dir = "react/debug" + end + s.subspec "debug_renderer" do |ss| ss.dependency folly_dep_name, folly_version ss.compiler_flags = folly_compiler_flags @@ -315,4 +323,19 @@ Pod::Spec.new do |s| ss.header_dir = "react/renderer/leakchecker" ss.pod_target_xcconfig = { "GCC_WARN_PEDANTIC" => "YES" } end + + s.subspec "runtimescheduler" do |ss| + ss.dependency folly_dep_name, folly_version + ss.compiler_flags = folly_compiler_flags + ss.source_files = "react/renderer/runtimescheduler/**/*.{cpp,h}" + ss.exclude_files = "react/renderer/runtimescheduler/tests" + ss.header_dir = "react/renderer/runtimescheduler" + ss.pod_target_xcconfig = { "GCC_WARN_PEDANTIC" => "YES" } + end + + s.subspec "utils" do |ss| + ss.source_files = "react/utils/*.{m,mm,cpp,h}" + ss.header_dir = "react/utils" + end + end diff --git a/packages/react-native/ReactCommon/ReactCommon.podspec b/packages/react-native/ReactCommon/ReactCommon.podspec index 448907b3b8f26e..9ca2ec4b996d5c 100644 --- a/packages/react-native/ReactCommon/ReactCommon.podspec +++ b/packages/react-native/ReactCommon/ReactCommon.podspec @@ -70,4 +70,8 @@ Pod::Spec.new do |s| sss.source_files = "react/nativemodule/core/ReactCommon/**/*.{cpp,h}" end end + + s.subspec "react_debug_core" do |sss| + sss.source_files = "react/debug/*.{cpp,h}" + end end diff --git a/packages/react-native/ReactCommon/cxxreact/React-cxxreact.podspec b/packages/react-native/ReactCommon/cxxreact/React-cxxreact.podspec index 7157273b4b50ca..fe1b09b0a59362 100644 --- a/packages/react-native/ReactCommon/cxxreact/React-cxxreact.podspec +++ b/packages/react-native/ReactCommon/cxxreact/React-cxxreact.podspec @@ -33,7 +33,7 @@ Pod::Spec.new do |s| s.source_files = "*.{cpp,h}" s.exclude_files = "SampleCxxModule.*" s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags - s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-runtimeexecutor/React_runtimeexecutor.framework/Headers\"", + s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\"", "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" } s.header_dir = "cxxreact" diff --git a/packages/react-native/ReactCommon/react/debug/React-debug.podspec b/packages/react-native/ReactCommon/react/debug/React-debug.podspec deleted file mode 100644 index dab4a31652edfa..00000000000000 --- a/packages/react-native/ReactCommon/react/debug/React-debug.podspec +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -require "json" - -package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "package.json"))) -version = package['version'] - -source = { :git => 'https://github.com/facebook/react-native.git' } -if version == '1000.0.0' - # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. - source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1") -else - source[:tag] = "v#{version}" -end - -Pod::Spec.new do |s| - s.name = "React-debug" - s.version = version - s.summary = "-" # TODO - s.homepage = "https://reactnative.dev/" - s.license = package["license"] - s.author = "Meta Platforms, Inc. and its affiliates" - s.platforms = { :ios => min_ios_version_supported } - s.source = source - s.source_files = "**/*.{cpp,h}" - s.header_dir = "react/debug" - s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" } - - if ENV['USE_FRAMEWORKS'] - s.module_name = "React_debug" - s.header_mappings_dir = "../.." - end -end diff --git a/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec b/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec index aaf2213a8ae03e..0ef251588cc351 100644 --- a/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec +++ b/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec @@ -48,8 +48,6 @@ Pod::Spec.new do |s| "\"$(PODS_ROOT)/DoubleConversion\"", "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\"", "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\"", - "\"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\"", - "\"${PODS_CONFIGURATION_BUILD_DIR}/React-utils/React_utils.framework/Headers\"", ] end @@ -63,7 +61,5 @@ Pod::Spec.new do |s| s.dependency "React-Fabric" s.dependency "React-Core/Default" s.dependency "React-RCTImage" - s.dependency "React-debug" - s.dependency "React-utils" s.dependency "glog" end diff --git a/packages/react-native/ReactCommon/react/renderer/runtimescheduler/React-runtimescheduler.podspec b/packages/react-native/ReactCommon/react/renderer/runtimescheduler/React-runtimescheduler.podspec deleted file mode 100644 index 14c9ed0daa0825..00000000000000 --- a/packages/react-native/ReactCommon/react/renderer/runtimescheduler/React-runtimescheduler.podspec +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -require "json" - -package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "..", "package.json"))) -version = package['version'] - -source = { :git => 'https://github.com/facebook/react-native.git' } -if version == '1000.0.0' - # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. - source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1") -else - source[:tag] = "v#{version}" -end - -folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' -folly_version = '2021.07.22.00' - -header_search_paths = [ - "\"$(PODS_ROOT)/RCT-Folly\"", -] - -if ENV['USE_FRAMEWORKS'] - header_search_paths << "\"$(PODS_TARGET_SRCROOT)/../../..\"" #this is needed to allow the RuntimeScheduler access its own files - header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\"" -end - -Pod::Spec.new do |s| - s.name = "React-runtimescheduler" - s.version = version - s.summary = "-" # TODO - s.homepage = "https://reactnative.dev/" - s.license = package["license"] - s.author = "Meta Platforms, Inc. and its affiliates" - s.platforms = { :ios => min_ios_version_supported } - s.source = source - s.source_files = "**/*.{cpp,h}" - s.compiler_flags = folly_compiler_flags - s.header_dir = "react/renderer/runtimescheduler" - s.exclude_files = "tests" - s.pod_target_xcconfig = { - "CLANG_CXX_LANGUAGE_STANDARD" => "c++17", - "HEADER_SEARCH_PATHS" => header_search_paths.join(' ')} - - if ENV['USE_FRAMEWORKS'] - s.module_name = "React_runtimescheduler" - s.header_mappings_dir = "../../.." - end - - s.dependency "React-jsi" - s.dependency "React-runtimeexecutor" - s.dependency "React-callinvoker" - s.dependency "React-debug" - s.dependency "glog" - s.dependency "RCT-Folly", folly_version - - if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1" - s.dependency "hermes-engine" - else - s.dependency "React-jsi" - end - -end diff --git a/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.cpp b/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.cpp index 0164dc1c768a58..79d317f11b1efe 100644 --- a/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.cpp +++ b/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.cpp @@ -7,7 +7,6 @@ #include "RuntimeSchedulerBinding.h" #include -#include "RuntimeScheduler.h" #include "SchedulerPriorityUtils.h" #include "primitives.h" diff --git a/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.h b/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.h index 50d5f25509abf6..95925b9778568d 100644 --- a/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.h +++ b/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.h @@ -8,11 +8,10 @@ #pragma once #include +#include namespace facebook::react { -class RuntimeScheduler; - /* * Exposes RuntimeScheduler to JavaScript realm. */ diff --git a/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.cpp b/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.cpp index 988f97b014613c..dc1e78584ac0c4 100644 --- a/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.cpp +++ b/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.cpp @@ -8,7 +8,6 @@ #include "RuntimeSchedulerCallInvoker.h" #include -#include "RuntimeScheduler.h" namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h b/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h index 2fa542323399e6..93cc925f6859ae 100644 --- a/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h +++ b/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h @@ -8,11 +8,10 @@ #pragma once #include +#include namespace facebook::react { -class RuntimeScheduler; - /* * Exposes RuntimeScheduler to native modules. All calls invoked on JavaScript * queue from native modules will be funneled through RuntimeScheduler. diff --git a/packages/react-native/ReactCommon/react/renderer/runtimescheduler/primitives.h b/packages/react-native/ReactCommon/react/renderer/runtimescheduler/primitives.h index 0968a63c5c64cd..3ba035b6872a21 100644 --- a/packages/react-native/ReactCommon/react/renderer/runtimescheduler/primitives.h +++ b/packages/react-native/ReactCommon/react/renderer/runtimescheduler/primitives.h @@ -7,7 +7,9 @@ #pragma once +#include #include +#include #include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/renderer/scheduler/SchedulerToolbox.h b/packages/react-native/ReactCommon/react/renderer/scheduler/SchedulerToolbox.h index 2ada81212d1154..739b02766ceaff 100644 --- a/packages/react-native/ReactCommon/react/renderer/scheduler/SchedulerToolbox.h +++ b/packages/react-native/ReactCommon/react/renderer/scheduler/SchedulerToolbox.h @@ -13,7 +13,7 @@ #include #include #include - +#include #include #include #include diff --git a/packages/react-native/ReactCommon/react/utils/React-utils.podspec b/packages/react-native/ReactCommon/react/utils/React-utils.podspec deleted file mode 100644 index d262c559241052..00000000000000 --- a/packages/react-native/ReactCommon/react/utils/React-utils.podspec +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -require "json" - -package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "package.json"))) -version = package['version'] - -source = { :git => 'https://github.com/facebook/react-native.git' } -if version == '1000.0.0' - # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. - source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1") -else - source[:tag] = "v#{version}" -end - -folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' -folly_version = '2021.07.22.00' - -header_search_paths = [ - "\"$(PODS_ROOT)/RCT-Folly\"", - "\"$(PODS_TARGET_SRCROOT)\"", - "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"", -] - -if ENV["USE_FRAMEWORKS"] - header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\"" -end - -Pod::Spec.new do |s| - s.name = "React-utils" - s.version = version - s.summary = "-" # TODO - s.homepage = "https://reactnative.dev/" - s.license = package["license"] - s.author = "Meta Platforms, Inc. and its affiliates" - s.platforms = { :ios => min_ios_version_supported } - s.source = source - s.source_files = "**/*.{cpp,h,mm}" - s.compiler_flags = folly_compiler_flags - s.header_dir = "react/utils" - s.exclude_files = "tests" - s.pod_target_xcconfig = { - "CLANG_CXX_LANGUAGE_STANDARD" => "c++17", - "HEADER_SEARCH_PATHS" => header_search_paths.join(' ')} - - if ENV['USE_FRAMEWORKS'] - s.module_name = "React_utils" - s.header_mappings_dir = "../.." - end - - s.dependency "RCT-Folly", folly_version - s.dependency "React-debug" - s.dependency "glog" -end diff --git a/packages/react-native/scripts/cocoapods/__tests__/codegen_utils-test.rb b/packages/react-native/scripts/cocoapods/__tests__/codegen_utils-test.rb index e3595ccb2fb766..da138e23b86950 100644 --- a/packages/react-native/scripts/cocoapods/__tests__/codegen_utils-test.rb +++ b/packages/react-native/scripts/cocoapods/__tests__/codegen_utils-test.rb @@ -577,8 +577,7 @@ def get_podspec_fabric_and_script_phases(script_phases) 'React-graphics': [], 'React-rncore': [], 'React-Fabric': [], - 'React-utils': [], - 'React-debug': [], + }) specs[:'script_phases'] = script_phases @@ -590,13 +589,11 @@ def get_podspec_when_use_frameworks specs = get_podspec_no_fabric_no_script() specs["pod_target_xcconfig"]["FRAMEWORK_SEARCH_PATHS"].concat([]) - specs["pod_target_xcconfig"]["HEADER_SEARCH_PATHS"].concat(" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-Fabric/React_Fabric.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-FabricImage/React_FabricImage.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-graphics/React_graphics.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-debug/React_debug.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-utils/React_utils.framework/Headers\"") + specs["pod_target_xcconfig"]["HEADER_SEARCH_PATHS"].concat(" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-Fabric/React_Fabric.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-FabricImage/React_FabricImage.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-graphics/React_graphics.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers\"") specs[:dependencies].merge!({ 'React-graphics': [], 'React-Fabric': [], - 'React-utils': [], - 'React-debug': [], }) return specs diff --git a/packages/react-native/scripts/cocoapods/__tests__/new_architecture-test.rb b/packages/react-native/scripts/cocoapods/__tests__/new_architecture-test.rb index 4482d8e25b5b4f..c97349ed15df31 100644 --- a/packages/react-native/scripts/cocoapods/__tests__/new_architecture-test.rb +++ b/packages/react-native/scripts/cocoapods/__tests__/new_architecture-test.rb @@ -129,7 +129,7 @@ def test_installModulesDependencies_whenNewArchEnabledAndNewArchAndNoSearchPaths # Assert assert_equal(spec.compiler_flags, NewArchitectureHelper.folly_compiler_flags) - assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-utils/React_utils.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\"") + assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\"") assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++17") assert_equal(spec.pod_target_xcconfig["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DRCT_NEW_ARCH_ENABLED=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1") assert_equal( @@ -148,8 +148,6 @@ def test_installModulesDependencies_whenNewArchEnabledAndNewArchAndNoSearchPaths { :dependency_name => "Yoga" }, { :dependency_name => "React-Fabric" }, { :dependency_name => "React-graphics" }, - { :dependency_name => "React-utils" }, - { :dependency_name => "React-debug" }, { :dependency_name => "hermes-engine" } ]) end @@ -168,7 +166,7 @@ def test_installModulesDependencies_whenNewArchDisabledAndSearchPathsAndCompiler # Assert assert_equal(spec.compiler_flags, "-Wno-nullability-completeness #{NewArchitectureHelper.folly_compiler_flags}") - assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "#{other_flags} \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-utils/React_utils.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\"") + assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "#{other_flags} \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\"") assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++17") assert_equal( spec.dependencies, diff --git a/packages/react-native/scripts/cocoapods/codegen_utils.rb b/packages/react-native/scripts/cocoapods/codegen_utils.rb index 45ed74bd1e24bc..c980f05762de45 100644 --- a/packages/react-native/scripts/cocoapods/codegen_utils.rb +++ b/packages/react-native/scripts/cocoapods/codegen_utils.rb @@ -100,8 +100,6 @@ def get_react_codegen_spec(package_json_file, folly_version: '2021.07.22.00', fa "\"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\"", "\"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\"", "\"$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers\"", - "\"$(PODS_CONFIGURATION_BUILD_DIR)/React-debug/React_debug.framework/Headers\"", - "\"$(PODS_CONFIGURATION_BUILD_DIR)/React-utils/React_utils.framework/Headers\"", ]) end @@ -132,7 +130,7 @@ def get_react_codegen_spec(package_json_file, folly_version: '2021.07.22.00', fa "React-jsi": [], "ReactCommon/turbomodule/bridging": [], "ReactCommon/turbomodule/core": [], - "React-NativeModulesApple": [], + "React-NativeModulesApple": [], "glog": [], "DoubleConversion": [], } @@ -142,8 +140,6 @@ def get_react_codegen_spec(package_json_file, folly_version: '2021.07.22.00', fa spec[:'dependencies'].merge!({ 'React-graphics': [], 'React-Fabric': [], - 'React-debug': [], - 'React-utils': [], }); end diff --git a/packages/react-native/scripts/cocoapods/new_architecture.rb b/packages/react-native/scripts/cocoapods/new_architecture.rb index 192d2702645a9f..7dd43c34d9cea1 100644 --- a/packages/react-native/scripts/cocoapods/new_architecture.rb +++ b/packages/react-native/scripts/cocoapods/new_architecture.rb @@ -109,8 +109,6 @@ def self.install_modules_dependencies(spec, new_arch_enabled, folly_version) header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\"" header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\"" header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\"" - header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-utils/React_utils.framework/Headers\"" - header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\"" end header_search_paths_string = header_search_paths.join(" ") spec.compiler_flags = compiler_flags.empty? ? @@folly_compiler_flags : "#{compiler_flags} #{@@folly_compiler_flags}" @@ -137,8 +135,6 @@ def self.install_modules_dependencies(spec, new_arch_enabled, folly_version) spec.dependency "Yoga" spec.dependency "React-Fabric" spec.dependency "React-graphics" - spec.dependency "React-utils" - spec.dependency "React-debug" if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1" spec.dependency "hermes-engine" diff --git a/packages/react-native/scripts/react_native_pods.rb b/packages/react-native/scripts/react_native_pods.rb index 8202be66039b5a..8b786505cbff8b 100644 --- a/packages/react-native/scripts/react_native_pods.rb +++ b/packages/react-native/scripts/react_native_pods.rb @@ -117,8 +117,6 @@ def use_react_native! ( pod 'React-Core/RCTWebSocket', :path => "#{prefix}/" pod 'React-rncore', :path => "#{prefix}/ReactCommon" pod 'React-cxxreact', :path => "#{prefix}/ReactCommon/cxxreact" - pod 'React-debug', :path => "#{prefix}/ReactCommon/react/debug" - pod 'React-utils', :path => "#{prefix}/ReactCommon/react/utils" if hermes_enabled setup_hermes!(:react_native_path => prefix, :fabric_enabled => fabric_enabled) @@ -131,7 +129,6 @@ def use_react_native! ( pod 'React-callinvoker', :path => "#{prefix}/ReactCommon/callinvoker" pod 'React-runtimeexecutor', :path => "#{prefix}/ReactCommon/runtimeexecutor" - pod 'React-runtimescheduler', :path => "#{prefix}/ReactCommon/react/renderer/runtimescheduler" pod 'React-perflogger', :path => "#{prefix}/ReactCommon/reactperflogger" pod 'React-logger', :path => "#{prefix}/ReactCommon/logger" pod 'ReactCommon/turbomodule/core', :path => "#{prefix}/ReactCommon", :modular_headers => true diff --git a/packages/rn-tester/Podfile.lock b/packages/rn-tester/Podfile.lock index 4f90a9b694d0d3..be0ec11b28e079 100644 --- a/packages/rn-tester/Podfile.lock +++ b/packages/rn-tester/Podfile.lock @@ -122,22 +122,18 @@ PODS: - React-RCTVibration (= 1000.0.0) - React-callinvoker (1000.0.0) - React-Codegen (1000.0.0): - - DoubleConversion - FBReactNativeSpec - - glog - hermes-engine - RCT-Folly - RCTRequired - RCTTypeSafety - React-Core - - React-debug - React-Fabric - React-graphics - React-jsi - React-jsiexecutor - React-NativeModulesApple - React-rncore - - React-utils - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - React-Core (1000.0.0): @@ -145,13 +141,11 @@ PODS: - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default (= 1000.0.0) - - React-cxxreact + - React-cxxreact (= 1000.0.0) - React-hermes - - React-jsi - - React-jsiexecutor - - React-perflogger - - React-runtimeexecutor - - React-utils + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - React-perflogger (= 1000.0.0) - SocketRocket (= 0.6.0) - Yoga - React-Core/CoreModulesHeaders (1000.0.0): @@ -159,26 +153,22 @@ PODS: - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - - React-cxxreact + - React-cxxreact (= 1000.0.0) - React-hermes - - React-jsi - - React-jsiexecutor - - React-perflogger - - React-runtimeexecutor - - React-utils + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - React-perflogger (= 1000.0.0) - SocketRocket (= 0.6.0) - Yoga - React-Core/Default (1000.0.0): - glog - hermes-engine - RCT-Folly (= 2021.07.22.00) - - React-cxxreact + - React-cxxreact (= 1000.0.0) - React-hermes - - React-jsi - - React-jsiexecutor - - React-perflogger - - React-runtimeexecutor - - React-utils + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - React-perflogger (= 1000.0.0) - SocketRocket (= 0.6.0) - Yoga - React-Core/DevSupport (1000.0.0): @@ -187,14 +177,12 @@ PODS: - RCT-Folly (= 2021.07.22.00) - React-Core/Default (= 1000.0.0) - React-Core/RCTWebSocket (= 1000.0.0) - - React-cxxreact + - React-cxxreact (= 1000.0.0) - React-hermes - - React-jsi - - React-jsiexecutor + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - React-jsinspector (= 1000.0.0) - - React-perflogger - - React-runtimeexecutor - - React-utils + - React-perflogger (= 1000.0.0) - SocketRocket (= 0.6.0) - Yoga - React-Core/RCTActionSheetHeaders (1000.0.0): @@ -202,13 +190,11 @@ PODS: - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - - React-cxxreact + - React-cxxreact (= 1000.0.0) - React-hermes - - React-jsi - - React-jsiexecutor - - React-perflogger - - React-runtimeexecutor - - React-utils + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - React-perflogger (= 1000.0.0) - SocketRocket (= 0.6.0) - Yoga - React-Core/RCTAnimationHeaders (1000.0.0): @@ -216,13 +202,11 @@ PODS: - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - - React-cxxreact + - React-cxxreact (= 1000.0.0) - React-hermes - - React-jsi - - React-jsiexecutor - - React-perflogger - - React-runtimeexecutor - - React-utils + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - React-perflogger (= 1000.0.0) - SocketRocket (= 0.6.0) - Yoga - React-Core/RCTBlobHeaders (1000.0.0): @@ -230,13 +214,11 @@ PODS: - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - - React-cxxreact + - React-cxxreact (= 1000.0.0) - React-hermes - - React-jsi - - React-jsiexecutor - - React-perflogger - - React-runtimeexecutor - - React-utils + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - React-perflogger (= 1000.0.0) - SocketRocket (= 0.6.0) - Yoga - React-Core/RCTImageHeaders (1000.0.0): @@ -244,13 +226,11 @@ PODS: - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - - React-cxxreact + - React-cxxreact (= 1000.0.0) - React-hermes - - React-jsi - - React-jsiexecutor - - React-perflogger - - React-runtimeexecutor - - React-utils + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - React-perflogger (= 1000.0.0) - SocketRocket (= 0.6.0) - Yoga - React-Core/RCTLinkingHeaders (1000.0.0): @@ -258,13 +238,11 @@ PODS: - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - - React-cxxreact + - React-cxxreact (= 1000.0.0) - React-hermes - - React-jsi - - React-jsiexecutor - - React-perflogger - - React-runtimeexecutor - - React-utils + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - React-perflogger (= 1000.0.0) - SocketRocket (= 0.6.0) - Yoga - React-Core/RCTNetworkHeaders (1000.0.0): @@ -272,13 +250,11 @@ PODS: - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - - React-cxxreact + - React-cxxreact (= 1000.0.0) - React-hermes - - React-jsi - - React-jsiexecutor - - React-perflogger - - React-runtimeexecutor - - React-utils + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - React-perflogger (= 1000.0.0) - SocketRocket (= 0.6.0) - Yoga - React-Core/RCTPushNotificationHeaders (1000.0.0): @@ -286,13 +262,11 @@ PODS: - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - - React-cxxreact + - React-cxxreact (= 1000.0.0) - React-hermes - - React-jsi - - React-jsiexecutor - - React-perflogger - - React-runtimeexecutor - - React-utils + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - React-perflogger (= 1000.0.0) - SocketRocket (= 0.6.0) - Yoga - React-Core/RCTSettingsHeaders (1000.0.0): @@ -300,13 +274,11 @@ PODS: - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - - React-cxxreact + - React-cxxreact (= 1000.0.0) - React-hermes - - React-jsi - - React-jsiexecutor - - React-perflogger - - React-runtimeexecutor - - React-utils + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - React-perflogger (= 1000.0.0) - SocketRocket (= 0.6.0) - Yoga - React-Core/RCTTextHeaders (1000.0.0): @@ -314,13 +286,11 @@ PODS: - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - - React-cxxreact + - React-cxxreact (= 1000.0.0) - React-hermes - - React-jsi - - React-jsiexecutor - - React-perflogger - - React-runtimeexecutor - - React-utils + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - React-perflogger (= 1000.0.0) - SocketRocket (= 0.6.0) - Yoga - React-Core/RCTVibrationHeaders (1000.0.0): @@ -328,13 +298,11 @@ PODS: - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default - - React-cxxreact + - React-cxxreact (= 1000.0.0) - React-hermes - - React-jsi - - React-jsiexecutor - - React-perflogger - - React-runtimeexecutor - - React-utils + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - React-perflogger (= 1000.0.0) - SocketRocket (= 0.6.0) - Yoga - React-Core/RCTWebSocket (1000.0.0): @@ -342,13 +310,11 @@ PODS: - hermes-engine - RCT-Folly (= 2021.07.22.00) - React-Core/Default (= 1000.0.0) - - React-cxxreact + - React-cxxreact (= 1000.0.0) - React-hermes - - React-jsi - - React-jsiexecutor - - React-perflogger - - React-runtimeexecutor - - React-utils + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - React-perflogger (= 1000.0.0) - SocketRocket (= 0.6.0) - Yoga - React-CoreModules (1000.0.0): @@ -373,16 +339,10 @@ PODS: - React-logger (= 1000.0.0) - React-perflogger (= 1000.0.0) - React-runtimeexecutor (= 1000.0.0) - - React-debug (1000.0.0) - React-Fabric (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-Fabric/animations (= 1000.0.0) - React-Fabric/attributedstring (= 1000.0.0) - React-Fabric/butter (= 1000.0.0) @@ -391,112 +351,69 @@ PODS: - React-Fabric/components (= 1000.0.0) - React-Fabric/config (= 1000.0.0) - React-Fabric/core (= 1000.0.0) + - React-Fabric/debug_core (= 1000.0.0) - React-Fabric/debug_renderer (= 1000.0.0) - React-Fabric/imagemanager (= 1000.0.0) - React-Fabric/leakchecker (= 1000.0.0) - React-Fabric/mapbuffer (= 1000.0.0) - React-Fabric/mounting (= 1000.0.0) + - React-Fabric/runtimescheduler (= 1000.0.0) - React-Fabric/scheduler (= 1000.0.0) - React-Fabric/telemetry (= 1000.0.0) - React-Fabric/templateprocessor (= 1000.0.0) - React-Fabric/textlayoutmanager (= 1000.0.0) - React-Fabric/uimanager (= 1000.0.0) + - React-Fabric/utils (= 1000.0.0) - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/animations (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/attributedstring (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/butter (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/componentregistry (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/componentregistrynative (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug + - React-Fabric/components/activityindicator (= 1000.0.0) + - React-Fabric/components/image (= 1000.0.0) - React-Fabric/components/inputaccessory (= 1000.0.0) - React-Fabric/components/legacyviewmanagerinterop (= 1000.0.0) - React-Fabric/components/modal (= 1000.0.0) @@ -511,395 +428,233 @@ PODS: - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils + - ReactCommon/turbomodule/core (= 1000.0.0) + - React-Fabric/components/activityindicator (1000.0.0): + - RCT-Folly/Fabric (= 2021.07.22.00) + - RCTRequired (= 1000.0.0) + - RCTTypeSafety (= 1000.0.0) + - React-graphics (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - ReactCommon/turbomodule/core (= 1000.0.0) + - React-Fabric/components/image (1000.0.0): + - RCT-Folly/Fabric (= 2021.07.22.00) + - RCTRequired (= 1000.0.0) + - RCTTypeSafety (= 1000.0.0) + - React-graphics (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/inputaccessory (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/legacyviewmanagerinterop (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/modal (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/rncore (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/root (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/safeareaview (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/scrollview (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/text (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/textinput (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/unimplementedview (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/view (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - Yoga - React-Fabric/config (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/core (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils + - ReactCommon/turbomodule/core (= 1000.0.0) + - React-Fabric/debug_core (1000.0.0): + - RCT-Folly/Fabric (= 2021.07.22.00) + - RCTRequired (= 1000.0.0) + - RCTTypeSafety (= 1000.0.0) + - React-graphics (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/debug_renderer (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/imagemanager (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/leakchecker (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/mapbuffer (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/mounting (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils + - ReactCommon/turbomodule/core (= 1000.0.0) + - React-Fabric/runtimescheduler (1000.0.0): + - RCT-Folly/Fabric (= 2021.07.22.00) + - RCTRequired (= 1000.0.0) + - RCTTypeSafety (= 1000.0.0) + - React-graphics (= 1000.0.0) + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/scheduler (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/telemetry (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/templateprocessor (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/textlayoutmanager (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-Fabric/uimanager - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/uimanager (1000.0.0): - - DoubleConversion - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Core - - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - - React-runtimescheduler - - React-utils - ReactCommon/turbomodule/core (= 1000.0.0) - - React-FabricImage (1000.0.0): - - DoubleConversion - - glog - - hermes-engine + - React-Fabric/utils (1000.0.0): - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Fabric - React-graphics (= 1000.0.0) - - React-ImageManager - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - - Yoga - React-graphics (1000.0.0): - glog - RCT-Folly/Fabric (= 2021.07.22.00) @@ -916,13 +671,10 @@ PODS: - React-jsinspector (= 1000.0.0) - React-perflogger (= 1000.0.0) - React-ImageManager (1000.0.0): - - glog - RCT-Folly/Fabric - React-Core/Default - - React-debug - React-Fabric - React-RCTImage - - React-utils - React-jsi (1000.0.0): - boost (= 1.76.0) - DoubleConversion @@ -964,11 +716,6 @@ PODS: - RCTRequired - RCTTypeSafety - React-Core - - React-CoreModules - - React-hermes - - React-NativeModulesApple - - React-RCTImage - - React-RCTNetwork - ReactCommon/turbomodule/core - React-RCTBlob (1000.0.0): - hermes-engine @@ -980,19 +727,11 @@ PODS: - React-RCTNetwork (= 1000.0.0) - ReactCommon/turbomodule/core (= 1000.0.0) - React-RCTFabric (1000.0.0): - - glog - - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - React-Core (= 1000.0.0) - React-Fabric (= 1000.0.0) - - React-FabricImage - - React-graphics - React-ImageManager - React-RCTImage (= 1000.0.0) - - React-RCTText - - React-runtimescheduler - - React-utils - - Yoga - React-RCTImage (1000.0.0): - RCT-Folly (= 2021.07.22.00) - RCTTypeSafety (= 1000.0.0) @@ -1043,18 +782,6 @@ PODS: - React-rncore (1000.0.0) - React-runtimeexecutor (1000.0.0): - React-jsi (= 1000.0.0) - - React-runtimescheduler (1000.0.0): - - glog - - hermes-engine - - RCT-Folly (= 2021.07.22.00) - - React-callinvoker - - React-debug - - React-jsi - - React-runtimeexecutor - - React-utils (1000.0.0): - - glog - - RCT-Folly (= 2021.07.22.00) - - React-debug - ReactCommon-Samples (1000.0.0): - DoubleConversion - hermes-engine @@ -1085,7 +812,6 @@ PODS: - React-logger (= 1000.0.0) - React-perflogger (= 1000.0.0) - ScreenshotManager (0.0.1): - - glog - RCT-Folly (= 2021.07.22.00) - React-Core - SocketRocket (0.6.0) @@ -1119,7 +845,7 @@ DEPENDENCIES: - FlipperKit/FlipperKitUserDefaultsPlugin (= 0.182.0) - FlipperKit/SKIOSNetworkPlugin (= 0.182.0) - glog (from `../react-native/third-party-podspecs/glog.podspec`) - - hermes-engine (from `../react-native/sdks/hermes-engine/hermes-engine.podspec`) + - hermes-engine (from `../react-native/sdks/hermes/hermes-engine.podspec`) - libevent (~> 2.1.12) - OCMock (~> 3.9.1) - OpenSSL-Universal (= 1.1.1100) @@ -1135,9 +861,7 @@ DEPENDENCIES: - React-Core/RCTWebSocket (from `../react-native/`) - React-CoreModules (from `../react-native/React/CoreModules`) - React-cxxreact (from `../react-native/ReactCommon/cxxreact`) - - React-debug (from `../react-native/ReactCommon/react/debug`) - React-Fabric (from `../react-native/ReactCommon`) - - React-FabricImage (from `../react-native/ReactCommon`) - React-graphics (from `../react-native/ReactCommon/react/renderer/graphics`) - React-hermes (from `../react-native/ReactCommon/hermes`) - React-ImageManager (from `../react-native/ReactCommon/react/renderer/imagemanager/platform/ios`) @@ -1162,8 +886,6 @@ DEPENDENCIES: - React-RCTVibration (from `../react-native/Libraries/Vibration`) - React-rncore (from `../react-native/ReactCommon`) - React-runtimeexecutor (from `../react-native/ReactCommon/runtimeexecutor`) - - React-runtimescheduler (from `../react-native/ReactCommon/react/renderer/runtimescheduler`) - - React-utils (from `../react-native/ReactCommon/react/utils`) - ReactCommon-Samples (from `../react-native/ReactCommon/react/nativemodule/samples`) - ReactCommon/turbomodule/core (from `../react-native/ReactCommon`) - ScreenshotManager (from `NativeModuleExample`) @@ -1199,8 +921,7 @@ EXTERNAL SOURCES: glog: :podspec: "../react-native/third-party-podspecs/glog.podspec" hermes-engine: - :podspec: "../react-native/sdks/hermes-engine/hermes-engine.podspec" - :tag: '' + :podspec: "../react-native/sdks/hermes/hermes-engine.podspec" RCT-Folly: :podspec: "../react-native/third-party-podspecs/RCT-Folly.podspec" RCTRequired: @@ -1219,12 +940,8 @@ EXTERNAL SOURCES: :path: "../react-native/React/CoreModules" React-cxxreact: :path: "../react-native/ReactCommon/cxxreact" - React-debug: - :path: "../react-native/ReactCommon/react/debug" React-Fabric: :path: "../react-native/ReactCommon" - React-FabricImage: - :path: "../react-native/ReactCommon" React-graphics: :path: "../react-native/ReactCommon/react/renderer/graphics" React-hermes: @@ -1273,10 +990,6 @@ EXTERNAL SOURCES: :path: "../react-native/ReactCommon" React-runtimeexecutor: :path: "../react-native/ReactCommon/runtimeexecutor" - React-runtimescheduler: - :path: "../react-native/ReactCommon/react/renderer/runtimescheduler" - React-utils: - :path: "../react-native/ReactCommon/react/utils" ReactCommon: :path: "../react-native/ReactCommon" ReactCommon-Samples: @@ -1290,8 +1003,8 @@ SPEC CHECKSUMS: boost: 57d2868c099736d80fcd648bf211b4431e51a558 CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54 - FBLazyVector: f4492a543c5a8fa1502d3a5867e3f7252497cfe8 - FBReactNativeSpec: 7a256eec25705f77ac6d6c6187ec2d89a180fa6c + FBLazyVector: d68947eddece25638eb0f642d1b957c90388afd1 + FBReactNativeSpec: e15126dac01896217e97d3ed3045a67be39e97cd Flipper: 6edb735e6c3e332975d1b17956bcc584eccf5818 Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c Flipper-DoubleConversion: 2dc99b02f658daf147069aad9dbd29d8feb06d30 @@ -1302,55 +1015,51 @@ SPEC CHECKSUMS: FlipperKit: 2efad7007d6745a3f95e4034d547be637f89d3f6 fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b - hermes-engine: a5dc057727e424d33bc71ab0f73e1f763848ff0d + hermes-engine: d4e3147fcec14fb95d56cad45f03f126e725a098 libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 OCMock: 9491e4bec59e0b267d52a9184ff5605995e74be8 OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1 - RCTRequired: 82c56a03b3efd524bfdb581a906add903f78f978 - RCTTypeSafety: 034ade4e3b36be976b8378f825ccadbe104fa852 - React: cb6dc75e09f32aeddb4d8fb58a394a67219a92fe - React-callinvoker: bae59cbd6affd712bbfc703839dad868ff35069d - React-Codegen: 42dae0c7801d765934f76cfbaefcb5742524cc98 - React-Core: 98f0e61878ef96afbf3ec4e9690a4bf720e7cb73 - React-CoreModules: fa9b32bbc7818672a7ca91eeef4867e133b566ec - React-cxxreact: 9a06a6853644cb043351ca10edd4e2b913c5b41c - React-debug: d1cd203242675d48eecec6c2553933c0e0a3874f - React-Fabric: b421e9789c777f236917181a14f1c2fb74b9f048 - React-FabricImage: 8552a7e0919bc2ab09c6869a7507ad7a46e552d9 - React-graphics: a85048af7e210ec4fed185ef201726f7b4825cc0 - React-hermes: 008e4f46da454b583bc4299fcd8cc7efdc6afd33 - React-ImageManager: 528eb68fe16f08d4c76cd32949e6bcd9e4aeae4b - React-jsi: ae20bc6ced4999f64acc5163cbfa67f878f346f4 - React-jsiexecutor: 754993beb8627912e5b25344cad02ed11a616d9f - React-jsinspector: bede0a6ac88f2463eafc1301239fe943adf06fa7 - React-logger: c20eb15d006d5c303cf6bfbb11243c8d579d9f56 - React-NativeModulesApple: d6c7428e80cce84be43ed559e954187fd655a346 - React-perflogger: c294d51cfc18b90caa1604ef3a0fe2dd76b9e15e - React-RCTActionSheet: 943bd5f540f3af1e5a149c13c4de81858edf718a - React-RCTAnimation: a430a8c32e7947b7b014f7bd1ef6825168ad4841 - React-RCTAppDelegate: c847ea72bc6fd48b7b6693755c232a3cecbbc970 - React-RCTBlob: 9de0f88a876429c31b96b63975173c60978b5586 - React-RCTFabric: f54bcc97dfd11a124a9ac992ae4f0f2fd4a4493b - React-RCTImage: 8addd5fae983149d4506fbf8b36be30585adadf4 - React-RCTLinking: aec004e7f55b71be0f68913b1d993964fc8013e1 - React-RCTNetwork: 67229afd0642c55d4493cad5129238a7a1599441 - React-RCTPushNotification: 9e4bba7bb3a4682281216a81f3342caecf84cef7 - React-RCTSettings: 9b6f5a70aa3b859b2686794c3441e278b4f6e0a6 - React-RCTTest: d4004e03f9e5ca2607eb05bee5a0618b189a127a - React-RCTText: 6d0a9927391dc26325c2edf60ef7d36f637e709c - React-RCTVibration: ae65884c71d67f356396d6fcc44eec48b5afef70 - React-rncore: fe8c75a4beb121d0f923f0a45a17910083ccb681 - React-runtimeexecutor: e1c32bc249dd3cf3919cb4664fd8dc84ef70cff7 - React-runtimescheduler: 3f19ac94cc41d5ff1a15a54af9fad2c8e2bcc420 - React-utils: 2c3b06a36a63d6fce240ac5cb1de003b95222810 - ReactCommon: de6e7a92ad50207b08bcf696a61d9b509876e131 - ReactCommon-Samples: 13b7118480fb9abeee8a98bc1cceff06984cfde4 - ScreenshotManager: d39b964a374e5012e2b8c143e29ead86b1da6a3c + RCTRequired: 54a4f03dbbebb0cfdb4e2ba8d3b1d0b1258f8c08 + RCTTypeSafety: a41e253b4ed644708899857d912b2f50c7b6214d + React: 2fc6c4c656cccd6753016528ad41199c16fd558e + React-callinvoker: a7d5e883a83bb9bd3985b08be832c5e76451d18f + React-Codegen: ecc7c203dcc86316ff12a865dbfc71190458b367 + React-Core: 6ed76c248f07d2d65d8d15b33a75444ef6ff7938 + React-CoreModules: 9b9060df7f561e9c8f8364333c2ec645d7c698d2 + React-cxxreact: aff243750dad852080636e615d7ae5639381735b + React-Fabric: 6b5c30b6e60a85446cc5d3702fa262fd1fc15619 + React-graphics: e70886fff4b79bec3745de761900a770029591f2 + React-hermes: 7f0e87d44b1c7cfbdd11aa3c070d04435fe75d57 + React-ImageManager: 9fd3521fb8871cd5bea83d2d282da27d6ef91199 + React-jsi: e4c75a1cf727c8761908ac2eeb1084e47ba88a26 + React-jsiexecutor: 8361f78286021782d885e0888bb059a4045c59b9 + React-jsinspector: 9b56a373a6797114e1d89a7dffa98ee98af67a8f + React-logger: 07c9b44040a6f948b8e2033207b23cb623f0b9b4 + React-NativeModulesApple: 47a650ab999a254890d8294581b59761f09d3867 + React-perflogger: b4b9fb2ddd856b78003708ab3cf66ce03e6bc7c4 + React-RCTActionSheet: 1b1501ef80928be10702cd0ce09120358094cd82 + React-RCTAnimation: 6741f7be3e269e057c1426074cc70f34b56e114b + React-RCTAppDelegate: 777164f9f62174c65df37286df4eee43b44a6fb0 + React-RCTBlob: fd1ee93e48aa67b0183346a59754375de93de63d + React-RCTFabric: 179b2203e1b8b89b6ec8fa6104071beb553b1684 + React-RCTImage: 055685a12c88939437f6520d9e7c120cd666cbf1 + React-RCTLinking: b149b3ff1f96fa93fc445230b9c171adb0e5572c + React-RCTNetwork: 21abb4231182651f48b7035beaa011b1ab7ae8f4 + React-RCTPushNotification: f3af966de34c1fe2df8860625d225fb2f581d15e + React-RCTSettings: 64b6acabfddf7f96796229b101bd91f46d14391b + React-RCTTest: 81ebfa8c2e1b0b482effe12485e6486dc0ff70d7 + React-RCTText: 4e5ae05b778a0ed2b22b012af025da5e1a1c4e54 + React-RCTVibration: ecfd04c1886a9c9a4e31a466c0fbcf6b36e92fde + React-rncore: 4c50bd546c117f4024a84bf6de1dd905d5fa3e82 + React-runtimeexecutor: c7b2cd6babf6cc50340398bfbb7a9da13c93093f + ReactCommon: b3e76cb18ee28cd0e3a927f5b53f888312443b6b + ReactCommon-Samples: 7bf1ed1f5d659fae980b40c35c5a431d0ec49189 + ScreenshotManager: 4e5729bfcd19014d277e57eb60e8e75db64b2953 SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608 - Yoga: 239f77be94241af2a02e7018fe6165a715bc25f1 + Yoga: 1b1a12ff3d86a10565ea7cbe057d42f5e5fb2a07 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: bdab6add69d555774de227d7119a8f5ae02a670e +PODFILE CHECKSUM: 9fa6f105e2187b680e978d57b28e2f700c8bd295 -COCOAPODS: 1.12.1 +COCOAPODS: 1.12.0 diff --git a/packages/rn-tester/RNTester/AppDelegate.mm b/packages/rn-tester/RNTester/AppDelegate.mm index f4e8d4006c5416..d9a5e3ff6cb50b 100644 --- a/packages/rn-tester/RNTester/AppDelegate.mm +++ b/packages/rn-tester/RNTester/AppDelegate.mm @@ -9,18 +9,69 @@ #import #import +#import +#import +#import #import #import +#import + #if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC #import #endif +#ifdef RN_FABRIC_ENABLED +#import +#import +#import +#import + +#import +#import +#import +#import +#import +#endif + #if RCT_NEW_ARCH_ENABLED #import #import #endif +#if DEBUG +#ifdef FB_SONARKIT_ENABLED +#import +#import +#import +#import +#import +#import +#import +#endif +#endif + +#import +#import "RNTesterTurboModuleProvider.h" + +@interface AppDelegate () { +#ifdef RN_FABRIC_ENABLED + RCTSurfacePresenterBridgeAdapter *_bridgeAdapter; + std::shared_ptr _reactNativeConfig; + facebook::react::ContextContainer::Shared _contextContainer; + std::shared_ptr _runtimeScheduler; +#endif +} +@end + +#if RCT_NEW_ARCH_ENABLED +/// Declare conformance to `RCTComponentViewFactoryComponentProvider` +@interface AppDelegate () +@end +#endif + +static NSString *const kRNConcurrentRoot = @"concurrentRoot"; + @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions @@ -64,6 +115,67 @@ - (void)loadSourceForBridge:(RCTBridge *)bridge [RCTJavaScriptLoader loadBundleAtURL:[self sourceURLForBridge:bridge] onProgress:onProgress onComplete:loadCallback]; } +#pragma mark - RCTCxxBridgeDelegate + +// This function is called during +// `[[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];` +- (std::unique_ptr)jsExecutorFactoryForBridge:(RCTBridge *)bridge +{ + std::shared_ptr callInvoker = bridge.jsCallInvoker; + +#ifdef RN_FABRIC_ENABLED + _runtimeScheduler = std::make_shared(RCTRuntimeExecutorFromBridge(bridge)); + _contextContainer->erase("RuntimeScheduler"); + _contextContainer->insert("RuntimeScheduler", _runtimeScheduler); + callInvoker = std::make_shared(_runtimeScheduler); +#endif + + RCTTurboModuleManager *turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge + delegate:self + jsInvoker:callInvoker]; + [bridge setRCTTurboModuleRegistry:turboModuleManager]; + +#if RCT_DEV + /** + * Eagerly initialize RCTDevMenu so CMD + d, CMD + i, and CMD + r work. + * This is a stop gap until we have a system to eagerly init Turbo Modules. + */ + [turboModuleManager moduleForName:"RCTDevMenu"]; +#endif + + __weak __typeof(self) weakSelf = self; + +#if RCT_USE_HERMES + return std::make_unique( +#else + return std::make_unique( +#endif + facebook::react::RCTJSIExecutorRuntimeInstaller([weakSelf, bridge, turboModuleManager]( + facebook::jsi::Runtime &runtime) { + if (!bridge) { + return; + } + +#if RN_FABRIC_ENABLED + __typeof(self) strongSelf = weakSelf; + if (strongSelf && strongSelf->_runtimeScheduler) { + facebook::react::RuntimeSchedulerBinding::createAndInstallIfNeeded(runtime, strongSelf->_runtimeScheduler); + } +#endif + + facebook::react::RuntimeExecutor syncRuntimeExecutor = + [&](std::function &&callback) { callback(runtime); }; + [turboModuleManager installJSBindingWithRuntimeExecutor:syncRuntimeExecutor]; + })); +} + +#pragma mark - RCTTurboModuleManagerDelegate + +- (Class)getModuleClassFromName:(const char *)name +{ + return facebook::react::RNTesterTurboModuleClassProvider(name); +} + - (std::shared_ptr)getTurboModule:(const std::string &)name jsInvoker:(std::shared_ptr)jsInvoker { From dfb42a3946b6c1d20fd42d554027fef45f4ec70d Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 30 May 2023 13:13:36 -0700 Subject: [PATCH 14/33] Prepare bolts to be safe to use it from Kotlin Summary: In this diff I analyzed bolts library to ensure it's ready to be used from kotlin. I won't convert bolts to kotlin, but this is necessary to be able to convert its callsites (ReactHost) to kotlin bypass-github-export-checks changelog: [internal] internal Reviewed By: fkgozali Differential Revision: D46194127 fbshipit-source-id: 609e356230b1c87fe26571b811d23430d0168276 --- .../internal/bolts/AggregateException.java | 24 +++++++++++-------- .../internal/bolts/AndroidExecutors.java | 16 +++++++------ .../internal/bolts/BoltsExecutors.java | 18 +++++++------- .../internal/bolts/CancellationToken.java | 5 ++-- .../bolts/CancellationTokenRegistration.java | 8 ++++--- .../bolts/CancellationTokenSource.java | 19 ++++++++------- .../bridgeless/internal/bolts/Capture.java | 10 ++++---- .../internal/bolts/Continuation.java | 6 ++++- .../internal/bolts/ExecutorException.java | 4 +++- .../internal/bolts/TaskCompletionSource.java | 15 +++++++----- .../bolts/UnobservedErrorNotifier.java | 6 +++-- .../bolts/UnobservedTaskException.java | 4 +++- 12 files changed, 82 insertions(+), 53 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/AggregateException.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/AggregateException.java index 99d0351547da04..93294b3a5faa6c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/AggregateException.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/AggregateException.java @@ -7,6 +7,8 @@ package com.facebook.react.bridgeless.internal.bolts; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import java.io.PrintStream; import java.io.PrintWriter; import java.util.ArrayList; @@ -24,7 +26,7 @@ public class AggregateException extends Exception { private static final String DEFAULT_MESSAGE = "There were multiple errors."; - private List innerThrowables; + @NonNull private final List innerThrowables; /** * Constructs a new {@code AggregateException} with the current stack trace, the specified detail @@ -33,7 +35,7 @@ public class AggregateException extends Exception { * @param detailMessage The detail message for this exception. * @param innerThrowables The exceptions that are the cause of the current exception. */ - public AggregateException(String detailMessage, Throwable[] innerThrowables) { + public AggregateException(@NonNull String detailMessage, @NonNull Throwable[] innerThrowables) { this(detailMessage, Arrays.asList(innerThrowables)); } @@ -44,11 +46,13 @@ public AggregateException(String detailMessage, Throwable[] innerThrowables) { * @param detailMessage The detail message for this exception. * @param innerThrowables The exceptions that are the cause of the current exception. */ - public AggregateException(String detailMessage, List innerThrowables) { + public AggregateException( + @NonNull String detailMessage, @Nullable List innerThrowables) { super( detailMessage, innerThrowables != null && innerThrowables.size() > 0 ? innerThrowables.get(0) : null); - this.innerThrowables = Collections.unmodifiableList(innerThrowables); + this.innerThrowables = + Collections.unmodifiableList(innerThrowables != null ? innerThrowables : new ArrayList<>()); } /** @@ -57,7 +61,7 @@ public AggregateException(String detailMessage, List innerT * * @param innerThrowables The exceptions that are the cause of the current exception. */ - public AggregateException(List innerThrowables) { + public AggregateException(@Nullable List innerThrowables) { this(DEFAULT_MESSAGE, innerThrowables); } @@ -65,12 +69,12 @@ public AggregateException(List innerThrowables) { * Returns a read-only {@link List} of the {@link Throwable} instances that caused the current * exception. */ - public List getInnerThrowables() { + public @NonNull List getInnerThrowables() { return innerThrowables; } @Override - public void printStackTrace(PrintStream err) { + public void printStackTrace(@NonNull PrintStream err) { super.printStackTrace(err); int currentIndex = -1; @@ -85,7 +89,7 @@ public void printStackTrace(PrintStream err) { } @Override - public void printStackTrace(PrintWriter err) { + public void printStackTrace(@NonNull PrintWriter err) { super.printStackTrace(err); int currentIndex = -1; @@ -101,7 +105,7 @@ public void printStackTrace(PrintWriter err) { /** @deprecated Please use {@link #getInnerThrowables()} instead. */ @Deprecated - public List getErrors() { + public @NonNull List getErrors() { List errors = new ArrayList(); if (innerThrowables == null) { return errors; @@ -119,7 +123,7 @@ public List getErrors() { /** @deprecated Please use {@link #getInnerThrowables()} instead. */ @Deprecated - public Throwable[] getCauses() { + public @NonNull Throwable[] getCauses() { return innerThrowables.toArray(new Throwable[innerThrowables.size()]); } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/AndroidExecutors.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/AndroidExecutors.java index 3d87da1bc3a27e..f623bd40106003 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/AndroidExecutors.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/AndroidExecutors.java @@ -11,6 +11,7 @@ import android.os.Build; import android.os.Handler; import android.os.Looper; +import androidx.annotation.NonNull; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; import java.util.concurrent.LinkedBlockingQueue; @@ -32,11 +33,12 @@ * 0 and maxPoolSize is Integer.MAX_VALUE. This is dangerous because it can create an unchecked * amount of threads. */ -/* package */ final class AndroidExecutors { +/* package */ +final class AndroidExecutors { private static final AndroidExecutors INSTANCE = new AndroidExecutors(); - private final Executor uiThread; + @NonNull private final Executor uiThread; private AndroidExecutors() { uiThread = new UIThreadExecutor(); @@ -64,7 +66,7 @@ private AndroidExecutors() { * * @return the newly created thread pool */ - public static ExecutorService newCachedThreadPool() { + public static @NonNull ExecutorService newCachedThreadPool() { ThreadPoolExecutor executor = new ThreadPoolExecutor( CORE_POOL_SIZE, @@ -89,7 +91,7 @@ public static ExecutorService newCachedThreadPool() { * @param threadFactory the factory to use when creating new threads * @return the newly created thread pool */ - public static ExecutorService newCachedThreadPool(ThreadFactory threadFactory) { + public static @NonNull ExecutorService newCachedThreadPool(@NonNull ThreadFactory threadFactory) { ThreadPoolExecutor executor = new ThreadPoolExecutor( CORE_POOL_SIZE, @@ -114,21 +116,21 @@ public static ExecutorService newCachedThreadPool(ThreadFactory threadFactory) { * @param value true if should time out, else false */ @SuppressLint("NewApi") - public static void allowCoreThreadTimeout(ThreadPoolExecutor executor, boolean value) { + public static void allowCoreThreadTimeout(@NonNull ThreadPoolExecutor executor, boolean value) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { executor.allowCoreThreadTimeOut(value); } } /** An {@link java.util.concurrent.Executor} that executes tasks on the UI thread. */ - public static Executor uiThread() { + public static @NonNull Executor uiThread() { return INSTANCE.uiThread; } /** An {@link java.util.concurrent.Executor} that runs tasks on the UI thread. */ private static class UIThreadExecutor implements Executor { @Override - public void execute(Runnable command) { + public void execute(@NonNull Runnable command) { new Handler(Looper.getMainLooper()).post(command); } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/BoltsExecutors.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/BoltsExecutors.java index 0f3fc9c354ad7d..035871fce0b5e1 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/BoltsExecutors.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/BoltsExecutors.java @@ -7,6 +7,7 @@ package com.facebook.react.bridgeless.internal.bolts; +import androidx.annotation.NonNull; import java.util.Locale; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; @@ -14,7 +15,8 @@ import java.util.concurrent.ScheduledExecutorService; /** Collection of {@link Executor}s to use in conjunction with {@link Task}. */ -/* package */ final class BoltsExecutors { +/* package */ +final class BoltsExecutors { private static final BoltsExecutors INSTANCE = new BoltsExecutors(); @@ -26,9 +28,9 @@ private static boolean isAndroidRuntime() { return javaRuntimeName.toLowerCase(Locale.US).contains("android"); } - private final ExecutorService background; - private final ScheduledExecutorService scheduled; - private final Executor immediate; + private final @NonNull ExecutorService background; + private final @NonNull ScheduledExecutorService scheduled; + private final @NonNull Executor immediate; private BoltsExecutors() { background = @@ -40,11 +42,11 @@ private BoltsExecutors() { } /** An {@link java.util.concurrent.Executor} that executes tasks in parallel. */ - public static ExecutorService background() { + public static @NonNull ExecutorService background() { return INSTANCE.background; } - /* package */ static ScheduledExecutorService scheduled() { + /* package */ static @NonNull ScheduledExecutorService scheduled() { return INSTANCE.scheduled; } @@ -53,7 +55,7 @@ public static ExecutorService background() { * stack runs too deep, at which point it will delegate to {@link BoltsExecutors#background} in * order to trim the stack. */ - /* package */ static Executor immediate() { + /* package */ static @NonNull Executor immediate() { return INSTANCE.immediate; } @@ -102,7 +104,7 @@ private int decrementDepth() { } @Override - public void execute(Runnable command) { + public void execute(@NonNull Runnable command) { int depth = incrementDepth(); try { if (depth <= MAX_DEPTH) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/CancellationToken.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/CancellationToken.java index 5baba3bd66fa83..d85c74e3fc1a22 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/CancellationToken.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/CancellationToken.java @@ -7,6 +7,7 @@ package com.facebook.react.bridgeless.internal.bolts; +import androidx.annotation.NonNull; import java.util.Locale; import java.util.concurrent.CancellationException; @@ -29,7 +30,7 @@ public class CancellationToken { private final CancellationTokenSource tokenSource; - /* package */ CancellationToken(CancellationTokenSource tokenSource) { + /* package */ CancellationToken(@NonNull CancellationTokenSource tokenSource) { this.tokenSource = tokenSource; } @@ -49,7 +50,7 @@ public boolean isCancellationRequested() { * @return a {@link CancellationTokenRegistration} instance that can be used to unregister the * action. */ - public CancellationTokenRegistration register(Runnable action) { + public @NonNull CancellationTokenRegistration register(@NonNull Runnable action) { return tokenSource.register(action); } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/CancellationTokenRegistration.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/CancellationTokenRegistration.java index 67099fe7237746..8edb0a9f5b4a2d 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/CancellationTokenRegistration.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/CancellationTokenRegistration.java @@ -7,6 +7,8 @@ package com.facebook.react.bridgeless.internal.bolts; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import java.io.Closeable; /** @@ -17,12 +19,12 @@ public class CancellationTokenRegistration implements Closeable { private final Object lock = new Object(); - private CancellationTokenSource tokenSource; - private Runnable action; + private @Nullable CancellationTokenSource tokenSource; + private @Nullable Runnable action; private boolean closed; /* package */ CancellationTokenRegistration( - CancellationTokenSource tokenSource, Runnable action) { + @NonNull CancellationTokenSource tokenSource, @NonNull Runnable action) { this.tokenSource = tokenSource; this.action = action; } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/CancellationTokenSource.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/CancellationTokenSource.java index 4b20b3ff0560ad..59970ff30b17c1 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/CancellationTokenSource.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/CancellationTokenSource.java @@ -7,6 +7,8 @@ package com.facebook.react.bridgeless.internal.bolts; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import java.io.Closeable; import java.util.ArrayList; import java.util.List; @@ -27,9 +29,9 @@ public class CancellationTokenSource implements Closeable { private final Object lock = new Object(); - private final List registrations = new ArrayList<>(); - private final ScheduledExecutorService executor = BoltsExecutors.scheduled(); - private ScheduledFuture scheduledCancellation; + private final @NonNull List registrations = new ArrayList<>(); + private final @NonNull ScheduledExecutorService executor = BoltsExecutors.scheduled(); + @Nullable private ScheduledFuture scheduledCancellation; private boolean cancellationRequested; private boolean closed; @@ -48,7 +50,7 @@ public boolean isCancellationRequested() { } /** @return the token that can be passed to asynchronous method to control cancellation. */ - public CancellationToken getToken() { + public @NonNull CancellationToken getToken() { synchronized (lock) { throwIfClosed(); return new CancellationToken(this); @@ -84,7 +86,7 @@ public void cancelAfter(final long delay) { cancelAfter(delay, TimeUnit.MILLISECONDS); } - private void cancelAfter(long delay, TimeUnit timeUnit) { + private void cancelAfter(long delay, @NonNull TimeUnit timeUnit) { if (delay < -1) { throw new IllegalArgumentException("Delay must be >= -1"); } @@ -137,7 +139,8 @@ public void close() { } } - /* package */ CancellationTokenRegistration register(Runnable action) { + /* package */ @NonNull + CancellationTokenRegistration register(@NonNull Runnable action) { CancellationTokenRegistration ctr; synchronized (lock) { throwIfClosed(); @@ -165,7 +168,7 @@ public void close() { } } - /* package */ void unregister(CancellationTokenRegistration registration) { + /* package */ void unregister(@NonNull CancellationTokenRegistration registration) { synchronized (lock) { throwIfClosed(); registrations.remove(registration); @@ -178,7 +181,7 @@ public void close() { // to be synchronized with state changes you should provide external synchronization. // If this is invoked without external synchronization there is a probability the token becomes // cancelled concurrently. - private void notifyListeners(List registrations) { + private void notifyListeners(@NonNull List registrations) { for (CancellationTokenRegistration registration : registrations) { registration.runAction(); } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/Capture.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/Capture.java index 1689c354bb9e46..e2e0ddf0a213f9 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/Capture.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/Capture.java @@ -7,25 +7,27 @@ package com.facebook.react.bridgeless.internal.bolts; +import androidx.annotation.Nullable; + /** * Provides a class that can be used for capturing variables in an anonymous class implementation. * * @param */ public class Capture { - private T value; + private @Nullable T value; public Capture() {} - public Capture(T value) { + public Capture(@Nullable T value) { this.value = value; } - public T get() { + public @Nullable T get() { return value; } - public void set(T value) { + public void set(@Nullable T value) { this.value = value; } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/Continuation.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/Continuation.java index c271f9d70c3248..f11a224caf1ce0 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/Continuation.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/Continuation.java @@ -7,6 +7,9 @@ package com.facebook.react.bridgeless.internal.bolts; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + /** * A function to be called after a task completes. * @@ -16,5 +19,6 @@ * @see Task */ public interface Continuation { - TContinuationResult then(Task task) throws Exception; + @Nullable + TContinuationResult then(@NonNull Task task) throws Exception; } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/ExecutorException.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/ExecutorException.java index 146acdbc1e635a..e6d4990238a9a0 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/ExecutorException.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/ExecutorException.java @@ -7,13 +7,15 @@ package com.facebook.react.bridgeless.internal.bolts; +import androidx.annotation.Nullable; + /** * This is a wrapper class for emphasizing that task failed due to bad {@code Executor}, rather than * the continuation block it self. */ public class ExecutorException extends RuntimeException { - public ExecutorException(Exception e) { + public ExecutorException(@Nullable Exception e) { super("An exception was thrown by an Executor", e); } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/TaskCompletionSource.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/TaskCompletionSource.java index a82623161e9634..0c4566e85fea25 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/TaskCompletionSource.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/TaskCompletionSource.java @@ -7,6 +7,9 @@ package com.facebook.react.bridgeless.internal.bolts; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + /** * Allows safe orchestration of a task's completion, preventing the consumer from prematurely * completing the task. Essentially, it represents the producer side of a Task, providing @@ -15,7 +18,7 @@ */ public class TaskCompletionSource { - private final Task task; + @NonNull private final Task task; /** * Creates a TaskCompletionSource that orchestrates a Task. This allows the creator of a task to @@ -26,7 +29,7 @@ public TaskCompletionSource() { } /** @return the Task associated with this TaskCompletionSource. */ - public Task getTask() { + public @NonNull Task getTask() { return task; } @@ -36,12 +39,12 @@ public boolean trySetCancelled() { } /** Sets the result on the Task if the Task hasn't already been completed. */ - public boolean trySetResult(TResult result) { + public boolean trySetResult(@Nullable TResult result) { return task.trySetResult(result); } /** Sets the error on the Task if the Task hasn't already been completed. */ - public boolean trySetError(Exception error) { + public boolean trySetError(@Nullable Exception error) { return task.trySetError(error); } @@ -53,14 +56,14 @@ public void setCancelled() { } /** Sets the result of the Task, throwing if the Task has already been completed. */ - public void setResult(TResult result) { + public void setResult(@Nullable TResult result) { if (!trySetResult(result)) { throw new IllegalStateException("Cannot set the result of a completed task."); } } /** Sets the error of the Task, throwing if the Task has already been completed. */ - public void setError(Exception error) { + public void setError(@Nullable Exception error) { if (!trySetError(error)) { throw new IllegalStateException("Cannot set the error on a completed task."); } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/UnobservedErrorNotifier.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/UnobservedErrorNotifier.java index 808c497adeceec..b6aebef51e3e13 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/UnobservedErrorNotifier.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/UnobservedErrorNotifier.java @@ -7,15 +7,17 @@ package com.facebook.react.bridgeless.internal.bolts; +import androidx.annotation.Nullable; + /** * This class is used to retain a faulted task until either its error is observed or it is * finalized. If it is finalized with a task, then the uncaught exception handler is exected with an * UnobservedTaskException. */ class UnobservedErrorNotifier { - private Task task; + @Nullable private Task task; - public UnobservedErrorNotifier(Task task) { + public UnobservedErrorNotifier(@Nullable Task task) { this.task = task; } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/UnobservedTaskException.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/UnobservedTaskException.java index 793f49e5a8b4b8..b418c9a40fe8b1 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/UnobservedTaskException.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/UnobservedTaskException.java @@ -7,9 +7,11 @@ package com.facebook.react.bridgeless.internal.bolts; +import androidx.annotation.Nullable; + /** Used to signify that a Task's error went unobserved. */ public class UnobservedTaskException extends RuntimeException { - public UnobservedTaskException(Throwable cause) { + public UnobservedTaskException(@Nullable Throwable cause) { super(cause); } } From 730ca354050f46e4894e09a301f7ff40558ab313 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 30 May 2023 13:13:36 -0700 Subject: [PATCH 15/33] Prepare bolts.Task to be safe to be usde from Kotlin Summary: In this diff I analyzed bolts.Task class to ensure it's ready to be used from kotlin. I won't convert bolts.Task to kotlin, but this is necessary to be able to convert its callsites (ReactHost) to kotlin This is a 'continuation' of the previous diff, I splitted in 2 because Task is a very large class and it's worth analyzing separately. bypass-github-export-checks changelog: [internal] internal Reviewed By: cortinico Differential Revision: D46194126 fbshipit-source-id: 765af7683fa62814747c7d8516d311cffabac3c1 --- .../react/bridgeless/internal/bolts/Task.java | 233 ++++++++++-------- 1 file changed, 125 insertions(+), 108 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/Task.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/Task.java index 499afcab9d1c4c..5b66c9496c7764 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/Task.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/Task.java @@ -7,6 +7,8 @@ package com.facebook.react.bridgeless.internal.bolts; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -59,14 +61,14 @@ public interface UnobservedExceptionHandler { * @param t the task * @param e the exception */ - void unobservedException(Task t, UnobservedTaskException e); + void unobservedException(@NonNull Task t, @NonNull UnobservedTaskException e); } // null unless explicitly set private static volatile UnobservedExceptionHandler unobservedExceptionHandler; /** Returns the handler invoked when a task has an unobserved exception or {@code null}. */ - public static UnobservedExceptionHandler getUnobservedExceptionHandler() { + public static @Nullable UnobservedExceptionHandler getUnobservedExceptionHandler() { return unobservedExceptionHandler; } @@ -83,15 +85,15 @@ public static void setUnobservedExceptionHandler(UnobservedExceptionHandler eh) private final Object lock = new Object(); private boolean complete; private boolean cancelled; - private TResult result; - private Exception error; + @Nullable private TResult result; + @Nullable private Exception error; private boolean errorHasBeenObserved; - private UnobservedErrorNotifier unobservedErrorNotifier; - private List> continuations = new ArrayList<>(); + @Nullable private UnobservedErrorNotifier unobservedErrorNotifier; + @Nullable private List> continuations = new ArrayList<>(); /* package */ Task() {} - private Task(TResult result) { + private Task(@Nullable TResult result) { trySetResult(result); } @@ -103,7 +105,7 @@ private Task(boolean cancelled) { } } - public static TaskCompletionSource create() { + public static @NonNull TaskCompletionSource create() { Task task = new Task<>(); return new TaskCompletionSource(); } @@ -133,14 +135,14 @@ public boolean isFaulted() { } /** @return The result of the task, if set. {@code null} otherwise. */ - public TResult getResult() { + public @Nullable TResult getResult() { synchronized (lock) { return result; } } /** @return The error for the task, if set. {@code null} otherwise. */ - public Exception getError() { + public @Nullable Exception getError() { synchronized (lock) { if (error != null) { errorHasBeenObserved = true; @@ -168,7 +170,8 @@ public void waitForCompletion() throws InterruptedException { * @return {@code true} if the task completed (has a result, an error, or was cancelled). {@code * false} otherwise. */ - public boolean waitForCompletion(long duration, TimeUnit timeUnit) throws InterruptedException { + public boolean waitForCompletion(long duration, @NonNull TimeUnit timeUnit) + throws InterruptedException { synchronized (lock) { if (!isCompleted()) { lock.wait(timeUnit.toMillis(duration)); @@ -179,7 +182,7 @@ public boolean waitForCompletion(long duration, TimeUnit timeUnit) throws Interr /** Creates a completed task with the given value. */ @SuppressWarnings("unchecked") - public static Task forResult(TResult value) { + public static @NonNull Task forResult(@Nullable TResult value) { if (value == null) { return (Task) TASK_NULL; } @@ -192,7 +195,7 @@ public static Task forResult(TResult value) { } /** Creates a faulted task with the given error. */ - public static Task forError(Exception error) { + public static @NonNull Task forError(@Nullable Exception error) { TaskCompletionSource tcs = new TaskCompletionSource<>(); tcs.setError(error); return tcs.getTask(); @@ -200,7 +203,7 @@ public static Task forError(Exception error) { /** Creates a cancelled task. */ @SuppressWarnings("unchecked") - public static Task cancelled() { + public static @NonNull Task cancelled() { return (Task) TASK_CANCELLED; } @@ -210,7 +213,7 @@ public static Task cancelled() { * @param delay The number of milliseconds to wait before completing the returned task. Zero and * negative values are treated as requests for immediate execution. */ - public static Task delay(long delay) { + public static @NonNull Task delay(long delay) { return delay(delay, BoltsExecutors.scheduled(), null); } @@ -222,12 +225,15 @@ public static Task delay(long delay) { * @param cancellationToken The optional cancellation token that will be checked prior to * completing the returned task. */ - public static Task delay(long delay, CancellationToken cancellationToken) { + public static @NonNull Task delay( + long delay, @Nullable CancellationToken cancellationToken) { return delay(delay, BoltsExecutors.scheduled(), cancellationToken); } - /* package */ static Task delay( - long delay, ScheduledExecutorService executor, final CancellationToken cancellationToken) { + /* package */ static @NonNull Task delay( + long delay, + @NonNull ScheduledExecutorService executor, + @Nullable final CancellationToken cancellationToken) { if (cancellationToken != null && cancellationToken.isCancellationRequested()) { return Task.cancelled(); } @@ -266,14 +272,14 @@ public void run() { * Makes a fluent cast of a Task's result possible, avoiding an extra continuation just to cast * the type of the result. */ - public Task cast() { + public @NonNull Task cast() { @SuppressWarnings("unchecked") Task task = (Task) this; return task; } /** Turns a Task into a Task, dropping any result. */ - public Task makeVoid() { + public @NonNull Task makeVoid() { return this.continueWithTask( new Continuation>() { @Override @@ -295,13 +301,14 @@ public Task then(Task task) throws Exception { *

If you want to cancel the resulting Task throw a {@link * java.util.concurrent.CancellationException} from the callable. */ - public static Task callInBackground(Callable callable) { + public static @NonNull Task callInBackground( + @NonNull Callable callable) { return call(callable, BACKGROUND_EXECUTOR, null); } /** Invokes the callable on a background thread, returning a Task to represent the operation. */ - public static Task callInBackground( - Callable callable, CancellationToken ct) { + public static @NonNull Task callInBackground( + @NonNull Callable callable, @Nullable CancellationToken ct) { return call(callable, BACKGROUND_EXECUTOR, ct); } @@ -311,13 +318,16 @@ public static Task callInBackground( *

If you want to cancel the resulting Task throw a {@link * java.util.concurrent.CancellationException} from the callable. */ - public static Task call(final Callable callable, Executor executor) { + public static @NonNull Task call( + @NonNull final Callable callable, @NonNull Executor executor) { return call(callable, executor, null); } /** Invokes the callable using the given executor, returning a Task to represent the operation. */ - public static Task call( - final Callable callable, Executor executor, final CancellationToken ct) { + public static @NonNull Task call( + @NonNull final Callable callable, + @NonNull Executor executor, + @Nullable final CancellationToken ct) { final TaskCompletionSource tcs = new TaskCompletionSource<>(); try { executor.execute( @@ -351,13 +361,13 @@ public void run() { *

If you want to cancel the resulting Task throw a {@link * java.util.concurrent.CancellationException} from the callable. */ - public static Task call(final Callable callable) { + public static @NonNull Task call(@NonNull final Callable callable) { return call(callable, IMMEDIATE_EXECUTOR, null); } /** Invokes the callable on the current thread, producing a Task. */ - public static Task call( - final Callable callable, CancellationToken ct) { + public static @NonNull Task call( + @NonNull final Callable callable, @Nullable CancellationToken ct) { return call(callable, IMMEDIATE_EXECUTOR, ct); } @@ -372,8 +382,8 @@ public static Task call( * @return A task that represents the completion of one of the supplied tasks. The return task's * result is the task that completed. */ - public static Task> whenAnyResult( - Collection> tasks) { + public static @NonNull Task> whenAnyResult( + @NonNull Collection> tasks) { if (tasks.size() == 0) { return Task.forResult(null); } @@ -410,7 +420,7 @@ public Void then(Task task) { * Result is the task that completed. */ @SuppressWarnings("unchecked") - public static Task> whenAny(Collection> tasks) { + public static @NonNull Task> whenAny(@NonNull Collection> tasks) { if (tasks.size() == 0) { return Task.forResult(null); } @@ -462,8 +472,8 @@ public Void then(Task task) { * @return A Task that will resolve to {@code List<TResult>} when all the tasks are * resolved. */ - public static Task> whenAllResult( - final Collection> tasks) { + public static @NonNull Task> whenAllResult( + @NonNull final Collection> tasks) { return whenAll(tasks) .onSuccess( new Continuation>() { @@ -502,7 +512,7 @@ public List then(Task task) throws Exception { * @param tasks The tasks that the return value will wait for before completing. * @return A Task that will resolve to {@code Void} when all the tasks are resolved. */ - public static Task whenAll(Collection> tasks) { + public static @NonNull Task whenAll(@NonNull Collection> tasks) { if (tasks.size() == 0) { return Task.forResult(null); } @@ -558,8 +568,8 @@ public Void then(Task task) { * Continues a task with the equivalent of a Task-based while loop, where the body of the loop is * a task continuation. */ - public Task continueWhile( - Callable predicate, Continuation> continuation) { + public @NonNull Task continueWhile( + @NonNull Callable predicate, @NonNull Continuation> continuation) { return continueWhile(predicate, continuation, IMMEDIATE_EXECUTOR, null); } @@ -567,10 +577,10 @@ public Task continueWhile( * Continues a task with the equivalent of a Task-based while loop, where the body of the loop is * a task continuation. */ - public Task continueWhile( - Callable predicate, - Continuation> continuation, - CancellationToken ct) { + public @NonNull Task continueWhile( + @NonNull Callable predicate, + @NonNull Continuation> continuation, + @Nullable CancellationToken ct) { return continueWhile(predicate, continuation, IMMEDIATE_EXECUTOR, ct); } @@ -578,10 +588,10 @@ public Task continueWhile( * Continues a task with the equivalent of a Task-based while loop, where the body of the loop is * a task continuation. */ - public Task continueWhile( - final Callable predicate, - final Continuation> continuation, - final Executor executor) { + public @NonNull Task continueWhile( + @NonNull final Callable predicate, + @NonNull final Continuation> continuation, + @NonNull final Executor executor) { return continueWhile(predicate, continuation, executor, null); } @@ -589,11 +599,11 @@ public Task continueWhile( * Continues a task with the equivalent of a Task-based while loop, where the body of the loop is * a task continuation. */ - public Task continueWhile( - final Callable predicate, - final Continuation> continuation, - final Executor executor, - final CancellationToken ct) { + public @NonNull Task continueWhile( + @NonNull final Callable predicate, + @NonNull final Continuation> continuation, + @NonNull final Executor executor, + @Nullable final CancellationToken ct) { final Capture>> predicateContinuation = new Capture<>(); predicateContinuation.set( new Continuation>() { @@ -619,8 +629,9 @@ public Task then(Task task) throws Exception { * completes after the continuation has finished running. This allows the continuation to be * scheduled on different thread. */ - public Task continueWith( - final Continuation continuation, final Executor executor) { + public @NonNull Task continueWith( + @NonNull final Continuation continuation, + @NonNull final Executor executor) { return continueWith(continuation, executor, null); } @@ -629,10 +640,10 @@ public Task continueWith( * completes after the continuation has finished running. This allows the continuation to be * scheduled on different thread. */ - public Task continueWith( - final Continuation continuation, - final Executor executor, - final CancellationToken ct) { + public @NonNull Task continueWith( + @NonNull final Continuation continuation, + @NonNull final Executor executor, + @Nullable final CancellationToken ct) { boolean completed; final TaskCompletionSource tcs = new TaskCompletionSource<>(); synchronized (lock) { @@ -658,8 +669,8 @@ public Void then(Task task) { * Adds a synchronous continuation to this task, returning a new task that completes after the * continuation has finished running. */ - public Task continueWith( - Continuation continuation) { + public @NonNull Task continueWith( + @NonNull Continuation continuation) { return continueWith(continuation, IMMEDIATE_EXECUTOR, null); } @@ -667,8 +678,9 @@ public Task continueWith( * Adds a synchronous continuation to this task, returning a new task that completes after the * continuation has finished running. */ - public Task continueWith( - Continuation continuation, CancellationToken ct) { + public @NonNull Task continueWith( + @NonNull Continuation continuation, + @Nullable CancellationToken ct) { return continueWith(continuation, IMMEDIATE_EXECUTOR, ct); } @@ -676,9 +688,9 @@ public Task continueWith( * Adds an Task-based continuation to this task that will be scheduled using the executor, * returning a new task that completes after the task returned by the continuation has completed. */ - public Task continueWithTask( - final Continuation> continuation, - final Executor executor) { + public @NonNull Task continueWithTask( + @NonNull final Continuation> continuation, + @NonNull final Executor executor) { return continueWithTask(continuation, executor, null); } @@ -686,10 +698,10 @@ public Task continueWithTask( * Adds an Task-based continuation to this task that will be scheduled using the executor, * returning a new task that completes after the task returned by the continuation has completed. */ - public Task continueWithTask( - final Continuation> continuation, - final Executor executor, - final CancellationToken ct) { + public @NonNull Task continueWithTask( + @NonNull final Continuation> continuation, + @NonNull final Executor executor, + @Nullable final CancellationToken ct) { boolean completed; final TaskCompletionSource tcs = new TaskCompletionSource<>(); synchronized (lock) { @@ -715,8 +727,8 @@ public Void then(Task task) { * Adds an asynchronous continuation to this task, returning a new task that completes after the * task returned by the continuation has completed. */ - public Task continueWithTask( - Continuation> continuation) { + public @NonNull Task continueWithTask( + @NonNull Continuation> continuation) { return continueWithTask(continuation, IMMEDIATE_EXECUTOR, null); } @@ -724,8 +736,9 @@ public Task continueWithTask( * Adds an asynchronous continuation to this task, returning a new task that completes after the * task returned by the continuation has completed. */ - public Task continueWithTask( - Continuation> continuation, CancellationToken ct) { + public @NonNull Task continueWithTask( + @NonNull Continuation> continuation, + @Nullable CancellationToken ct) { return continueWithTask(continuation, IMMEDIATE_EXECUTOR, ct); } @@ -733,8 +746,9 @@ public Task continueWithTask( * Runs a continuation when a task completes successfully, forwarding along {@link * java.lang.Exception} or cancellation. */ - public Task onSuccess( - final Continuation continuation, Executor executor) { + public @NonNull Task onSuccess( + @NonNull final Continuation continuation, + @NonNull Executor executor) { return onSuccess(continuation, executor, null); } @@ -742,10 +756,10 @@ public Task onSuccess( * Runs a continuation when a task completes successfully, forwarding along {@link * java.lang.Exception} or cancellation. */ - public Task onSuccess( - final Continuation continuation, - Executor executor, - final CancellationToken ct) { + public @NonNull Task onSuccess( + @NonNull final Continuation continuation, + @NonNull Executor executor, + @Nullable final CancellationToken ct) { return continueWithTask( new Continuation>() { @Override @@ -770,8 +784,8 @@ public Task then(Task task) { * Runs a continuation when a task completes successfully, forwarding along {@link * java.lang.Exception}s or cancellation. */ - public Task onSuccess( - final Continuation continuation) { + public @NonNull Task onSuccess( + @NonNull final Continuation continuation) { return onSuccess(continuation, IMMEDIATE_EXECUTOR, null); } @@ -779,8 +793,9 @@ public Task onSuccess( * Runs a continuation when a task completes successfully, forwarding along {@link * java.lang.Exception}s or cancellation. */ - public Task onSuccess( - final Continuation continuation, CancellationToken ct) { + public @NonNull Task onSuccess( + @NonNull final Continuation continuation, + @Nullable CancellationToken ct) { return onSuccess(continuation, IMMEDIATE_EXECUTOR, ct); } @@ -788,8 +803,9 @@ public Task onSuccess( * Runs a continuation when a task completes successfully, forwarding along {@link * java.lang.Exception}s or cancellation. */ - public Task onSuccessTask( - final Continuation> continuation, Executor executor) { + public @NonNull Task onSuccessTask( + @NonNull final Continuation> continuation, + @NonNull Executor executor) { return onSuccessTask(continuation, executor, null); } @@ -797,10 +813,10 @@ public Task onSuccessTask( * Runs a continuation when a task completes successfully, forwarding along {@link * java.lang.Exception}s or cancellation. */ - public Task onSuccessTask( - final Continuation> continuation, - Executor executor, - final CancellationToken ct) { + public @NonNull Task onSuccessTask( + @NonNull final Continuation> continuation, + @NonNull Executor executor, + @Nullable final CancellationToken ct) { return continueWithTask( new Continuation>() { @Override @@ -825,8 +841,8 @@ public Task then(Task task) { * Runs a continuation when a task completes successfully, forwarding along {@link * java.lang.Exception}s or cancellation. */ - public Task onSuccessTask( - final Continuation> continuation) { + public @NonNull Task onSuccessTask( + @NonNull final Continuation> continuation) { return onSuccessTask(continuation, IMMEDIATE_EXECUTOR); } @@ -834,8 +850,9 @@ public Task onSuccessTask( * Runs a continuation when a task completes successfully, forwarding along {@link * java.lang.Exception}s or cancellation. */ - public Task onSuccessTask( - final Continuation> continuation, CancellationToken ct) { + public @NonNull Task onSuccessTask( + @NonNull final Continuation> continuation, + @Nullable CancellationToken ct) { return onSuccessTask(continuation, IMMEDIATE_EXECUTOR, ct); } @@ -851,11 +868,11 @@ public Task onSuccessTask( * be scheduled on a different thread). */ private static void completeImmediately( - final TaskCompletionSource tcs, - final Continuation continuation, - final Task task, - Executor executor, - final CancellationToken ct) { + @NonNull final TaskCompletionSource tcs, + @NonNull final Continuation continuation, + @NonNull final Task task, + @NonNull Executor executor, + @Nullable final CancellationToken ct) { try { executor.execute( new Runnable() { @@ -894,11 +911,11 @@ public void run() { * be scheduled on a different thread). */ private static void completeAfterTask( - final TaskCompletionSource tcs, - final Continuation> continuation, - final Task task, - final Executor executor, - final CancellationToken ct) { + @NonNull final TaskCompletionSource tcs, + @NonNull final Continuation> continuation, + @NonNull final Task task, + @NonNull final Executor executor, + @Nullable final CancellationToken ct) { try { executor.execute( new Runnable() { @@ -917,7 +934,7 @@ public void run() { result.continueWith( new Continuation() { @Override - public Void then(Task task) { + public Void then(@NonNull Task task) { if (ct != null && ct.isCancellationRequested()) { tcs.setCancelled(); return null; @@ -976,7 +993,7 @@ private void runContinuations() { } /** Sets the result on the Task if the Task hasn't already been completed. */ - /* package */ boolean trySetResult(TResult result) { + /* package */ boolean trySetResult(@Nullable TResult result) { synchronized (lock) { if (complete) { return false; @@ -990,7 +1007,7 @@ private void runContinuations() { } /** Sets the error on the Task if the Task hasn't already been completed. */ - /* package */ boolean trySetError(Exception error) { + /* package */ boolean trySetError(@Nullable Exception error) { synchronized (lock) { if (complete) { return false; @@ -1006,8 +1023,8 @@ private void runContinuations() { } } - private static Task TASK_NULL = new Task<>(null); - private static Task TASK_TRUE = new Task<>((Boolean) true); - private static Task TASK_FALSE = new Task<>((Boolean) false); - private static Task TASK_CANCELLED = new Task(true); + private static final Task TASK_NULL = new Task<>(null); + private static final Task TASK_TRUE = new Task<>((Boolean) true); + private static final Task TASK_FALSE = new Task<>((Boolean) false); + private static final Task TASK_CANCELLED = new Task(true); } From 0e83c53122f871f54c562b945e3cb9e2c27c406f Mon Sep 17 00:00:00 2001 From: Chetan Ambekar Date: Tue, 30 May 2023 17:35:54 -0700 Subject: [PATCH 16/33] Revert D46194126: Prepare bolts.Task to be safe to be usde from Kotlin Differential Revision: D46194126 Original commit changeset: 765af7683fa6 Original Phabricator Diff: D46194126 fbshipit-source-id: e35e25dada9006c654cf02f269f3c1c6fc5c6b13 --- .../react/bridgeless/internal/bolts/Task.java | 233 ++++++++---------- 1 file changed, 108 insertions(+), 125 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/Task.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/Task.java index 5b66c9496c7764..499afcab9d1c4c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/Task.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridgeless/internal/bolts/Task.java @@ -7,8 +7,6 @@ package com.facebook.react.bridgeless.internal.bolts; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -61,14 +59,14 @@ public interface UnobservedExceptionHandler { * @param t the task * @param e the exception */ - void unobservedException(@NonNull Task t, @NonNull UnobservedTaskException e); + void unobservedException(Task t, UnobservedTaskException e); } // null unless explicitly set private static volatile UnobservedExceptionHandler unobservedExceptionHandler; /** Returns the handler invoked when a task has an unobserved exception or {@code null}. */ - public static @Nullable UnobservedExceptionHandler getUnobservedExceptionHandler() { + public static UnobservedExceptionHandler getUnobservedExceptionHandler() { return unobservedExceptionHandler; } @@ -85,15 +83,15 @@ public static void setUnobservedExceptionHandler(UnobservedExceptionHandler eh) private final Object lock = new Object(); private boolean complete; private boolean cancelled; - @Nullable private TResult result; - @Nullable private Exception error; + private TResult result; + private Exception error; private boolean errorHasBeenObserved; - @Nullable private UnobservedErrorNotifier unobservedErrorNotifier; - @Nullable private List> continuations = new ArrayList<>(); + private UnobservedErrorNotifier unobservedErrorNotifier; + private List> continuations = new ArrayList<>(); /* package */ Task() {} - private Task(@Nullable TResult result) { + private Task(TResult result) { trySetResult(result); } @@ -105,7 +103,7 @@ private Task(boolean cancelled) { } } - public static @NonNull TaskCompletionSource create() { + public static TaskCompletionSource create() { Task task = new Task<>(); return new TaskCompletionSource(); } @@ -135,14 +133,14 @@ public boolean isFaulted() { } /** @return The result of the task, if set. {@code null} otherwise. */ - public @Nullable TResult getResult() { + public TResult getResult() { synchronized (lock) { return result; } } /** @return The error for the task, if set. {@code null} otherwise. */ - public @Nullable Exception getError() { + public Exception getError() { synchronized (lock) { if (error != null) { errorHasBeenObserved = true; @@ -170,8 +168,7 @@ public void waitForCompletion() throws InterruptedException { * @return {@code true} if the task completed (has a result, an error, or was cancelled). {@code * false} otherwise. */ - public boolean waitForCompletion(long duration, @NonNull TimeUnit timeUnit) - throws InterruptedException { + public boolean waitForCompletion(long duration, TimeUnit timeUnit) throws InterruptedException { synchronized (lock) { if (!isCompleted()) { lock.wait(timeUnit.toMillis(duration)); @@ -182,7 +179,7 @@ public boolean waitForCompletion(long duration, @NonNull TimeUnit timeUnit) /** Creates a completed task with the given value. */ @SuppressWarnings("unchecked") - public static @NonNull Task forResult(@Nullable TResult value) { + public static Task forResult(TResult value) { if (value == null) { return (Task) TASK_NULL; } @@ -195,7 +192,7 @@ public boolean waitForCompletion(long duration, @NonNull TimeUnit timeUnit) } /** Creates a faulted task with the given error. */ - public static @NonNull Task forError(@Nullable Exception error) { + public static Task forError(Exception error) { TaskCompletionSource tcs = new TaskCompletionSource<>(); tcs.setError(error); return tcs.getTask(); @@ -203,7 +200,7 @@ public boolean waitForCompletion(long duration, @NonNull TimeUnit timeUnit) /** Creates a cancelled task. */ @SuppressWarnings("unchecked") - public static @NonNull Task cancelled() { + public static Task cancelled() { return (Task) TASK_CANCELLED; } @@ -213,7 +210,7 @@ public boolean waitForCompletion(long duration, @NonNull TimeUnit timeUnit) * @param delay The number of milliseconds to wait before completing the returned task. Zero and * negative values are treated as requests for immediate execution. */ - public static @NonNull Task delay(long delay) { + public static Task delay(long delay) { return delay(delay, BoltsExecutors.scheduled(), null); } @@ -225,15 +222,12 @@ public boolean waitForCompletion(long duration, @NonNull TimeUnit timeUnit) * @param cancellationToken The optional cancellation token that will be checked prior to * completing the returned task. */ - public static @NonNull Task delay( - long delay, @Nullable CancellationToken cancellationToken) { + public static Task delay(long delay, CancellationToken cancellationToken) { return delay(delay, BoltsExecutors.scheduled(), cancellationToken); } - /* package */ static @NonNull Task delay( - long delay, - @NonNull ScheduledExecutorService executor, - @Nullable final CancellationToken cancellationToken) { + /* package */ static Task delay( + long delay, ScheduledExecutorService executor, final CancellationToken cancellationToken) { if (cancellationToken != null && cancellationToken.isCancellationRequested()) { return Task.cancelled(); } @@ -272,14 +266,14 @@ public void run() { * Makes a fluent cast of a Task's result possible, avoiding an extra continuation just to cast * the type of the result. */ - public @NonNull Task cast() { + public Task cast() { @SuppressWarnings("unchecked") Task task = (Task) this; return task; } /** Turns a Task into a Task, dropping any result. */ - public @NonNull Task makeVoid() { + public Task makeVoid() { return this.continueWithTask( new Continuation>() { @Override @@ -301,14 +295,13 @@ public Task then(Task task) throws Exception { *

If you want to cancel the resulting Task throw a {@link * java.util.concurrent.CancellationException} from the callable. */ - public static @NonNull Task callInBackground( - @NonNull Callable callable) { + public static Task callInBackground(Callable callable) { return call(callable, BACKGROUND_EXECUTOR, null); } /** Invokes the callable on a background thread, returning a Task to represent the operation. */ - public static @NonNull Task callInBackground( - @NonNull Callable callable, @Nullable CancellationToken ct) { + public static Task callInBackground( + Callable callable, CancellationToken ct) { return call(callable, BACKGROUND_EXECUTOR, ct); } @@ -318,16 +311,13 @@ public Task then(Task task) throws Exception { *

If you want to cancel the resulting Task throw a {@link * java.util.concurrent.CancellationException} from the callable. */ - public static @NonNull Task call( - @NonNull final Callable callable, @NonNull Executor executor) { + public static Task call(final Callable callable, Executor executor) { return call(callable, executor, null); } /** Invokes the callable using the given executor, returning a Task to represent the operation. */ - public static @NonNull Task call( - @NonNull final Callable callable, - @NonNull Executor executor, - @Nullable final CancellationToken ct) { + public static Task call( + final Callable callable, Executor executor, final CancellationToken ct) { final TaskCompletionSource tcs = new TaskCompletionSource<>(); try { executor.execute( @@ -361,13 +351,13 @@ public void run() { *

If you want to cancel the resulting Task throw a {@link * java.util.concurrent.CancellationException} from the callable. */ - public static @NonNull Task call(@NonNull final Callable callable) { + public static Task call(final Callable callable) { return call(callable, IMMEDIATE_EXECUTOR, null); } /** Invokes the callable on the current thread, producing a Task. */ - public static @NonNull Task call( - @NonNull final Callable callable, @Nullable CancellationToken ct) { + public static Task call( + final Callable callable, CancellationToken ct) { return call(callable, IMMEDIATE_EXECUTOR, ct); } @@ -382,8 +372,8 @@ public void run() { * @return A task that represents the completion of one of the supplied tasks. The return task's * result is the task that completed. */ - public static @NonNull Task> whenAnyResult( - @NonNull Collection> tasks) { + public static Task> whenAnyResult( + Collection> tasks) { if (tasks.size() == 0) { return Task.forResult(null); } @@ -420,7 +410,7 @@ public Void then(Task task) { * Result is the task that completed. */ @SuppressWarnings("unchecked") - public static @NonNull Task> whenAny(@NonNull Collection> tasks) { + public static Task> whenAny(Collection> tasks) { if (tasks.size() == 0) { return Task.forResult(null); } @@ -472,8 +462,8 @@ public Void then(Task task) { * @return A Task that will resolve to {@code List<TResult>} when all the tasks are * resolved. */ - public static @NonNull Task> whenAllResult( - @NonNull final Collection> tasks) { + public static Task> whenAllResult( + final Collection> tasks) { return whenAll(tasks) .onSuccess( new Continuation>() { @@ -512,7 +502,7 @@ public List then(Task task) throws Exception { * @param tasks The tasks that the return value will wait for before completing. * @return A Task that will resolve to {@code Void} when all the tasks are resolved. */ - public static @NonNull Task whenAll(@NonNull Collection> tasks) { + public static Task whenAll(Collection> tasks) { if (tasks.size() == 0) { return Task.forResult(null); } @@ -568,8 +558,8 @@ public Void then(Task task) { * Continues a task with the equivalent of a Task-based while loop, where the body of the loop is * a task continuation. */ - public @NonNull Task continueWhile( - @NonNull Callable predicate, @NonNull Continuation> continuation) { + public Task continueWhile( + Callable predicate, Continuation> continuation) { return continueWhile(predicate, continuation, IMMEDIATE_EXECUTOR, null); } @@ -577,10 +567,10 @@ public Void then(Task task) { * Continues a task with the equivalent of a Task-based while loop, where the body of the loop is * a task continuation. */ - public @NonNull Task continueWhile( - @NonNull Callable predicate, - @NonNull Continuation> continuation, - @Nullable CancellationToken ct) { + public Task continueWhile( + Callable predicate, + Continuation> continuation, + CancellationToken ct) { return continueWhile(predicate, continuation, IMMEDIATE_EXECUTOR, ct); } @@ -588,10 +578,10 @@ public Void then(Task task) { * Continues a task with the equivalent of a Task-based while loop, where the body of the loop is * a task continuation. */ - public @NonNull Task continueWhile( - @NonNull final Callable predicate, - @NonNull final Continuation> continuation, - @NonNull final Executor executor) { + public Task continueWhile( + final Callable predicate, + final Continuation> continuation, + final Executor executor) { return continueWhile(predicate, continuation, executor, null); } @@ -599,11 +589,11 @@ public Void then(Task task) { * Continues a task with the equivalent of a Task-based while loop, where the body of the loop is * a task continuation. */ - public @NonNull Task continueWhile( - @NonNull final Callable predicate, - @NonNull final Continuation> continuation, - @NonNull final Executor executor, - @Nullable final CancellationToken ct) { + public Task continueWhile( + final Callable predicate, + final Continuation> continuation, + final Executor executor, + final CancellationToken ct) { final Capture>> predicateContinuation = new Capture<>(); predicateContinuation.set( new Continuation>() { @@ -629,9 +619,8 @@ public Task then(Task task) throws Exception { * completes after the continuation has finished running. This allows the continuation to be * scheduled on different thread. */ - public @NonNull Task continueWith( - @NonNull final Continuation continuation, - @NonNull final Executor executor) { + public Task continueWith( + final Continuation continuation, final Executor executor) { return continueWith(continuation, executor, null); } @@ -640,10 +629,10 @@ public Task then(Task task) throws Exception { * completes after the continuation has finished running. This allows the continuation to be * scheduled on different thread. */ - public @NonNull Task continueWith( - @NonNull final Continuation continuation, - @NonNull final Executor executor, - @Nullable final CancellationToken ct) { + public Task continueWith( + final Continuation continuation, + final Executor executor, + final CancellationToken ct) { boolean completed; final TaskCompletionSource tcs = new TaskCompletionSource<>(); synchronized (lock) { @@ -669,8 +658,8 @@ public Void then(Task task) { * Adds a synchronous continuation to this task, returning a new task that completes after the * continuation has finished running. */ - public @NonNull Task continueWith( - @NonNull Continuation continuation) { + public Task continueWith( + Continuation continuation) { return continueWith(continuation, IMMEDIATE_EXECUTOR, null); } @@ -678,9 +667,8 @@ public Void then(Task task) { * Adds a synchronous continuation to this task, returning a new task that completes after the * continuation has finished running. */ - public @NonNull Task continueWith( - @NonNull Continuation continuation, - @Nullable CancellationToken ct) { + public Task continueWith( + Continuation continuation, CancellationToken ct) { return continueWith(continuation, IMMEDIATE_EXECUTOR, ct); } @@ -688,9 +676,9 @@ public Void then(Task task) { * Adds an Task-based continuation to this task that will be scheduled using the executor, * returning a new task that completes after the task returned by the continuation has completed. */ - public @NonNull Task continueWithTask( - @NonNull final Continuation> continuation, - @NonNull final Executor executor) { + public Task continueWithTask( + final Continuation> continuation, + final Executor executor) { return continueWithTask(continuation, executor, null); } @@ -698,10 +686,10 @@ public Void then(Task task) { * Adds an Task-based continuation to this task that will be scheduled using the executor, * returning a new task that completes after the task returned by the continuation has completed. */ - public @NonNull Task continueWithTask( - @NonNull final Continuation> continuation, - @NonNull final Executor executor, - @Nullable final CancellationToken ct) { + public Task continueWithTask( + final Continuation> continuation, + final Executor executor, + final CancellationToken ct) { boolean completed; final TaskCompletionSource tcs = new TaskCompletionSource<>(); synchronized (lock) { @@ -727,8 +715,8 @@ public Void then(Task task) { * Adds an asynchronous continuation to this task, returning a new task that completes after the * task returned by the continuation has completed. */ - public @NonNull Task continueWithTask( - @NonNull Continuation> continuation) { + public Task continueWithTask( + Continuation> continuation) { return continueWithTask(continuation, IMMEDIATE_EXECUTOR, null); } @@ -736,9 +724,8 @@ public Void then(Task task) { * Adds an asynchronous continuation to this task, returning a new task that completes after the * task returned by the continuation has completed. */ - public @NonNull Task continueWithTask( - @NonNull Continuation> continuation, - @Nullable CancellationToken ct) { + public Task continueWithTask( + Continuation> continuation, CancellationToken ct) { return continueWithTask(continuation, IMMEDIATE_EXECUTOR, ct); } @@ -746,9 +733,8 @@ public Void then(Task task) { * Runs a continuation when a task completes successfully, forwarding along {@link * java.lang.Exception} or cancellation. */ - public @NonNull Task onSuccess( - @NonNull final Continuation continuation, - @NonNull Executor executor) { + public Task onSuccess( + final Continuation continuation, Executor executor) { return onSuccess(continuation, executor, null); } @@ -756,10 +742,10 @@ public Void then(Task task) { * Runs a continuation when a task completes successfully, forwarding along {@link * java.lang.Exception} or cancellation. */ - public @NonNull Task onSuccess( - @NonNull final Continuation continuation, - @NonNull Executor executor, - @Nullable final CancellationToken ct) { + public Task onSuccess( + final Continuation continuation, + Executor executor, + final CancellationToken ct) { return continueWithTask( new Continuation>() { @Override @@ -784,8 +770,8 @@ public Task then(Task task) { * Runs a continuation when a task completes successfully, forwarding along {@link * java.lang.Exception}s or cancellation. */ - public @NonNull Task onSuccess( - @NonNull final Continuation continuation) { + public Task onSuccess( + final Continuation continuation) { return onSuccess(continuation, IMMEDIATE_EXECUTOR, null); } @@ -793,9 +779,8 @@ public Task then(Task task) { * Runs a continuation when a task completes successfully, forwarding along {@link * java.lang.Exception}s or cancellation. */ - public @NonNull Task onSuccess( - @NonNull final Continuation continuation, - @Nullable CancellationToken ct) { + public Task onSuccess( + final Continuation continuation, CancellationToken ct) { return onSuccess(continuation, IMMEDIATE_EXECUTOR, ct); } @@ -803,9 +788,8 @@ public Task then(Task task) { * Runs a continuation when a task completes successfully, forwarding along {@link * java.lang.Exception}s or cancellation. */ - public @NonNull Task onSuccessTask( - @NonNull final Continuation> continuation, - @NonNull Executor executor) { + public Task onSuccessTask( + final Continuation> continuation, Executor executor) { return onSuccessTask(continuation, executor, null); } @@ -813,10 +797,10 @@ public Task then(Task task) { * Runs a continuation when a task completes successfully, forwarding along {@link * java.lang.Exception}s or cancellation. */ - public @NonNull Task onSuccessTask( - @NonNull final Continuation> continuation, - @NonNull Executor executor, - @Nullable final CancellationToken ct) { + public Task onSuccessTask( + final Continuation> continuation, + Executor executor, + final CancellationToken ct) { return continueWithTask( new Continuation>() { @Override @@ -841,8 +825,8 @@ public Task then(Task task) { * Runs a continuation when a task completes successfully, forwarding along {@link * java.lang.Exception}s or cancellation. */ - public @NonNull Task onSuccessTask( - @NonNull final Continuation> continuation) { + public Task onSuccessTask( + final Continuation> continuation) { return onSuccessTask(continuation, IMMEDIATE_EXECUTOR); } @@ -850,9 +834,8 @@ public Task then(Task task) { * Runs a continuation when a task completes successfully, forwarding along {@link * java.lang.Exception}s or cancellation. */ - public @NonNull Task onSuccessTask( - @NonNull final Continuation> continuation, - @Nullable CancellationToken ct) { + public Task onSuccessTask( + final Continuation> continuation, CancellationToken ct) { return onSuccessTask(continuation, IMMEDIATE_EXECUTOR, ct); } @@ -868,11 +851,11 @@ public Task then(Task task) { * be scheduled on a different thread). */ private static void completeImmediately( - @NonNull final TaskCompletionSource tcs, - @NonNull final Continuation continuation, - @NonNull final Task task, - @NonNull Executor executor, - @Nullable final CancellationToken ct) { + final TaskCompletionSource tcs, + final Continuation continuation, + final Task task, + Executor executor, + final CancellationToken ct) { try { executor.execute( new Runnable() { @@ -911,11 +894,11 @@ public void run() { * be scheduled on a different thread). */ private static void completeAfterTask( - @NonNull final TaskCompletionSource tcs, - @NonNull final Continuation> continuation, - @NonNull final Task task, - @NonNull final Executor executor, - @Nullable final CancellationToken ct) { + final TaskCompletionSource tcs, + final Continuation> continuation, + final Task task, + final Executor executor, + final CancellationToken ct) { try { executor.execute( new Runnable() { @@ -934,7 +917,7 @@ public void run() { result.continueWith( new Continuation() { @Override - public Void then(@NonNull Task task) { + public Void then(Task task) { if (ct != null && ct.isCancellationRequested()) { tcs.setCancelled(); return null; @@ -993,7 +976,7 @@ private void runContinuations() { } /** Sets the result on the Task if the Task hasn't already been completed. */ - /* package */ boolean trySetResult(@Nullable TResult result) { + /* package */ boolean trySetResult(TResult result) { synchronized (lock) { if (complete) { return false; @@ -1007,7 +990,7 @@ private void runContinuations() { } /** Sets the error on the Task if the Task hasn't already been completed. */ - /* package */ boolean trySetError(@Nullable Exception error) { + /* package */ boolean trySetError(Exception error) { synchronized (lock) { if (complete) { return false; @@ -1023,8 +1006,8 @@ private void runContinuations() { } } - private static final Task TASK_NULL = new Task<>(null); - private static final Task TASK_TRUE = new Task<>((Boolean) true); - private static final Task TASK_FALSE = new Task<>((Boolean) false); - private static final Task TASK_CANCELLED = new Task(true); + private static Task TASK_NULL = new Task<>(null); + private static Task TASK_TRUE = new Task<>((Boolean) true); + private static Task TASK_FALSE = new Task<>((Boolean) false); + private static Task TASK_CANCELLED = new Task(true); } From b55f55198c98ae5fc1c553b9a40061c0f015ee67 Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Wed, 31 May 2023 06:58:15 -0700 Subject: [PATCH 17/33] Fix header imports (#37625) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37625 changelog: [internal] - Add explicit import - change include to import. Reviewed By: FieryRobot Differential Revision: D46284890 fbshipit-source-id: 8eb656c28f58295468b964e86f59b91ca562b570 --- packages/react-native/React/Fabric/RCTScheduler.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/React/Fabric/RCTScheduler.mm b/packages/react-native/React/Fabric/RCTScheduler.mm index 5c21d443c681f8..d0a88518a64e3f 100644 --- a/packages/react-native/React/Fabric/RCTScheduler.mm +++ b/packages/react-native/React/Fabric/RCTScheduler.mm @@ -12,7 +12,7 @@ #import #import #import -#include +#import #import From d0fed3adb6ea0524f0e3157d394a06c65aa9ef30 Mon Sep 17 00:00:00 2001 From: Ramanpreet Nara Date: Wed, 31 May 2023 13:02:12 -0700 Subject: [PATCH 18/33] Remove noexcept from UIManager methods that invoke JavaScript callbacks Summary: As far as I'm aware, there's no way to know/guarantee whether a JavaScript callback can throw an exception or not. So, all UIManager methods that synchronously invoke JavaScript callbacks cannot use noexcept. If they do use noexcept, and the JavaScript callback (i.e: product code) throws an exception, the app will crash. Changelog: [Internal] Created from CodeHub with https://fburl.com/edit-in-codehub Reviewed By: javache Differential Revision: D46122985 fbshipit-source-id: 2f4356c7dbab1b3a5e0549f58e73f6de1b626ce9 --- .../react/renderer/uimanager/UIManagerBinding.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp index 885c88da4ab980..f9c0580a228553 100644 --- a/packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp +++ b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp @@ -249,7 +249,7 @@ jsi::Value UIManagerBinding::get( jsi::Runtime &runtime, jsi::Value const & /*thisValue*/, jsi::Value const *arguments, - size_t /*count*/) noexcept -> jsi::Value { + size_t /*count*/) { auto node = shadowNodeFromValue(runtime, arguments[0]); auto locationX = (Float)arguments[1].getNumber(); auto locationY = (Float)arguments[2].getNumber(); @@ -538,7 +538,7 @@ jsi::Value UIManagerBinding::get( jsi::Runtime &runtime, jsi::Value const & /*thisValue*/, jsi::Value const *arguments, - size_t /*count*/) noexcept -> jsi::Value { + size_t /*count*/) { auto layoutMetrics = uiManager->getRelativeLayoutMetrics( *shadowNodeFromValue(runtime, arguments[0]), shadowNodeFromValue(runtime, arguments[1]).get(), @@ -574,7 +574,7 @@ jsi::Value UIManagerBinding::get( jsi::Runtime &runtime, jsi::Value const & /*thisValue*/, jsi::Value const *arguments, - size_t /*count*/) noexcept -> jsi::Value { + size_t /*count*/) { auto shadowNode = shadowNodeFromValue(runtime, arguments[0]); auto layoutMetrics = uiManager->getRelativeLayoutMetrics( *shadowNode, nullptr, {/* .includeTransform = */ true}); @@ -616,7 +616,7 @@ jsi::Value UIManagerBinding::get( jsi::Runtime &runtime, jsi::Value const & /*thisValue*/, jsi::Value const *arguments, - size_t /*count*/) noexcept -> jsi::Value { + size_t /*count*/) { auto layoutMetrics = uiManager->getRelativeLayoutMetrics( *shadowNodeFromValue(runtime, arguments[0]), nullptr, From 70f3a264e2f34fa3a091afb7505b718ee5251ff7 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Wed, 31 May 2023 15:20:57 -0700 Subject: [PATCH 19/33] Remove unnecessary dependency on aapt2-linux (#37643) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37643 We needed this change for offline mirrors which we don't use anymore, so we can remove this extra dependency (it will make the build a little faster also which is never bad). Changelog: [Internal] [Changed] - Remove unnecessary dependency on aapt2-linux Reviewed By: mdvacca Differential Revision: D46318725 fbshipit-source-id: a86b43fff6a11844acff88791af0578d79d7fdbf --- packages/react-native/ReactAndroid/build.gradle | 6 ------ 1 file changed, 6 deletions(-) diff --git a/packages/react-native/ReactAndroid/build.gradle b/packages/react-native/ReactAndroid/build.gradle index d65e409316adf2..25ba3cbcda958c 100644 --- a/packages/react-native/ReactAndroid/build.gradle +++ b/packages/react-native/ReactAndroid/build.gradle @@ -711,12 +711,6 @@ dependencies { androidTestImplementation("androidx.test:runner:${ANDROIDX_TEST_VERSION}") androidTestImplementation("androidx.test:rules:${ANDROIDX_TEST_VERSION}") androidTestImplementation("org.mockito:mockito-core:${MOCKITO_CORE_VERSION}") - - // This compileOnly dependency is needed to be able to update the offline - // mirror from a non-linux machine, while still executing inside a Linux CI - // as we declare a dependency on aap2 @linux so we're sure the linux artifact - // gets downloaded at some point. - compileOnly("com.android.tools.build:aapt2:7.4.2-8841542:linux") } react { From e2d512a1eef9950d3475c95dee8d2474a5723d74 Mon Sep 17 00:00:00 2001 From: Ramanpreet Nara Date: Wed, 31 May 2023 16:13:05 -0700 Subject: [PATCH 20/33] Delete bridge.loadAndExecuteSplitBundleURL Summary: Changelog: [iOS][Removed] - Delete bridge.loadAndExecuteSplitBundleURL Reviewed By: cortinico Differential Revision: D46166549 fbshipit-source-id: a0854e4abcdd11542629f5f6bbce89c45e30e9cd --- packages/react-native/React/Base/RCTBridge.h | 7 ---- packages/react-native/React/Base/RCTBridge.m | 7 ---- .../React/CxxBridge/RCTCxxBridge.mm | 36 ------------------- 3 files changed, 50 deletions(-) diff --git a/packages/react-native/React/Base/RCTBridge.h b/packages/react-native/React/Base/RCTBridge.h index 2a55a8a730d33f..d863f17a7466a7 100644 --- a/packages/react-native/React/Base/RCTBridge.h +++ b/packages/react-native/React/Base/RCTBridge.h @@ -227,11 +227,4 @@ RCT_EXTERN void RCTSetTurboModuleCleanupMode(RCTTurboModuleCleanupMode mode); */ - (BOOL)isBatchActive; -/** - * Loads and executes additional bundles in the VM for development. - */ -- (void)loadAndExecuteSplitBundleURL:(NSURL *)bundleURL - onError:(RCTLoadAndExecuteErrorBlock)onError - onComplete:(dispatch_block_t)onComplete; - @end diff --git a/packages/react-native/React/Base/RCTBridge.m b/packages/react-native/React/Base/RCTBridge.m index b7eb3d7129031d..e9a521ccce0141 100644 --- a/packages/react-native/React/Base/RCTBridge.m +++ b/packages/react-native/React/Base/RCTBridge.m @@ -420,11 +420,4 @@ - (void)registerSegmentWithId:(NSUInteger)segmentId path:(NSString *)path [self.batchedBridge registerSegmentWithId:segmentId path:path]; } -- (void)loadAndExecuteSplitBundleURL:(NSURL *)bundleURL - onError:(RCTLoadAndExecuteErrorBlock)onError - onComplete:(dispatch_block_t)onComplete -{ - [self.batchedBridge loadAndExecuteSplitBundleURL:bundleURL onError:onError onComplete:onComplete]; -} - @end diff --git a/packages/react-native/React/CxxBridge/RCTCxxBridge.mm b/packages/react-native/React/CxxBridge/RCTCxxBridge.mm index 2d11205b006d36..a23413895768c1 100644 --- a/packages/react-native/React/CxxBridge/RCTCxxBridge.mm +++ b/packages/react-native/React/CxxBridge/RCTCxxBridge.mm @@ -1089,42 +1089,6 @@ - (void)executeSourceCode:(NSData *)sourceCode withSourceURL:(NSURL *)url sync:( [self.devSettings setupHMRClientWithBundleURL:self.bundleURL]; } -#if RCT_DEV_MENU | RCT_PACKAGER_LOADING_FUNCTIONALITY -- (void)loadAndExecuteSplitBundleURL:(NSURL *)bundleURL - onError:(RCTLoadAndExecuteErrorBlock)onError - onComplete:(dispatch_block_t)onComplete -{ - __weak __typeof(self) weakSelf = self; - [RCTJavaScriptLoader loadBundleAtURL:bundleURL - onProgress:^(RCTLoadingProgress *progressData) { -#if (RCT_DEV_MENU | RCT_DEV_MENU) && __has_include() - id loadingView = [weakSelf moduleForName:@"DevLoadingView" - lazilyLoadIfNecessary:YES]; - [loadingView updateProgress:progressData]; -#endif - } - onComplete:^(NSError *error, RCTSource *source) { - if (error) { - onError(error); - return; - } - - [self enqueueApplicationScript:source.data - url:source.url - onComplete:^{ - [self.devSettings setupHMRClientWithAdditionalBundleURL:source.url]; - onComplete(); - }]; - }]; -} -#else -- (void)loadAndExecuteSplitBundleURL:(NSURL *)bundleURL - onError:(RCTLoadAndExecuteErrorBlock)onError - onComplete:(dispatch_block_t)onComplete -{ -} -#endif - - (void)handleError:(NSError *)error { // This is generally called when the infrastructure throws an From 197ed4369782365e57b7035987ed1a94d501e1f5 Mon Sep 17 00:00:00 2001 From: Ramanpreet Nara Date: Wed, 31 May 2023 16:13:05 -0700 Subject: [PATCH 21/33] Export moduleIsInitialized from RCTModuleRegistry Summary: ## Context Product code can query the Bridge, or the TurboModuleManager, to see whether a native module has been initialized or not. But, this API doesn't exist in RCTModuleRegistry. ## Changes This diff exports moduleIsInitialized: from RCTModuleRegistry. That way, RCTBridgeProxy (introduce in D46088752) can more easily implement the moduleIsInitialized: API. Changelog: [iOS][Added] - Introduce RCTModuleRegistry moduleIsInitialized: Reviewed By: cortinico Differential Revision: D46166548 fbshipit-source-id: c9954273e511083276aeb911dd58719cf4a11f10 --- .../react-native/React/Base/RCTBridgeModule.h | 1 + .../react-native/React/Base/RCTModuleRegistry.m | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/packages/react-native/React/Base/RCTBridgeModule.h b/packages/react-native/React/Base/RCTBridgeModule.h index cc429c410f58ab..7e7cf91cd6cfa6 100644 --- a/packages/react-native/React/Base/RCTBridgeModule.h +++ b/packages/react-native/React/Base/RCTBridgeModule.h @@ -390,6 +390,7 @@ RCT_EXTERN_C_END - (id)moduleForName:(const char *)moduleName; - (id)moduleForName:(const char *)moduleName lazilyLoadIfNecessary:(BOOL)lazilyLoad; +- (BOOL)moduleIsInitialized:(Class)moduleClass; @end typedef UIView * (^RCTBridgelessComponentViewProvider)(NSNumber *); diff --git a/packages/react-native/React/Base/RCTModuleRegistry.m b/packages/react-native/React/Base/RCTModuleRegistry.m index 98dd082fe8ee90..4b2c15e0a5d401 100644 --- a/packages/react-native/React/Base/RCTModuleRegistry.m +++ b/packages/react-native/React/Base/RCTModuleRegistry.m @@ -47,4 +47,21 @@ - (id)moduleForName:(const char *)moduleName lazilyLoadIfNecessary:(BOOL)lazilyL return module; } +- (BOOL)moduleIsInitialized:(Class)moduleClass +{ + RCTBridge *bridge = _bridge; + + if (bridge) { + return [bridge moduleIsInitialized:moduleClass]; + } + + id turboModuleRegistry = _turboModuleRegistry; + if (turboModuleRegistry) { + NSString *moduleName = RCTBridgeModuleNameForClass(moduleClass); + return [turboModuleRegistry moduleIsInitialized:[moduleName UTF8String]]; + } + + return NO; +} + @end From 462c648b58a536cc9437d49b1f644e34d95230a1 Mon Sep 17 00:00:00 2001 From: Ramanpreet Nara Date: Wed, 31 May 2023 16:13:05 -0700 Subject: [PATCH 22/33] Interop: Create gating for the Bridge proxy Summary: The TurboModule interop layer on iOS will ship with a Bridge proxy. The Bridge proxy is an object (see D46084318) that will try to simulate the Bridge's APIs, whenever possible, by delegating to Bridgeless abstractions. ## Changes **Fact:** All FBiOS modules work with/without the bridge. So, let's break down the Interop layer test group (i.e: interop on) into two groups: - interop on, bridge proxy off - interop on, bridge proxy on ## Benefits This will speed up the production test, by allowing us to: 1. Isolate Interop issues to the bridge proxy faster. 2. Stabilize the TurboModule interop layer faster. NOTE: This flag is temporary, and should be removed long-term: The TurboModule interop layer should ship with the bridge proxy enabled by default. Changelog: [Internal] Reviewed By: philIip Differential Revision: D46088752 fbshipit-source-id: 1e161d49382635a44194166645c1a5d56d37b4de --- packages/react-native/React/Base/RCTBridge.h | 4 ++++ packages/react-native/React/Base/RCTBridge.m | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/packages/react-native/React/Base/RCTBridge.h b/packages/react-native/React/Base/RCTBridge.h index d863f17a7466a7..92545c4317ebe5 100644 --- a/packages/react-native/React/Base/RCTBridge.h +++ b/packages/react-native/React/Base/RCTBridge.h @@ -60,6 +60,10 @@ RCT_EXTERN void RCTDisableTurboModuleManagerDelegateLocking(BOOL enabled); RCT_EXTERN BOOL RCTTurboModuleInteropEnabled(void); RCT_EXTERN void RCTEnableTurboModuleInterop(BOOL enabled); +// Turn on TurboModule interop's Bridge proxy +RCT_EXTERN BOOL RCTTurboModuleInteropBridgeProxyEnabled(void); +RCT_EXTERN void RCTEnableTurboModuleInteropBridgeProxy(BOOL enabled); + // Route all TurboModules through TurboModule interop RCT_EXTERN BOOL RCTTurboModuleInteropForAllTurboModulesEnabled(void); RCT_EXTERN void RCTEnableTurboModuleInteropForAllTurboModules(BOOL enabled); diff --git a/packages/react-native/React/Base/RCTBridge.m b/packages/react-native/React/Base/RCTBridge.m index e9a521ccce0141..b8300f27f073b8 100644 --- a/packages/react-native/React/Base/RCTBridge.m +++ b/packages/react-native/React/Base/RCTBridge.m @@ -130,6 +130,17 @@ void RCTEnableTurboModuleInterop(BOOL enabled) turboModuleInteropEnabled = enabled; } +static BOOL turboModuleInteropBridgeProxyEnabled = NO; +BOOL RCTTurboModuleInteropBridgeProxyEnabled(void) +{ + return turboModuleInteropBridgeProxyEnabled; +} + +void RCTEnableTurboModuleInteropBridgeProxy(BOOL enabled) +{ + turboModuleInteropBridgeProxyEnabled = enabled; +} + static BOOL useTurboModuleInteropForAllTurboModules = NO; BOOL RCTTurboModuleInteropForAllTurboModulesEnabled(void) { From ddb8aeadbb0a5f6856abd9c04eb730fb2bb13332 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Wed, 31 May 2023 23:23:17 -0700 Subject: [PATCH 23/33] Enable mock-maker-inline for Android JVM tests (#37646) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37646 I'm re-enabling a test that got disabled due to us not using mock-maker-inline in OSS. I'm also adding `mock-maker-inline` for OSS so it will be easier to convert tests to Kotlin as classes in Kotlin are final by default. Changelog: [Internal] [Changed] - Enable mock-maker-inline for Android JVM tests Reviewed By: NickGerleman Differential Revision: D46222913 fbshipit-source-id: b7da0616994888c2800c193a1bb8e233d2c18288 --- .../com/facebook/react/bridgeless/ReactHostDelegateTest.kt | 2 -- .../react/modules/deviceinfo/DeviceInfoModuleTest.java | 3 ++- .../resources/mockito-extensions/org.mockito.plugins.MockMaker | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 packages/react-native/ReactAndroid/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridgeless/ReactHostDelegateTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridgeless/ReactHostDelegateTest.kt index a65823b4165f60..4bc2ed9c6b2b5e 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridgeless/ReactHostDelegateTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridgeless/ReactHostDelegateTest.kt @@ -14,7 +14,6 @@ import com.facebook.react.defaults.DefaultReactHostDelegate import com.facebook.react.turbomodule.core.TurboModuleManagerDelegate import com.facebook.testutils.shadows.ShadowSoLoader import org.assertj.core.api.Assertions.assertThat -import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mockito @@ -31,7 +30,6 @@ class ReactHostDelegateTest { * API */ @Test - @Ignore fun testDefaultReactHostDelegateCreation() { val jsBundleLoader: JSBundleLoader = Mockito.mock(JSBundleLoader::class.java) val turboModuleManagerDelegateMock: TurboModuleManagerDelegate = diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/deviceinfo/DeviceInfoModuleTest.java b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/deviceinfo/DeviceInfoModuleTest.java index d80a81872038b3..62890cbfe8d64e 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/deviceinfo/DeviceInfoModuleTest.java +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/modules/deviceinfo/DeviceInfoModuleTest.java @@ -126,7 +126,8 @@ public void test_itEmitsMultipleEvents_whenDisplayMetricsChangedBetweenUpdates() } private static void givenDisplayMetricsHolderContains(final WritableMap fakeDisplayMetrics) { - when(DisplayMetricsHolder.getDisplayMetricsWritableMap(1.0)).thenReturn(fakeDisplayMetrics); + when(DisplayMetricsHolder.getDisplayMetricsWritableMap(1.0)) + .thenAnswer(invocation -> fakeDisplayMetrics); } private static void verifyUpdateDimensionsEventsEmitted( diff --git a/packages/react-native/ReactAndroid/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/packages/react-native/ReactAndroid/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 00000000000000..1f0955d450f0dc --- /dev/null +++ b/packages/react-native/ReactAndroid/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline From daf6e53ae17a5d3724be9e223d7d8af7c6ced18c Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Thu, 1 Jun 2023 00:19:14 -0700 Subject: [PATCH 24/33] Upgrade to Flow v0.207.0 (#37601) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37601 Changelog: [Internal] Reviewed By: pieterv Differential Revision: D46225499 fbshipit-source-id: d7d444d5bd53fd4ddb97f884fa121548a7a923e1 --- .flowconfig | 2 +- .flowconfig.android | 2 +- package.json | 2 +- yarn.lock | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.flowconfig b/.flowconfig index 33da5ca8a7f069..c09b7d604226c4 100644 --- a/.flowconfig +++ b/.flowconfig @@ -75,4 +75,4 @@ untyped-import untyped-type-import [version] -^0.206.0 +^0.207.0 diff --git a/.flowconfig.android b/.flowconfig.android index 618bb734f08468..e9103ee5a650d2 100644 --- a/.flowconfig.android +++ b/.flowconfig.android @@ -75,4 +75,4 @@ untyped-import untyped-type-import [version] -^0.206.0 +^0.207.0 diff --git a/package.json b/package.json index 27e5216b7e6bb8..6bfad30679abb3 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "eslint-plugin-react-native": "^4.0.0", "eslint-plugin-redundant-undefined": "^0.4.0", "eslint-plugin-relay": "^1.8.3", - "flow-bin": "^0.206.0", + "flow-bin": "^0.207.0", "hermes-eslint": "0.8.0", "inquirer": "^7.1.0", "jest": "^29.2.1", diff --git a/yarn.lock b/yarn.lock index 8b76bfad3e0ea3..45cbbc30af4916 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5601,10 +5601,10 @@ flatted@^3.1.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.2.tgz#64bfed5cb68fe3ca78b3eb214ad97b63bedce561" integrity sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA== -flow-bin@^0.206.0: - version "0.206.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.206.0.tgz#a593304be5440a965ae773efcef55071b6d33178" - integrity sha512-cZTEs/OEWcbxfvb8BP+Fw0Cep5wrEyEzQHGpXyjVpQXrAraRA5wZUXvTf1C5YHufQaAYY9YkKY5WAr461JvmOA== +flow-bin@^0.207.0: + version "0.207.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.207.0.tgz#71c6a21214c57f3e36e03b32033dd0358452499b" + integrity sha512-jAet+lhdrvpk4kjonZ6r/v09rkyaPQX+E5gio+HesEBvsOsCWfnuadBRQZihTM4+szjJPWEkITfrCurI/aCqEQ== flow-enums-runtime@^0.0.6: version "0.0.6" From b66ab2c15498d1e236220cb6c94a5f3e807621dd Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Thu, 1 Jun 2023 03:24:45 -0700 Subject: [PATCH 25/33] Configure JDK Toolchain to 11 for all the 3rd party libraries. (#37575) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37575 This fixes the behavior reported in https://github.com/reactwg/react-native-releases/discussions/54#discussioncomment-5984629 by forcing all the libraries to compile with JDK 11. This prevents build issues when on Gradle 8 and Kotlin 1.8 Changelog: [Internal] [Changed] - Configure JDK Toolchain to 11 for all the 3rd party libraries Reviewed By: cipolleschi Differential Revision: D46190989 fbshipit-source-id: c88974d24efc2c35b01f28d41af0d0515d63d765 --- .../kotlin/com/facebook/react/ReactPlugin.kt | 4 ++- .../react/utils/JdkConfiguratorUtils.kt | 36 +++++++++++++------ .../com/facebook/react/utils/PropertyUtils.kt | 18 ++++++++++ 3 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PropertyUtils.kt diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt index 8663111ce17768..709f1097142425 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt @@ -66,7 +66,6 @@ class ReactPlugin : Plugin { configureBuildConfigFields(project) configureDevPorts(project) configureBackwardCompatibilityReactMap(project) - configureJavaToolChains(project) project.extensions.getByType(AndroidComponentsExtension::class.java).apply { onVariants(selector().all()) { variant -> @@ -80,6 +79,9 @@ class ReactPlugin : Plugin { project.pluginManager.withPlugin("com.android.library") { configureCodegen(project, extension, rootExtension, isLibrary = true) } + + // Library and App Configurations + configureJavaToolChains(project) } private fun checkJvmVersion(project: Project) { diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/JdkConfiguratorUtils.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/JdkConfiguratorUtils.kt index c86484ab5249c5..b54ea52404f226 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/JdkConfiguratorUtils.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/JdkConfiguratorUtils.kt @@ -8,26 +8,40 @@ package com.facebook.react.utils import com.android.build.api.variant.AndroidComponentsExtension +import com.facebook.react.utils.PropertyUtils.INTERNAL_DISABLE_JAVA_VERSION_ALIGNMENT +import org.gradle.api.Action import org.gradle.api.JavaVersion import org.gradle.api.Project +import org.gradle.api.plugins.AppliedPlugin import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension internal object JdkConfiguratorUtils { /** - * Function that takes care of configuring the JDK toolchain for Application projects. As we do - * decide the JDK version based on the AGP version that RNGP brings over, here we can safely + * Function that takes care of configuring the JDK toolchain for all the projects projects. As we + * do decide the JDK version based on the AGP version that RNGP brings over, here we can safely * configure the toolchain to 11. */ - fun configureJavaToolChains(project: Project) { - project.extensions.getByType(AndroidComponentsExtension::class.java).finalizeDsl { ext -> - ext.compileOptions.sourceCompatibility = JavaVersion.VERSION_11 - ext.compileOptions.targetCompatibility = JavaVersion.VERSION_11 + fun configureJavaToolChains(input: Project) { + if (input.hasProperty(INTERNAL_DISABLE_JAVA_VERSION_ALIGNMENT)) { + return } - project.pluginManager.withPlugin("org.jetbrains.kotlin.android") { - project.extensions.getByType(KotlinTopLevelExtension::class.java).jvmToolchain(11) - } - project.pluginManager.withPlugin("org.jetbrains.kotlin.jvm") { - project.extensions.getByType(KotlinTopLevelExtension::class.java).jvmToolchain(11) + input.rootProject.allprojects { project -> + val action = + Action { + project.extensions.getByType(AndroidComponentsExtension::class.java).finalizeDsl { ext + -> + ext.compileOptions.sourceCompatibility = JavaVersion.VERSION_11 + ext.compileOptions.targetCompatibility = JavaVersion.VERSION_11 + } + } + project.pluginManager.withPlugin("com.android.application", action) + project.pluginManager.withPlugin("com.android.library", action) + project.pluginManager.withPlugin("org.jetbrains.kotlin.android") { + project.extensions.getByType(KotlinTopLevelExtension::class.java).jvmToolchain(11) + } + project.pluginManager.withPlugin("org.jetbrains.kotlin.jvm") { + project.extensions.getByType(KotlinTopLevelExtension::class.java).jvmToolchain(11) + } } } } diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PropertyUtils.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PropertyUtils.kt new file mode 100644 index 00000000000000..3f9b5663d51ddc --- /dev/null +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PropertyUtils.kt @@ -0,0 +1,18 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.utils + +/** Collection of all the Gradle Propreties that are accepted by React Native Gradle Plugin. */ +object PropertyUtils { + + /** + * Internal Property that acts as a killswitch to configure the JDK version and align it for app + * and all the libraries. + */ + const val INTERNAL_DISABLE_JAVA_VERSION_ALIGNMENT = "react.internal.disableJavaVersionAlignment" +} From b50874cad41f06519a263fa53d15f76c836fd167 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Thu, 1 Jun 2023 04:53:03 -0700 Subject: [PATCH 26/33] Remove missing dependencies from React-Fabric (#37652) Summary: When reverting the runtimescheduler fix, we forgot to remove some lines from the React-Fabric dependencies. This broke pod install and we have a red ci since then. bypass-github-export-checks ## Changelog: [iOS][Fixed] - fix React-Fabric dependencies Pull Request resolved: https://github.com/facebook/react-native/pull/37652 Test Plan: CircleCI is green Reviewed By: cipolleschi Differential Revision: D46349504 Pulled By: sammy-SC fbshipit-source-id: 8fc1bca7838a913adba702033d06dd02b93c31f9 --- .../Libraries/AppDelegate/RCTAppDelegate.mm | 8 +- .../ReactCommon/React-Fabric.podspec | 6 +- packages/rn-tester/RNTester/AppDelegate.mm | 112 ------------------ 3 files changed, 4 insertions(+), 122 deletions(-) diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm index a6fcb5094765fa..808c315c2f1bf4 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm @@ -134,10 +134,10 @@ - (BOOL)runtimeSchedulerEnabled return YES; } +#if RCT_NEW_ARCH_ENABLED #pragma mark - RCTCxxBridgeDelegate - (std::unique_ptr)jsExecutorFactoryForBridge:(RCTBridge *)bridge { -#if RCT_NEW_ARCH_ENABLED _runtimeScheduler = std::make_shared(RCTRuntimeExecutorFromBridge(bridge)); std::shared_ptr callInvoker = std::make_shared(_runtimeScheduler); @@ -147,12 +147,6 @@ - (BOOL)runtimeSchedulerEnabled _contextContainer->erase("RuntimeScheduler"); _contextContainer->insert("RuntimeScheduler", _runtimeScheduler); return RCTAppSetupDefaultJsExecutorFactory(bridge, turboModuleManager, _runtimeScheduler); -#else - if (self.runtimeSchedulerEnabled) { - _runtimeScheduler = std::make_shared(RCTRuntimeExecutorFromBridge(bridge)); - } - return RCTAppSetupJsExecutorFactoryForOldArch(bridge, _runtimeScheduler); -#endif } #pragma mark - RCTTurboModuleManagerDelegate diff --git a/packages/react-native/ReactCommon/React-Fabric.podspec b/packages/react-native/ReactCommon/React-Fabric.podspec index 9ad649073b39ff..50c8a74168512c 100644 --- a/packages/react-native/ReactCommon/React-Fabric.podspec +++ b/packages/react-native/ReactCommon/React-Fabric.podspec @@ -51,9 +51,9 @@ Pod::Spec.new do |s| s.dependency "glog" s.dependency "DoubleConversion" s.dependency "React-Core" - s.dependency "React-debug" - s.dependency "React-utils" - s.dependency "React-runtimescheduler" + # s.dependency "React-debug" + # s.dependency "React-utils" + # s.dependency "React-runtimescheduler" s.dependency "React-cxxreact" if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1" diff --git a/packages/rn-tester/RNTester/AppDelegate.mm b/packages/rn-tester/RNTester/AppDelegate.mm index d9a5e3ff6cb50b..f4e8d4006c5416 100644 --- a/packages/rn-tester/RNTester/AppDelegate.mm +++ b/packages/rn-tester/RNTester/AppDelegate.mm @@ -9,69 +9,18 @@ #import #import -#import -#import -#import #import #import -#import - #if !TARGET_OS_TV && !TARGET_OS_UIKITFORMAC #import #endif -#ifdef RN_FABRIC_ENABLED -#import -#import -#import -#import - -#import -#import -#import -#import -#import -#endif - #if RCT_NEW_ARCH_ENABLED #import #import #endif -#if DEBUG -#ifdef FB_SONARKIT_ENABLED -#import -#import -#import -#import -#import -#import -#import -#endif -#endif - -#import -#import "RNTesterTurboModuleProvider.h" - -@interface AppDelegate () { -#ifdef RN_FABRIC_ENABLED - RCTSurfacePresenterBridgeAdapter *_bridgeAdapter; - std::shared_ptr _reactNativeConfig; - facebook::react::ContextContainer::Shared _contextContainer; - std::shared_ptr _runtimeScheduler; -#endif -} -@end - -#if RCT_NEW_ARCH_ENABLED -/// Declare conformance to `RCTComponentViewFactoryComponentProvider` -@interface AppDelegate () -@end -#endif - -static NSString *const kRNConcurrentRoot = @"concurrentRoot"; - @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions @@ -115,67 +64,6 @@ - (void)loadSourceForBridge:(RCTBridge *)bridge [RCTJavaScriptLoader loadBundleAtURL:[self sourceURLForBridge:bridge] onProgress:onProgress onComplete:loadCallback]; } -#pragma mark - RCTCxxBridgeDelegate - -// This function is called during -// `[[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];` -- (std::unique_ptr)jsExecutorFactoryForBridge:(RCTBridge *)bridge -{ - std::shared_ptr callInvoker = bridge.jsCallInvoker; - -#ifdef RN_FABRIC_ENABLED - _runtimeScheduler = std::make_shared(RCTRuntimeExecutorFromBridge(bridge)); - _contextContainer->erase("RuntimeScheduler"); - _contextContainer->insert("RuntimeScheduler", _runtimeScheduler); - callInvoker = std::make_shared(_runtimeScheduler); -#endif - - RCTTurboModuleManager *turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge - delegate:self - jsInvoker:callInvoker]; - [bridge setRCTTurboModuleRegistry:turboModuleManager]; - -#if RCT_DEV - /** - * Eagerly initialize RCTDevMenu so CMD + d, CMD + i, and CMD + r work. - * This is a stop gap until we have a system to eagerly init Turbo Modules. - */ - [turboModuleManager moduleForName:"RCTDevMenu"]; -#endif - - __weak __typeof(self) weakSelf = self; - -#if RCT_USE_HERMES - return std::make_unique( -#else - return std::make_unique( -#endif - facebook::react::RCTJSIExecutorRuntimeInstaller([weakSelf, bridge, turboModuleManager]( - facebook::jsi::Runtime &runtime) { - if (!bridge) { - return; - } - -#if RN_FABRIC_ENABLED - __typeof(self) strongSelf = weakSelf; - if (strongSelf && strongSelf->_runtimeScheduler) { - facebook::react::RuntimeSchedulerBinding::createAndInstallIfNeeded(runtime, strongSelf->_runtimeScheduler); - } -#endif - - facebook::react::RuntimeExecutor syncRuntimeExecutor = - [&](std::function &&callback) { callback(runtime); }; - [turboModuleManager installJSBindingWithRuntimeExecutor:syncRuntimeExecutor]; - })); -} - -#pragma mark - RCTTurboModuleManagerDelegate - -- (Class)getModuleClassFromName:(const char *)name -{ - return facebook::react::RNTesterTurboModuleClassProvider(name); -} - - (std::shared_ptr)getTurboModule:(const std::string &)name jsInvoker:(std::shared_ptr)jsInvoker { From dc54334c59e8bcbee531ee032b540fe75a8392c3 Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Thu, 1 Jun 2023 11:45:57 -0700 Subject: [PATCH 27/33] Create separate pod for React-debug (#37657) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37657 changelog: [internal] Make React-debug into its own pod to align BUCK and cocoapods. This is needed to reland RuntimeScheduler in the old architecture on iOS. Reviewed By: rickhanlonii Differential Revision: D46357876 fbshipit-source-id: 035aaaee8b4b106f873b4b30c8cb424867be066a --- .../AppDelegate/React-RCTAppDelegate.podspec | 2 + .../React/React-RCTFabric.podspec | 2 + .../ReactCommon/React-Fabric.podspec | 10 +- .../ReactCommon/ReactCommon.podspec | 4 - .../react/debug/React-debug.podspec | 36 ++ .../platform/ios/React-ImageManager.podspec | 2 + .../cocoapods/__tests__/codegen_utils-test.rb | 4 +- .../__tests__/new_architecture-test.rb | 5 +- .../scripts/cocoapods/codegen_utils.rb | 2 + .../scripts/cocoapods/new_architecture.rb | 2 + .../react-native/scripts/react_native_pods.rb | 1 + packages/rn-tester/Podfile.lock | 387 ++++++++++++++---- 12 files changed, 368 insertions(+), 89 deletions(-) create mode 100644 packages/react-native/ReactCommon/react/debug/React-debug.podspec diff --git a/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec b/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec index a98f3aea404347..3cb77a170bb6af 100644 --- a/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec +++ b/packages/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec @@ -48,6 +48,7 @@ header_search_paths = [ "$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core", "$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers", "$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers/", + "$(PODS_CONFIGURATION_BUILD_DIR)/React-debug/React_debug.framework/Headers/", ] : []).map{|p| "\"#{p}\""}.join(" ") Pod::Spec.new do |s| @@ -91,6 +92,7 @@ Pod::Spec.new do |s| s.dependency "React-Fabric" s.dependency "React-RCTFabric" s.dependency "React-graphics" + s.dependency "React-debug" s.script_phases = { :name => "Generate Legacy Components Interop", diff --git a/packages/react-native/React/React-RCTFabric.podspec b/packages/react-native/React/React-RCTFabric.podspec index 0c399c1797afd3..543f01691cb084 100644 --- a/packages/react-native/React/React-RCTFabric.podspec +++ b/packages/react-native/React/React-RCTFabric.podspec @@ -43,6 +43,7 @@ if ENV['USE_FRAMEWORKS'] header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\"" header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-ImageManager/React_ImageManager.framework/Headers\"" header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\"" + header_search_paths << "\"$(PODS_CONFIGURATION_BUILD_DIR)/React-debug/React_debug.framework/Headers\"" end Pod::Spec.new do |s| @@ -79,6 +80,7 @@ Pod::Spec.new do |s| s.dependency "Yoga" s.dependency "React-RCTText" s.dependency "React-FabricImage" + s.dependency "React-debug" if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1" s.dependency "hermes-engine" diff --git a/packages/react-native/ReactCommon/React-Fabric.podspec b/packages/react-native/ReactCommon/React-Fabric.podspec index 50c8a74168512c..96cef2b9e79049 100644 --- a/packages/react-native/ReactCommon/React-Fabric.podspec +++ b/packages/react-native/ReactCommon/React-Fabric.podspec @@ -51,7 +51,7 @@ Pod::Spec.new do |s| s.dependency "glog" s.dependency "DoubleConversion" s.dependency "React-Core" - # s.dependency "React-debug" + s.dependency "React-debug" # s.dependency "React-utils" # s.dependency "React-runtimescheduler" s.dependency "React-cxxreact" @@ -232,14 +232,6 @@ Pod::Spec.new do |s| end end - s.subspec "debug_core" do |ss| - ss.dependency folly_dep_name, folly_version - ss.compiler_flags = folly_compiler_flags - ss.source_files = "react/debug/**/*.{m,mm,cpp,h}" - ss.exclude_files = "react/debug/tests" - ss.header_dir = "react/debug" - end - s.subspec "debug_renderer" do |ss| ss.dependency folly_dep_name, folly_version ss.compiler_flags = folly_compiler_flags diff --git a/packages/react-native/ReactCommon/ReactCommon.podspec b/packages/react-native/ReactCommon/ReactCommon.podspec index 9ca2ec4b996d5c..448907b3b8f26e 100644 --- a/packages/react-native/ReactCommon/ReactCommon.podspec +++ b/packages/react-native/ReactCommon/ReactCommon.podspec @@ -70,8 +70,4 @@ Pod::Spec.new do |s| sss.source_files = "react/nativemodule/core/ReactCommon/**/*.{cpp,h}" end end - - s.subspec "react_debug_core" do |sss| - sss.source_files = "react/debug/*.{cpp,h}" - end end diff --git a/packages/react-native/ReactCommon/react/debug/React-debug.podspec b/packages/react-native/ReactCommon/react/debug/React-debug.podspec new file mode 100644 index 00000000000000..dab4a31652edfa --- /dev/null +++ b/packages/react-native/ReactCommon/react/debug/React-debug.podspec @@ -0,0 +1,36 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +require "json" + +package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "package.json"))) +version = package['version'] + +source = { :git => 'https://github.com/facebook/react-native.git' } +if version == '1000.0.0' + # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. + source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1") +else + source[:tag] = "v#{version}" +end + +Pod::Spec.new do |s| + s.name = "React-debug" + s.version = version + s.summary = "-" # TODO + s.homepage = "https://reactnative.dev/" + s.license = package["license"] + s.author = "Meta Platforms, Inc. and its affiliates" + s.platforms = { :ios => min_ios_version_supported } + s.source = source + s.source_files = "**/*.{cpp,h}" + s.header_dir = "react/debug" + s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" } + + if ENV['USE_FRAMEWORKS'] + s.module_name = "React_debug" + s.header_mappings_dir = "../.." + end +end diff --git a/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec b/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec index 0ef251588cc351..a5f2bd21334955 100644 --- a/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec +++ b/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec @@ -48,6 +48,7 @@ Pod::Spec.new do |s| "\"$(PODS_ROOT)/DoubleConversion\"", "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\"", "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\"", + "\"$(PODS_CONFIGURATION_BUILD_DIR)/React-debug/React_debug.framework/Headers\"" ] end @@ -61,5 +62,6 @@ Pod::Spec.new do |s| s.dependency "React-Fabric" s.dependency "React-Core/Default" s.dependency "React-RCTImage" + s.dependency "React-debug" s.dependency "glog" end diff --git a/packages/react-native/scripts/cocoapods/__tests__/codegen_utils-test.rb b/packages/react-native/scripts/cocoapods/__tests__/codegen_utils-test.rb index da138e23b86950..b738548d5cf945 100644 --- a/packages/react-native/scripts/cocoapods/__tests__/codegen_utils-test.rb +++ b/packages/react-native/scripts/cocoapods/__tests__/codegen_utils-test.rb @@ -577,6 +577,7 @@ def get_podspec_fabric_and_script_phases(script_phases) 'React-graphics': [], 'React-rncore': [], 'React-Fabric': [], + 'React-debug': [], }) @@ -589,11 +590,12 @@ def get_podspec_when_use_frameworks specs = get_podspec_no_fabric_no_script() specs["pod_target_xcconfig"]["FRAMEWORK_SEARCH_PATHS"].concat([]) - specs["pod_target_xcconfig"]["HEADER_SEARCH_PATHS"].concat(" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-Fabric/React_Fabric.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-FabricImage/React_FabricImage.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-graphics/React_graphics.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers\"") + specs["pod_target_xcconfig"]["HEADER_SEARCH_PATHS"].concat(" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-Fabric/React_Fabric.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-FabricImage/React_FabricImage.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-graphics/React_graphics.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-debug/React_debug.framework/Headers\"") specs[:dependencies].merge!({ 'React-graphics': [], 'React-Fabric': [], + 'React-debug': [], }) return specs diff --git a/packages/react-native/scripts/cocoapods/__tests__/new_architecture-test.rb b/packages/react-native/scripts/cocoapods/__tests__/new_architecture-test.rb index c97349ed15df31..702d02982c2c4b 100644 --- a/packages/react-native/scripts/cocoapods/__tests__/new_architecture-test.rb +++ b/packages/react-native/scripts/cocoapods/__tests__/new_architecture-test.rb @@ -129,7 +129,7 @@ def test_installModulesDependencies_whenNewArchEnabledAndNewArchAndNoSearchPaths # Assert assert_equal(spec.compiler_flags, NewArchitectureHelper.folly_compiler_flags) - assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\"") + assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\"") assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++17") assert_equal(spec.pod_target_xcconfig["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DRCT_NEW_ARCH_ENABLED=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1") assert_equal( @@ -148,6 +148,7 @@ def test_installModulesDependencies_whenNewArchEnabledAndNewArchAndNoSearchPaths { :dependency_name => "Yoga" }, { :dependency_name => "React-Fabric" }, { :dependency_name => "React-graphics" }, + { :dependency_name => "React-debug" }, { :dependency_name => "hermes-engine" } ]) end @@ -166,7 +167,7 @@ def test_installModulesDependencies_whenNewArchDisabledAndSearchPathsAndCompiler # Assert assert_equal(spec.compiler_flags, "-Wno-nullability-completeness #{NewArchitectureHelper.folly_compiler_flags}") - assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "#{other_flags} \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\"") + assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "#{other_flags} \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\"") assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++17") assert_equal( spec.dependencies, diff --git a/packages/react-native/scripts/cocoapods/codegen_utils.rb b/packages/react-native/scripts/cocoapods/codegen_utils.rb index c980f05762de45..97715206cf5e17 100644 --- a/packages/react-native/scripts/cocoapods/codegen_utils.rb +++ b/packages/react-native/scripts/cocoapods/codegen_utils.rb @@ -100,6 +100,7 @@ def get_react_codegen_spec(package_json_file, folly_version: '2021.07.22.00', fa "\"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\"", "\"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\"", "\"$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers\"", + "\"$(PODS_CONFIGURATION_BUILD_DIR)/React-debug/React_debug.framework/Headers\"", ]) end @@ -140,6 +141,7 @@ def get_react_codegen_spec(package_json_file, folly_version: '2021.07.22.00', fa spec[:'dependencies'].merge!({ 'React-graphics': [], 'React-Fabric': [], + 'React-debug': [], }); end diff --git a/packages/react-native/scripts/cocoapods/new_architecture.rb b/packages/react-native/scripts/cocoapods/new_architecture.rb index 7dd43c34d9cea1..3b128b01d29d3d 100644 --- a/packages/react-native/scripts/cocoapods/new_architecture.rb +++ b/packages/react-native/scripts/cocoapods/new_architecture.rb @@ -109,6 +109,7 @@ def self.install_modules_dependencies(spec, new_arch_enabled, folly_version) header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\"" header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\"" header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\"" + header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\"" end header_search_paths_string = header_search_paths.join(" ") spec.compiler_flags = compiler_flags.empty? ? @@folly_compiler_flags : "#{compiler_flags} #{@@folly_compiler_flags}" @@ -135,6 +136,7 @@ def self.install_modules_dependencies(spec, new_arch_enabled, folly_version) spec.dependency "Yoga" spec.dependency "React-Fabric" spec.dependency "React-graphics" + spec.dependency "React-debug" if ENV["USE_HERMES"] == nil || ENV["USE_HERMES"] == "1" spec.dependency "hermes-engine" diff --git a/packages/react-native/scripts/react_native_pods.rb b/packages/react-native/scripts/react_native_pods.rb index 8b786505cbff8b..cba10765767e47 100644 --- a/packages/react-native/scripts/react_native_pods.rb +++ b/packages/react-native/scripts/react_native_pods.rb @@ -117,6 +117,7 @@ def use_react_native! ( pod 'React-Core/RCTWebSocket', :path => "#{prefix}/" pod 'React-rncore', :path => "#{prefix}/ReactCommon" pod 'React-cxxreact', :path => "#{prefix}/ReactCommon/cxxreact" + pod 'React-debug', :path => "#{prefix}/ReactCommon/react/debug" if hermes_enabled setup_hermes!(:react_native_path => prefix, :fabric_enabled => fabric_enabled) diff --git a/packages/rn-tester/Podfile.lock b/packages/rn-tester/Podfile.lock index be0ec11b28e079..a9132e6b3dd66c 100644 --- a/packages/rn-tester/Podfile.lock +++ b/packages/rn-tester/Podfile.lock @@ -122,12 +122,15 @@ PODS: - React-RCTVibration (= 1000.0.0) - React-callinvoker (1000.0.0) - React-Codegen (1000.0.0): + - DoubleConversion - FBReactNativeSpec + - glog - hermes-engine - RCT-Folly - RCTRequired - RCTTypeSafety - React-Core + - React-debug - React-Fabric - React-graphics - React-jsi @@ -339,10 +342,17 @@ PODS: - React-logger (= 1000.0.0) - React-perflogger (= 1000.0.0) - React-runtimeexecutor (= 1000.0.0) + - React-debug (1000.0.0) - React-Fabric (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-Fabric/animations (= 1000.0.0) - React-Fabric/attributedstring (= 1000.0.0) - React-Fabric/butter (= 1000.0.0) @@ -351,7 +361,6 @@ PODS: - React-Fabric/components (= 1000.0.0) - React-Fabric/config (= 1000.0.0) - React-Fabric/core (= 1000.0.0) - - React-Fabric/debug_core (= 1000.0.0) - React-Fabric/debug_renderer (= 1000.0.0) - React-Fabric/imagemanager (= 1000.0.0) - React-Fabric/leakchecker (= 1000.0.0) @@ -367,53 +376,93 @@ PODS: - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/animations (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/attributedstring (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/butter (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/componentregistry (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/componentregistrynative (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) - - React-Fabric/components/activityindicator (= 1000.0.0) - - React-Fabric/components/image (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-Fabric/components/inputaccessory (= 1000.0.0) - React-Fabric/components/legacyviewmanagerinterop (= 1000.0.0) - React-Fabric/components/modal (= 1000.0.0) @@ -428,233 +477,400 @@ PODS: - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - ReactCommon/turbomodule/core (= 1000.0.0) - - React-Fabric/components/activityindicator (1000.0.0): - - RCT-Folly/Fabric (= 2021.07.22.00) - - RCTRequired (= 1000.0.0) - - RCTTypeSafety (= 1000.0.0) - - React-graphics (= 1000.0.0) - - React-jsi (= 1000.0.0) - - React-jsiexecutor (= 1000.0.0) - - ReactCommon/turbomodule/core (= 1000.0.0) - - React-Fabric/components/image (1000.0.0): - - RCT-Folly/Fabric (= 2021.07.22.00) - - RCTRequired (= 1000.0.0) - - RCTTypeSafety (= 1000.0.0) - - React-graphics (= 1000.0.0) - - React-jsi (= 1000.0.0) - - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/inputaccessory (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/legacyviewmanagerinterop (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/modal (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/rncore (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/root (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/safeareaview (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/scrollview (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/text (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/textinput (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/unimplementedview (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/components/view (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - Yoga - React-Fabric/config (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/core (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) - - ReactCommon/turbomodule/core (= 1000.0.0) - - React-Fabric/debug_core (1000.0.0): - - RCT-Folly/Fabric (= 2021.07.22.00) - - RCTRequired (= 1000.0.0) - - RCTTypeSafety (= 1000.0.0) - - React-graphics (= 1000.0.0) - - React-jsi (= 1000.0.0) - - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/debug_renderer (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/imagemanager (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/leakchecker (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/mapbuffer (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/mounting (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/runtimescheduler (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/scheduler (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/telemetry (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/templateprocessor (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/textlayoutmanager (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-Fabric/uimanager - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/uimanager (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) - React-Fabric/utils (1000.0.0): + - DoubleConversion + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - RCTRequired (= 1000.0.0) - RCTTypeSafety (= 1000.0.0) + - React-Core + - React-cxxreact + - React-debug - React-graphics (= 1000.0.0) - React-jsi (= 1000.0.0) - React-jsiexecutor (= 1000.0.0) + - React-logger + - ReactCommon/turbomodule/core (= 1000.0.0) + - React-FabricImage (1000.0.0): + - DoubleConversion + - glog + - hermes-engine + - RCT-Folly/Fabric (= 2021.07.22.00) + - RCTRequired (= 1000.0.0) + - RCTTypeSafety (= 1000.0.0) + - React-Fabric + - React-graphics (= 1000.0.0) + - React-ImageManager + - React-jsi (= 1000.0.0) + - React-jsiexecutor (= 1000.0.0) + - React-logger - ReactCommon/turbomodule/core (= 1000.0.0) + - Yoga - React-graphics (1000.0.0): - glog - RCT-Folly/Fabric (= 2021.07.22.00) @@ -671,8 +887,10 @@ PODS: - React-jsinspector (= 1000.0.0) - React-perflogger (= 1000.0.0) - React-ImageManager (1000.0.0): + - glog - RCT-Folly/Fabric - React-Core/Default + - React-debug - React-Fabric - React-RCTImage - React-jsi (1000.0.0): @@ -693,6 +911,7 @@ PODS: - React-logger (1000.0.0): - glog - React-NativeModulesApple (1000.0.0): + - glog - hermes-engine - React-callinvoker - React-Core @@ -716,6 +935,11 @@ PODS: - RCTRequired - RCTTypeSafety - React-Core + - React-CoreModules + - React-hermes + - React-NativeModulesApple + - React-RCTImage + - React-RCTNetwork - ReactCommon/turbomodule/core - React-RCTBlob (1000.0.0): - hermes-engine @@ -727,11 +951,18 @@ PODS: - React-RCTNetwork (= 1000.0.0) - ReactCommon/turbomodule/core (= 1000.0.0) - React-RCTFabric (1000.0.0): + - glog + - hermes-engine - RCT-Folly/Fabric (= 2021.07.22.00) - React-Core (= 1000.0.0) + - React-debug - React-Fabric (= 1000.0.0) + - React-FabricImage + - React-graphics - React-ImageManager - React-RCTImage (= 1000.0.0) + - React-RCTText + - Yoga - React-RCTImage (1000.0.0): - RCT-Folly (= 2021.07.22.00) - RCTTypeSafety (= 1000.0.0) @@ -812,6 +1043,7 @@ PODS: - React-logger (= 1000.0.0) - React-perflogger (= 1000.0.0) - ScreenshotManager (0.0.1): + - glog - RCT-Folly (= 2021.07.22.00) - React-Core - SocketRocket (0.6.0) @@ -845,7 +1077,7 @@ DEPENDENCIES: - FlipperKit/FlipperKitUserDefaultsPlugin (= 0.182.0) - FlipperKit/SKIOSNetworkPlugin (= 0.182.0) - glog (from `../react-native/third-party-podspecs/glog.podspec`) - - hermes-engine (from `../react-native/sdks/hermes/hermes-engine.podspec`) + - hermes-engine (from `../react-native/sdks/hermes-engine/hermes-engine.podspec`) - libevent (~> 2.1.12) - OCMock (~> 3.9.1) - OpenSSL-Universal (= 1.1.1100) @@ -861,7 +1093,9 @@ DEPENDENCIES: - React-Core/RCTWebSocket (from `../react-native/`) - React-CoreModules (from `../react-native/React/CoreModules`) - React-cxxreact (from `../react-native/ReactCommon/cxxreact`) + - React-debug (from `../react-native/ReactCommon/react/debug`) - React-Fabric (from `../react-native/ReactCommon`) + - React-FabricImage (from `../react-native/ReactCommon`) - React-graphics (from `../react-native/ReactCommon/react/renderer/graphics`) - React-hermes (from `../react-native/ReactCommon/hermes`) - React-ImageManager (from `../react-native/ReactCommon/react/renderer/imagemanager/platform/ios`) @@ -921,7 +1155,8 @@ EXTERNAL SOURCES: glog: :podspec: "../react-native/third-party-podspecs/glog.podspec" hermes-engine: - :podspec: "../react-native/sdks/hermes/hermes-engine.podspec" + :podspec: "../react-native/sdks/hermes-engine/hermes-engine.podspec" + :tag: '' RCT-Folly: :podspec: "../react-native/third-party-podspecs/RCT-Folly.podspec" RCTRequired: @@ -940,8 +1175,12 @@ EXTERNAL SOURCES: :path: "../react-native/React/CoreModules" React-cxxreact: :path: "../react-native/ReactCommon/cxxreact" + React-debug: + :path: "../react-native/ReactCommon/react/debug" React-Fabric: :path: "../react-native/ReactCommon" + React-FabricImage: + :path: "../react-native/ReactCommon" React-graphics: :path: "../react-native/ReactCommon/react/renderer/graphics" React-hermes: @@ -1002,9 +1241,9 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: boost: 57d2868c099736d80fcd648bf211b4431e51a558 CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 - DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54 - FBLazyVector: d68947eddece25638eb0f642d1b957c90388afd1 - FBReactNativeSpec: e15126dac01896217e97d3ed3045a67be39e97cd + DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953 + FBLazyVector: 9c79ec2238e065a949c9bb7aebdf7cebd6203015 + FBReactNativeSpec: 66b1b6348a3f6c3133e6e437ad50b46f4fef812f Flipper: 6edb735e6c3e332975d1b17956bcc584eccf5818 Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c Flipper-DoubleConversion: 2dc99b02f658daf147069aad9dbd29d8feb06d30 @@ -1014,52 +1253,54 @@ SPEC CHECKSUMS: Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9 FlipperKit: 2efad7007d6745a3f95e4034d547be637f89d3f6 fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 - glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b - hermes-engine: d4e3147fcec14fb95d56cad45f03f126e725a098 + glog: 99bd064df01718db56b8f75e6b5ea3051c7dad0a + hermes-engine: 6085d07261e8a8bfe708e4b0dcd0f3eae72a8e4d libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 OCMock: 9491e4bec59e0b267d52a9184ff5605995e74be8 OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c - RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1 - RCTRequired: 54a4f03dbbebb0cfdb4e2ba8d3b1d0b1258f8c08 - RCTTypeSafety: a41e253b4ed644708899857d912b2f50c7b6214d - React: 2fc6c4c656cccd6753016528ad41199c16fd558e - React-callinvoker: a7d5e883a83bb9bd3985b08be832c5e76451d18f - React-Codegen: ecc7c203dcc86316ff12a865dbfc71190458b367 - React-Core: 6ed76c248f07d2d65d8d15b33a75444ef6ff7938 - React-CoreModules: 9b9060df7f561e9c8f8364333c2ec645d7c698d2 - React-cxxreact: aff243750dad852080636e615d7ae5639381735b - React-Fabric: 6b5c30b6e60a85446cc5d3702fa262fd1fc15619 - React-graphics: e70886fff4b79bec3745de761900a770029591f2 - React-hermes: 7f0e87d44b1c7cfbdd11aa3c070d04435fe75d57 - React-ImageManager: 9fd3521fb8871cd5bea83d2d282da27d6ef91199 - React-jsi: e4c75a1cf727c8761908ac2eeb1084e47ba88a26 - React-jsiexecutor: 8361f78286021782d885e0888bb059a4045c59b9 - React-jsinspector: 9b56a373a6797114e1d89a7dffa98ee98af67a8f - React-logger: 07c9b44040a6f948b8e2033207b23cb623f0b9b4 - React-NativeModulesApple: 47a650ab999a254890d8294581b59761f09d3867 - React-perflogger: b4b9fb2ddd856b78003708ab3cf66ce03e6bc7c4 - React-RCTActionSheet: 1b1501ef80928be10702cd0ce09120358094cd82 - React-RCTAnimation: 6741f7be3e269e057c1426074cc70f34b56e114b - React-RCTAppDelegate: 777164f9f62174c65df37286df4eee43b44a6fb0 - React-RCTBlob: fd1ee93e48aa67b0183346a59754375de93de63d - React-RCTFabric: 179b2203e1b8b89b6ec8fa6104071beb553b1684 - React-RCTImage: 055685a12c88939437f6520d9e7c120cd666cbf1 - React-RCTLinking: b149b3ff1f96fa93fc445230b9c171adb0e5572c - React-RCTNetwork: 21abb4231182651f48b7035beaa011b1ab7ae8f4 - React-RCTPushNotification: f3af966de34c1fe2df8860625d225fb2f581d15e - React-RCTSettings: 64b6acabfddf7f96796229b101bd91f46d14391b - React-RCTTest: 81ebfa8c2e1b0b482effe12485e6486dc0ff70d7 - React-RCTText: 4e5ae05b778a0ed2b22b012af025da5e1a1c4e54 - React-RCTVibration: ecfd04c1886a9c9a4e31a466c0fbcf6b36e92fde - React-rncore: 4c50bd546c117f4024a84bf6de1dd905d5fa3e82 - React-runtimeexecutor: c7b2cd6babf6cc50340398bfbb7a9da13c93093f - ReactCommon: b3e76cb18ee28cd0e3a927f5b53f888312443b6b - ReactCommon-Samples: 7bf1ed1f5d659fae980b40c35c5a431d0ec49189 - ScreenshotManager: 4e5729bfcd19014d277e57eb60e8e75db64b2953 + RCT-Folly: b0d1393cb3763d71efca99db314c65f0072eb0fe + RCTRequired: 40ffd795b32a630f147fcc15247920e5161b6a4e + RCTTypeSafety: fd9d941c329580ea280cad3565bb2e1656969f41 + React: 47363de0e2c161a347eef1cb57cba33f1a4b7377 + React-callinvoker: 28e99e6254975d5be67eafeedbcc3a45bb1ace94 + React-Codegen: 9ecf53f804f4d1d2a5d29bb2154e22a30c381f81 + React-Core: f2a04589df942502db2f3ef84ddc83a35a7086d3 + React-CoreModules: 4fe81e5b80d5daa3e81151dfc9e516ae1a0e575f + React-cxxreact: 1235a3b3d8ea0639f95741cc907ddbb41da4bea3 + React-debug: 9c6d0fd7867cc4a8f435d528e2c5fa8465e9c054 + React-Fabric: b429ac248d619825f97ceb607d1a2d556a49c47c + React-FabricImage: 8136841d81a7005ac3c294623f87497f6bbf8f09 + React-graphics: ed6de536e153c7bc852f9c773a3c9b21c2ee22da + React-hermes: b494c9c833faa6217b2f666d13aa52623c34c2e9 + React-ImageManager: 3e990b6ffbc7634556ddf5b90e5bb1025c397a4c + React-jsi: 00d3c30ce021ff1a074315b824b22108db01131f + React-jsiexecutor: 473c386e219c256066689a334663e8813cdc65ef + React-jsinspector: 25164fdf93d5be275ba455d916e96adb49fa407c + React-logger: a2165169d9c1897c1a139c6b158f6f79090ee174 + React-NativeModulesApple: 5ca2a6989b4549ecf557958c72d514bda071922d + React-perflogger: b5ecf879c705577c80e5299ae678b9375fe2f998 + React-RCTActionSheet: 4a241f444d11926261dd904449a31f35157d4eee + React-RCTAnimation: cf7c9f502e597ee97ce18d1bc4eb8a5836ecf21d + React-RCTAppDelegate: da46fbaa608f201a832d1310bd2e8ce4234642b1 + React-RCTBlob: 48eae02e3f75777da97e9282a5861d04471624a9 + React-RCTFabric: 4b122d0e96f6a581046b8cb950e3277036a5d45a + React-RCTImage: 3efab57255aeb986f89ddc8719fbffd4559954ad + React-RCTLinking: 708dbd9b0aa0845c735e5d6b0e9f7f268008a830 + React-RCTNetwork: d88896f8b7adf85ba366168c5bf1e03d7c235493 + React-RCTPushNotification: dbacfd181137a62deebc62fd386419e707cdcf95 + React-RCTSettings: 17cb468bba42b17b7b0e40ea971d6bd8a78baa3f + React-RCTTest: d7142acb2544c01f53deb2b0543d63df6e214ac2 + React-RCTText: 8cb3ebda2675a02de0cb363a765fafb7d6c31cc1 + React-RCTVibration: c40f0f3e0114354bbf4b418e381c2c96d1d22d48 + React-rncore: 11d8412fb1e339cd1be30aa33cb3b265b46a542b + React-runtimeexecutor: c810e5b7d7500a9ad3ed66b834503e412684936d + ReactCommon: a7972e80473d6ba9bcf3ee53bcc310ac6b944a49 + ReactCommon-Samples: 93c677b30087b6aa82bbccb4458a2028cd6ebd10 + ScreenshotManager: d39b964a374e5012e2b8c143e29ead86b1da6a3c SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608 - Yoga: 1b1a12ff3d86a10565ea7cbe057d42f5e5fb2a07 + Yoga: b82f2e3cbeb3d926329278b24d54d798215d4fa3 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: 9fa6f105e2187b680e978d57b28e2f700c8bd295 +PODFILE CHECKSUM: bdab6add69d555774de227d7119a8f5ae02a670e COCOAPODS: 1.12.0 From d9b3339ef8df3624295ba6f3ca51757b4b4a003b Mon Sep 17 00:00:00 2001 From: Pieter Vanderwerff Date: Thu, 1 Jun 2023 12:02:07 -0700 Subject: [PATCH 28/33] Upgrade hermes-* packages in xplat and arvr to version 0.12.0 (#37648) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37648 Upgrade hermes parser packages to the latest released versions. Changelog is here: https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md Main differences are improved parser support for new Flow features. Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D46303102 fbshipit-source-id: 4989581757df6422174b2d0ddb8fd38be94bfc89 --- package.json | 2 +- yarn.lock | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 6bfad30679abb3..6b6620df0f7a40 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "eslint-plugin-redundant-undefined": "^0.4.0", "eslint-plugin-relay": "^1.8.3", "flow-bin": "^0.207.0", - "hermes-eslint": "0.8.0", + "hermes-eslint": "0.12.0", "inquirer": "^7.1.0", "jest": "^29.2.1", "jest-junit": "^10.0.0", diff --git a/yarn.lock b/yarn.lock index 45cbbc30af4916..0f8426d65d26ed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6081,20 +6081,32 @@ has@^1.0.3: dependencies: function-bind "^1.1.1" -hermes-eslint@0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/hermes-eslint/-/hermes-eslint-0.8.0.tgz#e0a892d3f63f25d0966aa558ed40e373e2d0a065" - integrity sha512-TXbTys9Ssx9kzB8W18TK8m23QTSG6RqI4dOVzG12DslDJGNBU3pJV8AWkiwz8aOyCU6uiWhbVE2855E7g3iXoA== +hermes-eslint@0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/hermes-eslint/-/hermes-eslint-0.12.0.tgz#e0a0ff4c24679650789cee26d0f70fe7ca7915b7" + integrity sha512-I+CqRj8ciokZisoZkHK2xRB5kOnjq/42MWNlW7v1S9tLpi0iuZd1sXsb1TEDgkqk/xDpfNdOrIoesb+9c5MkSw== dependencies: esrecurse "^4.3.0" - hermes-estree "0.8.0" - hermes-parser "0.8.0" + hermes-estree "0.12.0" + hermes-parser "0.12.0" + +hermes-estree@0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.12.0.tgz#8a289f9aee854854422345e6995a48613bac2ca8" + integrity sha512-+e8xR6SCen0wyAKrMT3UD0ZCCLymKhRgjEB5sS28rKiFir/fXgLoeRilRUssFCILmGHb+OvHDUlhxs0+IEyvQw== hermes-estree@0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/hermes-estree/-/hermes-estree-0.8.0.tgz#530be27243ca49f008381c1f3e8b18fb26bf9ec0" integrity sha512-W6JDAOLZ5pMPMjEiQGLCXSSV7pIBEgRR5zGkxgmzGSXHOxqV5dC/M1Zevqpbm9TZDE5tu358qZf8Vkzmsc+u7Q== +hermes-parser@0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.12.0.tgz#114dc26697cfb41a6302c215b859b74224383773" + integrity sha512-d4PHnwq6SnDLhYl3LHNHvOg7nQ6rcI7QVil418REYksv0Mh3cEkHDcuhGxNQ3vgnLSLl4QSvDrFCwQNYdpWlzw== + dependencies: + hermes-estree "0.12.0" + hermes-parser@0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/hermes-parser/-/hermes-parser-0.8.0.tgz#116dceaba32e45b16d6aefb5c4c830eaeba2d257" From 0191d16712a07b092e932a43e386abff9ca2d514 Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Thu, 1 Jun 2023 14:41:00 -0700 Subject: [PATCH 29/33] Fix bad utility type definitions (#37662) Reviewed By: panagosg7 Differential Revision: D46364595 fbshipit-source-id: 5dcd484cd292d5b83b0b114675ec3c8059aefe6b --- .../react-native-codegen/src/CodegenSchema.js | 42 ++++++++++--------- .../GeneratePropsJavaPojo/PojoCollector.js | 8 ++-- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/packages/react-native-codegen/src/CodegenSchema.js b/packages/react-native-codegen/src/CodegenSchema.js index f05a4f2e749ab3..1708e8939b4e8b 100644 --- a/packages/react-native-codegen/src/CodegenSchema.js +++ b/packages/react-native-codegen/src/CodegenSchema.js @@ -134,6 +134,27 @@ export type EventTypeAnnotation = elementType: EventTypeAnnotation, }>; +export type ArrayTypeAnnotation = $ReadOnly<{ + type: 'ArrayTypeAnnotation', + elementType: + | BooleanTypeAnnotation + | StringTypeAnnotation + | DoubleTypeAnnotation + | FloatTypeAnnotation + | Int32TypeAnnotation + | $ReadOnly<{ + type: 'StringEnumTypeAnnotation', + default: string, + options: $ReadOnlyArray, + }> + | ObjectTypeAnnotation + | ReservedPropTypeAnnotation + | $ReadOnly<{ + type: 'ArrayTypeAnnotation', + elementType: ObjectTypeAnnotation, + }>, +}>; + export type PropTypeAnnotation = | $ReadOnly<{ type: 'BooleanTypeAnnotation', @@ -167,26 +188,7 @@ export type PropTypeAnnotation = }> | ReservedPropTypeAnnotation | ObjectTypeAnnotation - | $ReadOnly<{ - type: 'ArrayTypeAnnotation', - elementType: - | BooleanTypeAnnotation - | StringTypeAnnotation - | DoubleTypeAnnotation - | FloatTypeAnnotation - | Int32TypeAnnotation - | $ReadOnly<{ - type: 'StringEnumTypeAnnotation', - default: string, - options: $ReadOnlyArray, - }> - | ObjectTypeAnnotation - | ReservedPropTypeAnnotation - | $ReadOnly<{ - type: 'ArrayTypeAnnotation', - elementType: ObjectTypeAnnotation, - }>, - }> + | ArrayTypeAnnotation | MixedTypeAnnotation; export type ReservedPropTypeAnnotation = $ReadOnly<{ diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js index 81829b99da8467..7aaa6d297bf539 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js @@ -21,6 +21,7 @@ import type { Int32TypeAnnotation, PropTypeAnnotation, MixedTypeAnnotation, + ArrayTypeAnnotation, } from '../../../CodegenSchema'; const {capitalize} = require('../../Utils'); @@ -110,11 +111,8 @@ class PojoCollector { } case 'ArrayTypeAnnotation': { const arrayTypeAnnotation = typeAnnotation; - // TODO: Flow assumes elementType can be any. Fix this. - const elementType: $PropertyType< - typeof arrayTypeAnnotation, - 'elementType', - > = arrayTypeAnnotation.elementType; + const elementType: $PropertyType = + arrayTypeAnnotation.elementType; const pojoElementType = (() => { switch (elementType.type) { From e25c6632a2360acfb63ceb62258ee1ec18452018 Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Thu, 1 Jun 2023 23:17:12 -0700 Subject: [PATCH 30/33] Fix bad type definitions related to utility types (wave 2) Summary: This diff fixes more bad type definitions that are previously hidden but will be exposed in the upcoming Flow 0.208.0 Changelog: [Internal] Reviewed By: panagosg7 Differential Revision: D46382788 fbshipit-source-id: 50337ce5bc0f07ac5916a2d4b75eabf5e8e2e427 --- packages/react-native/Libraries/Core/ExceptionsManager.js | 3 ++- packages/react-native/Libraries/Core/setUpDeveloperTools.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/react-native/Libraries/Core/ExceptionsManager.js b/packages/react-native/Libraries/Core/ExceptionsManager.js index 83cd7f654355da..d1de23cfa023f6 100644 --- a/packages/react-native/Libraries/Core/ExceptionsManager.js +++ b/packages/react-native/Libraries/Core/ExceptionsManager.js @@ -117,7 +117,8 @@ function reportException( } } -declare var console: typeof console & { +declare var console: { + error: typeof console.error, _errorOriginal: typeof console.error, reportErrorsAsExceptions: boolean, ... diff --git a/packages/react-native/Libraries/Core/setUpDeveloperTools.js b/packages/react-native/Libraries/Core/setUpDeveloperTools.js index c964af738112f6..67227191a8b71b 100644 --- a/packages/react-native/Libraries/Core/setUpDeveloperTools.js +++ b/packages/react-native/Libraries/Core/setUpDeveloperTools.js @@ -10,7 +10,7 @@ import Platform from '../Utilities/Platform'; -declare var console: typeof console & {_isPolyfilled: boolean, ...}; +declare var console: {[string]: $FlowFixMe}; /** * Sets up developer tools for React Native. From fd9e295befcd8781190ec26a6a2fc4ef39fb1c15 Mon Sep 17 00:00:00 2001 From: Luna Wei Date: Fri, 2 Jun 2023 17:40:52 -0700 Subject: [PATCH 31/33] Publish nightly monorepo packages (#37556) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37556 Changelog: [Internal] Before making this change, we need to publish `nightly` versions of all existing monorepo dependencies. Reviewed By: hoxyq Differential Revision: D46117197 fbshipit-source-id: bcf6364e068579e63ca19e8161dcd32de4353e56 --- scripts/__tests__/publish-npm-test.js | 3 +- ...h-nightly-for-each-changed-package-test.js | 101 +++++++++++++ ...ublish-nightly-for-each-changed-package.js | 135 ++++++++++++++++++ scripts/npm-utils.js | 31 +++- scripts/publish-npm.js | 8 ++ scripts/scm-utils.js | 14 ++ 6 files changed, 289 insertions(+), 3 deletions(-) create mode 100644 scripts/monorepo/__tests__/publish-nightly-for-each-changed-package-test.js create mode 100644 scripts/monorepo/publish-nightly-for-each-changed-package.js diff --git a/scripts/__tests__/publish-npm-test.js b/scripts/__tests__/publish-npm-test.js index 2b4825bdf42c1e..32bc613ff98628 100644 --- a/scripts/__tests__/publish-npm-test.js +++ b/scripts/__tests__/publish-npm-test.js @@ -32,7 +32,8 @@ jest .mock('./../release-utils', () => ({ generateAndroidArtifacts: jest.fn(), publishAndroidArtifactsToMaven: publishAndroidArtifactsToMavenMock, - })); + })) + .mock('../monorepo/publish-nightly-for-each-changed-package'); const date = new Date('2023-04-20T23:52:39.543Z'); diff --git a/scripts/monorepo/__tests__/publish-nightly-for-each-changed-package-test.js b/scripts/monorepo/__tests__/publish-nightly-for-each-changed-package-test.js new file mode 100644 index 00000000000000..b7d420809bfec6 --- /dev/null +++ b/scripts/monorepo/__tests__/publish-nightly-for-each-changed-package-test.js @@ -0,0 +1,101 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const publishNightlyForEachChangedPackage = require('../publish-nightly-for-each-changed-package'); + +const mockPackages = [ + { + packageManifest: {name: 'packageA', version: 'local-version'}, + packageAbsolutePath: '/some/place/packageA', + packageRelativePathFromRoot: './place/packageA', + }, +]; + +const execMock = jest.fn(); +const writeFileSyncMock = jest.fn(); +const diffPackagesMock = jest.fn(); +const publishPackageMock = jest.fn(); + +jest + .mock('shelljs', () => ({ + exec: execMock, + rm: jest.fn(), + })) + .mock('fs', () => ({ + writeFileSync: writeFileSyncMock, + })) + .mock('../for-each-package', () => callback => { + mockPackages.forEach( + ({packageManifest, packageAbsolutePath, packageRelativePathFromRoot}) => + callback( + packageAbsolutePath, + packageRelativePathFromRoot, + packageManifest, + ), + ); + }) + .mock('../../scm-utils', () => ({ + restore: jest.fn(), + })) + .mock('../../npm-utils', () => ({ + getPackageVersionStrByTag: () => 'published-nightly-version', + diffPackages: diffPackagesMock, + publishPackage: publishPackageMock, + pack: jest.fn(), + })); + +describe('publishNightlyForEachChangedPackage', () => { + beforeEach(() => { + jest.clearAllMocks(); + }); + + it('publishes because there are changes', () => { + const nightlyVersion = '0.73.0-nightly-202108-shortcommit'; + publishPackageMock.mockImplementationOnce(() => ({code: 0})); + diffPackagesMock.mockImplementationOnce(() => 'some-file-name.js\n'); + + publishNightlyForEachChangedPackage(nightlyVersion); + + // ensure we set the version of the last published nightly (for diffing) + expect(writeFileSyncMock.mock.calls[0][1]).toBe( + '{\n "name": "packageA",\n "version": "published-nightly-version"\n}\n', + ); + + expect(diffPackagesMock).toBeCalledWith( + 'packageA@nightly', + 'packageA-published-nightly-version.tgz', + { + cwd: '/some/place/packageA', + }, + ); + + // when determining that we DO want to publish, ensure we update the version to the provded nightly version we want to use + expect(writeFileSyncMock.mock.calls[1][1]).toBe( + `{\n "name": "packageA",\n "version": "${nightlyVersion}"\n}\n`, + ); + + expect(publishPackageMock).toBeCalled(); + }); + + it('doesnt publish because no changes', () => { + const nightlyVersion = '0.73.0-nightly-202108-shortcommit'; + diffPackagesMock.mockImplementationOnce(() => '\n'); + + publishNightlyForEachChangedPackage(nightlyVersion); + + expect(writeFileSyncMock.mock.calls[0][1]).toBe( + '{\n "name": "packageA",\n "version": "published-nightly-version"\n}\n', + ); + + // in this test, we expect there to be no differences between last published nightly and local + // so we never update the version and we don't publish + expect(writeFileSyncMock.mock.calls.length).toBe(1); + expect(publishPackageMock).not.toBeCalled(); + }); +}); diff --git a/scripts/monorepo/publish-nightly-for-each-changed-package.js b/scripts/monorepo/publish-nightly-for-each-changed-package.js new file mode 100644 index 00000000000000..1c04d722180011 --- /dev/null +++ b/scripts/monorepo/publish-nightly-for-each-changed-package.js @@ -0,0 +1,135 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @oncall react_native + */ + +const forEachPackage = require('./for-each-package'); +const {rm} = require('shelljs'); +const { + getPackageVersionStrByTag, + diffPackages, + publishPackage, + pack, +} = require('../npm-utils'); +const {restore} = require('../scm-utils'); +const path = require('path'); +const {writeFileSync} = require('fs'); + +function hasChanges( + currentNightlyVersion, + packageManifest, + packageAbsolutePath, +) { + // Set local package to same nightly version so diff is comparable + writeFileSync( + path.join(packageAbsolutePath, 'package.json'), + JSON.stringify( + {...packageManifest, version: currentNightlyVersion}, + null, + 2, + ) + '\n', + 'utf-8', + ); + + // prepare local package + pack(packageAbsolutePath); + + // ex. react-native-codegen-0.73.0-nightly-20230530-730ca3540.tgz + const localTarballName = `${packageManifest.name + .replace('@', '') + .replace('/', '-')}-${currentNightlyVersion}.tgz`; + + // npm diff --diff=@nightly --diff=. --diff-name-only + const diff = diffPackages( + `${packageManifest.name}@nightly`, + localTarballName, + { + cwd: packageAbsolutePath, + }, + ); + + // delete tarball and restore package.json changes + rm({cwd: packageAbsolutePath}, localTarballName); + restore(packageAbsolutePath); + + return diff.trim().length !== 0; +} + +/** + * Publish nightlies for monorepo packages that changed since last publish. + * This is called by `react-native`'s nightly job. + * + * Note: This does not publish `package/react-native`'s nightly. That is handled in `publish-npm`. + */ +function publishNightlyForEachChangedPackage(nightlyVersion) { + forEachPackage( + (packageAbsolutePath, packageRelativePathFromRoot, packageManifest) => { + if (packageManifest.private) { + console.log(`\u23ED Skipping private package ${packageManifest.name}`); + + return; + } + + let lastPublishedNightlyVersion; + let shouldPublishNightly = false; + console.log( + `\n---- Attempting to publish nightly for ${packageManifest.name}`, + ); + try { + lastPublishedNightlyVersion = getPackageVersionStrByTag( + packageManifest.name, + 'nightly', + ); + shouldPublishNightly = hasChanges( + lastPublishedNightlyVersion, + packageManifest, + packageAbsolutePath, + ); + } catch (e) { + console.error( + `Unable to verify if ${packageManifest.name} has changes due to error:`, + ); + console.error(e.message); + console.log(`\u23ED Skipping package ${packageManifest.name}`); + return; + } + + if (!shouldPublishNightly) { + console.log( + `Detected no changes in ${packageManifest.name}@nightly since last publish. Skipping.`, + ); + return; + } + + // Set the local package to the updated nightly version + writeFileSync( + path.join(packageAbsolutePath, 'package.json'), + JSON.stringify({...packageManifest, version: nightlyVersion}, null, 2) + + '\n', + 'utf-8', + ); + + const result = publishPackage(packageAbsolutePath, { + tag: 'nightly', + otp: process.env.NPM_CONFIG_OTP, + }); + if (result.code !== 0) { + console.log( + `\u274c Failed to publish version ${nightlyVersion} of ${packageManifest.name}. npm publish exited with code ${result.code}:`, + ); + console.error(result.stderr); + } else { + console.log( + `\u2705 Successfully published new version of ${packageManifest.name}`, + ); + } + }, + ); +} + +module.exports = publishNightlyForEachChangedPackage; diff --git a/scripts/npm-utils.js b/scripts/npm-utils.js index 15752a340eb66c..5586d7e3372952 100644 --- a/scripts/npm-utils.js +++ b/scripts/npm-utils.js @@ -12,10 +12,10 @@ const {exec} = require('shelljs'); function getPackageVersionStrByTag(packageName, tag) { - const result = exec(`npm view ${packageName}@${tag} version`); + const result = exec(`npm view ${packageName}@${tag} version`, {silent: true}); if (result.code) { - throw `Failed to get ${tag} version from npm\n${result.stderr}`; + throw new Error(`Failed to get ${tag} version from npm\n${result.stderr}`); } return result.stdout.trim(); } @@ -31,7 +31,34 @@ function publishPackage(packagePath, packageOptions, execOptions) { return exec(`npm publish${tagFlag}${otpFlag}`, options); } +function diffPackages(packageSpecA, packageSpecB, options) { + const result = exec( + `npm diff --diff=${packageSpecA} --diff=${packageSpecB} --diff-name-only`, + options, + ); + + if (result.code) { + throw new Error( + `Failed to diff ${packageSpecA} and ${packageSpecB}\n${result.stderr}`, + ); + } + + return result.stdout; +} + +function pack(packagePath) { + const result = exec('npm pack', { + cwd: packagePath, + }); + + if (result.code !== 0) { + throw new Error(result.stderr); + } +} + module.exports = { getPackageVersionStrByTag, publishPackage, + diffPackages, + pack, }; diff --git a/scripts/publish-npm.js b/scripts/publish-npm.js index 275407ad621aa6..653a3782c56925 100755 --- a/scripts/publish-npm.js +++ b/scripts/publish-npm.js @@ -17,6 +17,7 @@ const { getCurrentCommit, isTaggedLatest, } = require('./scm-utils'); +const publishNightlyForEachChangedPackage = require('./monorepo/publish-nightly-for-each-changed-package'); const { generateAndroidArtifacts, publishAndroidArtifactsToMaven, @@ -136,6 +137,7 @@ function publishNpm(buildType) { // Set version number in various files (package.json, gradle.properties etc) // For non-nightly, non-dry-run, CircleCI job `prepare_package_for_release` does this if (buildType === 'nightly' || buildType === 'dry-run') { + // Sets the version for package/react-native if ( exec( `node scripts/set-rn-version.js --to-version ${version} --build-type ${buildType}`, @@ -146,6 +148,11 @@ function publishNpm(buildType) { } } + // set and publish the relevant monorepo packages + if (buildType === 'nightly') { + publishNightlyForEachChangedPackage(version); + } + generateAndroidArtifacts(version); // Write version number to the build folder @@ -166,6 +173,7 @@ function publishNpm(buildType) { tag, otp: process.env.NPM_CONFIG_OTP, }); + if (result.code) { echo('Failed to publish package to npm'); return exit(1); diff --git a/scripts/scm-utils.js b/scripts/scm-utils.js index 11810e6470c44e..eab057bd5f44c8 100644 --- a/scripts/scm-utils.js +++ b/scripts/scm-utils.js @@ -85,6 +85,19 @@ function revertFiles(filePaths, tmpFolder) { } } +// git restore for local path +function restore(repoPath) { + const result = exec('git restore .', { + cwd: repoPath, + }); + + if (result.code !== 0) { + throw new Error(result.stderr); + } + + return; +} + module.exports = { exitIfNotOnGit, getCurrentCommit, @@ -92,4 +105,5 @@ module.exports = { isTaggedLatest, revertFiles, saveFiles, + restore, }; From d54f486fe66d01450d3c7a04fb0a025319a3014c Mon Sep 17 00:00:00 2001 From: Daniel Leong Date: Sun, 4 Jun 2023 00:03:01 -0700 Subject: [PATCH 32/33] Fix: a11y crash when an accessible link is ellipsized away (#37050) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: If an accessible link is ellipsized out of being rendered, the AccessibilityDelegate will still attempt to populate an accessibility node for it; doing so results in an invalid request to a TextLayout API, however, causing a crash. This crash occurs as soon as the element is rendered, so long as a Screen Reader (or app using similar a11y APIs) is enabled. This change uses a technique similar to those existing to make the node "blank" in such cases, so Talkback can filter it out—and, more importantly, not crash. ## Changelog: [Android] [Fixed] - Fix links hidden via ellipsis crashing screen readers Pull Request resolved: https://github.com/facebook/react-native/pull/37050 Test Plan: - Added a block to the "Accessibility Android APIs" page in the rn-tester app. Without the changes to `ReactAccessibilityDelegate`, this component crashes the app; with the changes, the component renders without problem. - You can also see the crash "in the wild" using [this Expo Snack](https://snack.expo.dev/dhleong/2d1407) that I put together when trying to isolate this issue. Reviewed By: rshest Differential Revision: D46206673 Pulled By: NickGerleman fbshipit-source-id: 0eb3e735202ee6be5f931bbb4bb92c24e7458ea6 --- .../uimanager/ReactAccessibilityDelegate.java | 25 ++++++++++++++++--- .../AccessibilityAndroidExample.android.js | 14 +++++++++++ 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java index 531e4591ba6a99..b8b08c9bf74e8c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java @@ -786,9 +786,18 @@ protected void onPopulateNodeForVirtualView( return; } + // NOTE: The span may not actually have visible bounds within its parent, + // due to line limits, etc. + final Rect bounds = getBoundsInParent(accessibleTextSpan); + if (bounds == null) { + node.setContentDescription(""); + node.setBoundsInParent(new Rect(0, 0, 1, 1)); + return; + } + node.setContentDescription(accessibleTextSpan.description); node.addAction(AccessibilityNodeInfoCompat.ACTION_CLICK); - node.setBoundsInParent(getBoundsInParent(accessibleTextSpan)); + node.setBoundsInParent(bounds); node.setRoleDescription(mView.getResources().getString(R.string.link_description)); node.setClassName(AccessibilityRole.getValue(AccessibilityRole.BUTTON)); } @@ -805,10 +814,19 @@ private Rect getBoundsInParent(AccessibilityLinks.AccessibleLink accessibleLink) return new Rect(0, 0, textView.getWidth(), textView.getHeight()); } - Rect rootRect = new Rect(); - double startOffset = accessibleLink.start; double endOffset = accessibleLink.end; + + // Ensure the link hasn't been ellipsized away; in such cases, + // getPrimaryHorizontal will crash (and the link isn't rendered anyway). + int startOffsetLineNumber = textViewLayout.getLineForOffset((int) startOffset); + int lineEndOffset = textViewLayout.getLineEnd(startOffsetLineNumber); + if (startOffset > lineEndOffset) { + return null; + } + + Rect rootRect = new Rect(); + double startXCoordinates = textViewLayout.getPrimaryHorizontal((int) startOffset); final Paint paint = new Paint(); @@ -818,7 +836,6 @@ private Rect getBoundsInParent(AccessibilityLinks.AccessibleLink accessibleLink) paint.setTextSize(textSize); int textWidth = (int) Math.ceil(paint.measureText(accessibleLink.description)); - int startOffsetLineNumber = textViewLayout.getLineForOffset((int) startOffset); int endOffsetLineNumber = textViewLayout.getLineForOffset((int) endOffset); boolean isMultiline = startOffsetLineNumber != endOffsetLineNumber; textViewLayout.getLineBounds(startOffsetLineNumber, rootRect); diff --git a/packages/rn-tester/js/examples/Accessibility/AccessibilityAndroidExample.android.js b/packages/rn-tester/js/examples/Accessibility/AccessibilityAndroidExample.android.js index 2daf0ba27c6709..f5da9efc20e3c8 100644 --- a/packages/rn-tester/js/examples/Accessibility/AccessibilityAndroidExample.android.js +++ b/packages/rn-tester/js/examples/Accessibility/AccessibilityAndroidExample.android.js @@ -65,6 +65,20 @@ class AccessibilityAndroidExample extends React.Component< render(): React.Node { return ( + + + + Bacon {this.state.count} Ipsum{'\n'} + + Dolor sit amet{'\n'} + Eggsecetur{'\n'} + {'\n'} + + http://github.com + + + + From 2d07d5f160efdd25f5b3dbfa65c13884df9f3117 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Sun, 4 Jun 2023 03:48:45 -0700 Subject: [PATCH 33/33] Native ARIA Roles: iOS Paper + Fabric (#37309) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37309 ### Stack ARIA roles in React Native are implemented on top of accessibilityRole. This is lossy because there are many more ARIA roles than accessibilityRole. This is especially true for RN on desktop where accessibilityRole was designed around accessibility APIs only available on mobile. This series of changes aims to change this implementation to instead pass the ARIA role to native, alongside any existing accessibilityRole. This gives the platform more control in exactly how to map an ARIA role to native behavior. As an example, this would allow mapping any ARIA role to AutomationControlType on Windows without needing to fork to add new options to accessibilityRole. It also allows greater implementation flexibility for other platforms down the line, but for now, iOS and Android behave the same as before (though with their implementation living in native). ### Diff This enables the `role` prop in iOS. ARIA role strings become convertible to `UIAccessibilityTrait`, which is the sink of most of the roles. We keep a list of traits derived from `role` vs `accessibilityRole` on the view, then inval and apply the result any time the prop for either is set. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D45432530 fbshipit-source-id: ced5be06e319c0b967d7511293e14e05147e5759 --- .../View/RCTViewComponentView.mm | 4 +- packages/react-native/React/Views/RCTView.m | 6 +- .../react-native/React/Views/RCTViewManager.m | 132 +++++++++++++----- .../react-native/React/Views/UIView+React.h | 3 + .../react-native/React/Views/UIView+React.m | 37 +++++ .../components/view/AccessibilityProps.cpp | 40 +++--- .../view/accessibilityPropsConversions.h | 4 +- .../RCTAttributedTextUtils.h | 2 + .../RCTAttributedTextUtils.mm | 131 +---------------- 9 files changed, 178 insertions(+), 181 deletions(-) diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm index ecfe8bc408fd95..97feafc4c10fe1 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm @@ -17,6 +17,7 @@ #import #import #import +#import #ifdef RCT_DYNAMIC_FRAMEWORKS #import @@ -722,7 +723,8 @@ - (NSString *)accessibilityValue } NSMutableArray *valueComponents = [NSMutableArray new]; - NSString *roleString = [NSString stringWithUTF8String:props.accessibilityRole.c_str()]; + NSString *roleString = (props.role != Role::None) ? [NSString stringWithUTF8String:toString(props.role).c_str()] + : [NSString stringWithUTF8String:props.accessibilityRole.c_str()]; // In iOS, checkbox and radio buttons aren't recognized as traits. However, // because our apps use checkbox and radio buttons often, we should announce diff --git a/packages/react-native/React/Views/RCTView.m b/packages/react-native/React/Views/RCTView.m index fc678c2577af5e..66c6c5978f8a40 100644 --- a/packages/react-native/React/Views/RCTView.m +++ b/packages/react-native/React/Views/RCTView.m @@ -332,7 +332,11 @@ - (NSString *)accessibilityValue } } NSMutableArray *valueComponents = [NSMutableArray new]; - NSString *roleDescription = self.accessibilityRole ? rolesAndStatesDescription[self.accessibilityRole] : nil; + + // TODO: This logic makes VoiceOver describe some AccessibilityRole which do not have a backing UIAccessibilityTrait. + // It does not run on Fabric. + NSString *role = self.role ?: self.accessibilityRole; + NSString *roleDescription = role ? rolesAndStatesDescription[role] : nil; if (roleDescription) { [valueComponents addObject:roleDescription]; } diff --git a/packages/react-native/React/Views/RCTViewManager.m b/packages/react-native/React/Views/RCTViewManager.m index 2b8f2c0a33ab4f..9a0af4e74cecb9 100644 --- a/packages/react-native/React/Views/RCTViewManager.m +++ b/packages/react-native/React/Views/RCTViewManager.m @@ -26,54 +26,97 @@ @implementation RCTConvert (UIAccessibilityTraits) RCT_MULTI_ENUM_CONVERTER( UIAccessibilityTraits, (@{ - @"none" : @(UIAccessibilityTraitNone), + @"adjustable" : @(UIAccessibilityTraitAdjustable), + @"alert" : @(UIAccessibilityTraitNone), + @"alertdialog" : @(UIAccessibilityTraitNone), + @"allowsDirectInteraction" : @(UIAccessibilityTraitAllowsDirectInteraction), + @"application" : @(UIAccessibilityTraitNone), + @"article" : @(UIAccessibilityTraitNone), + @"banner" : @(UIAccessibilityTraitNone), @"button" : @(UIAccessibilityTraitButton), + @"cell" : @(UIAccessibilityTraitNone), + @"checkbox" : @(UIAccessibilityTraitNone), + @"columnheader" : @(UIAccessibilityTraitNone), + @"combobox" : @(UIAccessibilityTraitNone), + @"complementary" : @(UIAccessibilityTraitNone), + @"contentinfo" : @(UIAccessibilityTraitNone), + @"definition" : @(UIAccessibilityTraitNone), + @"dialog" : @(UIAccessibilityTraitNone), + @"directory" : @(UIAccessibilityTraitNone), + @"disabled" : @(UIAccessibilityTraitNotEnabled), + @"document" : @(UIAccessibilityTraitNone), + @"drawerlayout" : @(UIAccessibilityTraitNone), @"dropdownlist" : @(UIAccessibilityTraitNone), - @"togglebutton" : @(UIAccessibilityTraitButton), - @"link" : @(UIAccessibilityTraitLink), + @"feed" : @(UIAccessibilityTraitNone), + @"figure" : @(UIAccessibilityTraitNone), + @"form" : @(UIAccessibilityTraitNone), + @"frequentUpdates" : @(UIAccessibilityTraitUpdatesFrequently), + @"grid" : @(UIAccessibilityTraitNone), + @"group" : @(UIAccessibilityTraitNone), @"header" : @(UIAccessibilityTraitHeader), - @"search" : @(UIAccessibilityTraitSearchField), + @"heading" : @(UIAccessibilityTraitHeader), + @"horizontalscrollview" : @(UIAccessibilityTraitNone), + @"iconmenu" : @(UIAccessibilityTraitNone), @"image" : @(UIAccessibilityTraitImage), @"imagebutton" : @(UIAccessibilityTraitImage | UIAccessibilityTraitButton), - @"selected" : @(UIAccessibilityTraitSelected), - @"plays" : @(UIAccessibilityTraitPlaysSound), + @"img" : @(UIAccessibilityTraitImage), @"key" : @(UIAccessibilityTraitKeyboardKey), @"keyboardkey" : @(UIAccessibilityTraitKeyboardKey), - @"text" : @(UIAccessibilityTraitStaticText), - @"summary" : @(UIAccessibilityTraitSummaryElement), - @"disabled" : @(UIAccessibilityTraitNotEnabled), - @"frequentUpdates" : @(UIAccessibilityTraitUpdatesFrequently), - @"startsMedia" : @(UIAccessibilityTraitStartsMediaSession), - @"adjustable" : @(UIAccessibilityTraitAdjustable), - @"allowsDirectInteraction" : @(UIAccessibilityTraitAllowsDirectInteraction), - @"pageTurn" : @(UIAccessibilityTraitCausesPageTurn), - @"alert" : @(UIAccessibilityTraitNone), - @"checkbox" : @(UIAccessibilityTraitNone), - @"combobox" : @(UIAccessibilityTraitNone), + @"link" : @(UIAccessibilityTraitLink), + @"list" : @(UIAccessibilityTraitNone), + @"listitem" : @(UIAccessibilityTraitNone), + @"log" : @(UIAccessibilityTraitNone), + @"main" : @(UIAccessibilityTraitNone), + @"marquee" : @(UIAccessibilityTraitNone), + @"math" : @(UIAccessibilityTraitNone), @"menu" : @(UIAccessibilityTraitNone), @"menubar" : @(UIAccessibilityTraitNone), @"menuitem" : @(UIAccessibilityTraitNone), + @"meter" : @(UIAccessibilityTraitNone), + @"navigation" : @(UIAccessibilityTraitNone), + @"none" : @(UIAccessibilityTraitNone), + @"note" : @(UIAccessibilityTraitNone), + @"option" : @(UIAccessibilityTraitNone), + @"pager" : @(UIAccessibilityTraitNone), + @"pageTurn" : @(UIAccessibilityTraitCausesPageTurn), + @"plays" : @(UIAccessibilityTraitPlaysSound), + @"presentation" : @(UIAccessibilityTraitNone), @"progressbar" : @(UIAccessibilityTraitUpdatesFrequently), @"radio" : @(UIAccessibilityTraitNone), @"radiogroup" : @(UIAccessibilityTraitNone), + @"region" : @(UIAccessibilityTraitNone), + @"row" : @(UIAccessibilityTraitNone), + @"rowgroup" : @(UIAccessibilityTraitNone), + @"rowheader" : @(UIAccessibilityTraitNone), @"scrollbar" : @(UIAccessibilityTraitNone), + @"scrollview" : @(UIAccessibilityTraitNone), + @"search" : @(UIAccessibilityTraitSearchField), + @"searchbox" : @(UIAccessibilityTraitNone), + @"selected" : @(UIAccessibilityTraitSelected), + @"separator" : @(UIAccessibilityTraitNone), + @"slider" : @(UIAccessibilityTraitNone), + @"slidingdrawer" : @(UIAccessibilityTraitNone), @"spinbutton" : @(UIAccessibilityTraitNone), + @"startsMedia" : @(UIAccessibilityTraitStartsMediaSession), + @"status" : @(UIAccessibilityTraitNone), + @"summary" : @(UIAccessibilityTraitSummaryElement), @"switch" : @(SwitchAccessibilityTrait), @"tab" : @(UIAccessibilityTraitNone), @"tabbar" : @(UIAccessibilityTraitTabBar), + @"table" : @(UIAccessibilityTraitNone), @"tablist" : @(UIAccessibilityTraitNone), + @"tabpanel" : @(UIAccessibilityTraitNone), + @"term" : @(UIAccessibilityTraitNone), + @"text" : @(UIAccessibilityTraitStaticText), @"timer" : @(UIAccessibilityTraitNone), + @"togglebutton" : @(UIAccessibilityTraitButton), @"toolbar" : @(UIAccessibilityTraitNone), - @"pager" : @(UIAccessibilityTraitNone), - @"scrollview" : @(UIAccessibilityTraitNone), - @"horizontalscrollview" : @(UIAccessibilityTraitNone), + @"tooltip" : @(UIAccessibilityTraitNone), + @"tree" : @(UIAccessibilityTraitNone), + @"treegrid" : @(UIAccessibilityTraitNone), + @"treeitem" : @(UIAccessibilityTraitNone), @"viewgroup" : @(UIAccessibilityTraitNone), @"webview" : @(UIAccessibilityTraitNone), - @"drawerlayout" : @(UIAccessibilityTraitNone), - @"slidingdrawer" : @(UIAccessibilityTraitNone), - @"iconmenu" : @(UIAccessibilityTraitNone), - @"list" : @(UIAccessibilityTraitNone), - @"grid" : @(UIAccessibilityTraitNone), }), UIAccessibilityTraitNone, unsignedLongLongValue) @@ -182,22 +225,41 @@ - (RCTShadowView *)shadowView } RCT_CUSTOM_VIEW_PROPERTY(accessibilityRole, UIAccessibilityTraits, RCTView) +{ + UIAccessibilityTraits accessibilityRoleTraits = + json ? [RCTConvert UIAccessibilityTraits:json] : UIAccessibilityTraitNone; + if (view.reactAccessibilityElement.accessibilityRoleTraits != accessibilityRoleTraits) { + view.accessibilityRoleTraits = accessibilityRoleTraits; + view.reactAccessibilityElement.accessibilityRole = json ? [RCTConvert NSString:json] : nil; + [self updateAccessibilityTraitsForRole:view withDefaultView:defaultView]; + } +} + +RCT_CUSTOM_VIEW_PROPERTY(role, UIAccessibilityTraits, RCTView) +{ + UIAccessibilityTraits roleTraits = json ? [RCTConvert UIAccessibilityTraits:json] : UIAccessibilityTraitNone; + if (view.reactAccessibilityElement.roleTraits != roleTraits) { + view.roleTraits = roleTraits; + view.reactAccessibilityElement.role = json ? [RCTConvert NSString:json] : nil; + [self updateAccessibilityTraitsForRole:view withDefaultView:defaultView]; + } +} + +- (void)updateAccessibilityTraitsForRole:(RCTView *)view withDefaultView:(RCTView *)defaultView { const UIAccessibilityTraits AccessibilityRolesMask = UIAccessibilityTraitNone | UIAccessibilityTraitButton | UIAccessibilityTraitLink | UIAccessibilityTraitSearchField | UIAccessibilityTraitImage | UIAccessibilityTraitKeyboardKey | UIAccessibilityTraitStaticText | UIAccessibilityTraitAdjustable | UIAccessibilityTraitHeader | UIAccessibilityTraitSummaryElement | UIAccessibilityTraitTabBar | UIAccessibilityTraitUpdatesFrequently | SwitchAccessibilityTrait; - view.reactAccessibilityElement.accessibilityTraits = - view.reactAccessibilityElement.accessibilityTraits & ~AccessibilityRolesMask; - UIAccessibilityTraits newTraits = json ? [RCTConvert UIAccessibilityTraits:json] : defaultView.accessibilityTraits; - if (newTraits != UIAccessibilityTraitNone) { - UIAccessibilityTraits maskedTraits = newTraits & AccessibilityRolesMask; - view.reactAccessibilityElement.accessibilityTraits |= maskedTraits; - } else { - NSString *role = json ? [RCTConvert NSString:json] : @""; - view.reactAccessibilityElement.accessibilityRole = role; - } + + // Clear any existing traits set for AccessibilityRole + view.reactAccessibilityElement.accessibilityTraits &= ~(AccessibilityRolesMask); + + view.reactAccessibilityElement.accessibilityTraits |= view.reactAccessibilityElement.role + ? view.reactAccessibilityElement.roleTraits + : view.reactAccessibilityElement.accessibilityRole ? view.reactAccessibilityElement.accessibilityRoleTraits + : (defaultView.accessibilityTraits & AccessibilityRolesMask); } RCT_CUSTOM_VIEW_PROPERTY(accessibilityState, NSDictionary, RCTView) diff --git a/packages/react-native/React/Views/UIView+React.h b/packages/react-native/React/Views/UIView+React.h index 21a70337d7ac9c..d378a8320ba1d3 100644 --- a/packages/react-native/React/Views/UIView+React.h +++ b/packages/react-native/React/Views/UIView+React.h @@ -117,10 +117,13 @@ * Accessibility properties */ @property (nonatomic, copy) NSString *accessibilityRole; +@property (nonatomic, copy) NSString *role; @property (nonatomic, copy) NSDictionary *accessibilityState; @property (nonatomic, copy) NSArray *accessibilityActions; @property (nonatomic, copy) NSDictionary *accessibilityValueInternal; @property (nonatomic, copy) NSString *accessibilityLanguage; +@property (nonatomic) UIAccessibilityTraits accessibilityRoleTraits; +@property (nonatomic) UIAccessibilityTraits roleTraits; /** * Used in debugging to get a description of the view hierarchy rooted at diff --git a/packages/react-native/React/Views/UIView+React.m b/packages/react-native/React/Views/UIView+React.m index 94ad951e7179d7..7c6c71829ff69d 100644 --- a/packages/react-native/React/Views/UIView+React.m +++ b/packages/react-native/React/Views/UIView+React.m @@ -336,6 +336,16 @@ - (void)setAccessibilityRole:(NSString *)accessibilityRole objc_setAssociatedObject(self, @selector(accessibilityRole), accessibilityRole, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } +- (NSString *)role +{ + return objc_getAssociatedObject(self, _cmd); +} + +- (void)setRole:(NSString *)role +{ + objc_setAssociatedObject(self, @selector(role), role, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + - (NSDictionary *)accessibilityState { return objc_getAssociatedObject(self, _cmd); @@ -356,6 +366,33 @@ - (void)setAccessibilityValueInternal:(NSDictionary *)accessibil self, @selector(accessibilityValueInternal), accessibilityValue, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } +- (UIAccessibilityTraits)accessibilityRoleTraits +{ + NSNumber *traitsAsNumber = objc_getAssociatedObject(self, _cmd); + return traitsAsNumber ? [traitsAsNumber unsignedLongLongValue] : UIAccessibilityTraitNone; +} + +- (void)setAccessibilityRoleTraits:(UIAccessibilityTraits)accessibilityRoleTraits +{ + objc_setAssociatedObject( + self, + @selector(accessibilityRoleTraits), + [NSNumber numberWithUnsignedLongLong:accessibilityRoleTraits], + OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (UIAccessibilityTraits)roleTraits +{ + NSNumber *traitsAsNumber = objc_getAssociatedObject(self, _cmd); + return traitsAsNumber ? [traitsAsNumber unsignedLongLongValue] : UIAccessibilityTraitNone; +} + +- (void)setRoleTraits:(UIAccessibilityTraits)roleTraits +{ + objc_setAssociatedObject( + self, @selector(roleTraits), [NSNumber numberWithUnsignedLongLong:roleTraits], OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + #pragma mark - Debug - (void)react_addRecursiveDescriptionToString:(NSMutableString *)string atLevel:(NSUInteger)level { diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp index ad6cf1ce83d8ac..d9ebf62e9b5330 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp @@ -171,14 +171,6 @@ AccessibilityProps::AccessibilityProps( "importantForAccessibility", sourceProps.importantForAccessibility, ImportantForAccessibility::Auto)), - role( - CoreFeatures::enablePropIteratorSetter ? sourceProps.role - : convertRawProp( - context, - rawProps, - "role", - sourceProps.role, - {})), testId( CoreFeatures::enablePropIteratorSetter ? sourceProps.testId : convertRawProp( @@ -195,19 +187,31 @@ AccessibilityProps::AccessibilityProps( // to work around here, and (2) would require very careful work to address // this case and not regress the more common cases. if (!CoreFeatures::enablePropIteratorSetter) { - const auto *rawPropValue = + auto *accessibilityRoleValue = rawProps.at("accessibilityRole", nullptr, nullptr); - AccessibilityTraits traits; - std::string roleString; - if (rawPropValue == nullptr || !rawPropValue->hasValue()) { - traits = sourceProps.accessibilityTraits; - roleString = sourceProps.accessibilityRole; + auto *roleValue = rawProps.at("role", nullptr, nullptr); + + auto *precedentRoleValue = + roleValue != nullptr ? roleValue : accessibilityRoleValue; + + if (accessibilityRoleValue == nullptr || + !accessibilityRoleValue->hasValue()) { + accessibilityRole = sourceProps.accessibilityRole; + } else { + fromRawValue(context, *accessibilityRoleValue, accessibilityRole); + } + + if (roleValue == nullptr || !roleValue->hasValue()) { + role = sourceProps.role; + } else { + fromRawValue(context, *roleValue, role); + } + + if (precedentRoleValue == nullptr || !precedentRoleValue->hasValue()) { + accessibilityTraits = sourceProps.accessibilityTraits; } else { - fromRawValue(context, *rawPropValue, traits); - fromRawValue(context, *rawPropValue, roleString); + fromRawValue(context, *precedentRoleValue, accessibilityTraits); } - accessibilityTraits = traits; - accessibilityRole = roleString; } } diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/accessibilityPropsConversions.h b/packages/react-native/ReactCommon/react/renderer/components/view/accessibilityPropsConversions.h index 9ee16674181ede..1690113e239fcc 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/accessibilityPropsConversions.h +++ b/packages/react-native/ReactCommon/react/renderer/components/view/accessibilityPropsConversions.h @@ -30,7 +30,7 @@ inline void fromString(const std::string &string, AccessibilityTraits &result) { result = AccessibilityTraits::Link; return; } - if (string == "image") { + if (string == "image" || string == "img") { result = AccessibilityTraits::Image; return; } @@ -78,7 +78,7 @@ inline void fromString(const std::string &string, AccessibilityTraits &result) { result = AccessibilityTraits::CausesPageTurn; return; } - if (string == "header") { + if (string == "header" || string == "heading") { result = AccessibilityTraits::Header; return; } diff --git a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h index b09fd7115ebe65..fe0adae88f4a5e 100644 --- a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h +++ b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h @@ -15,6 +15,8 @@ NS_ASSUME_NONNULL_BEGIN NSString *const RCTAttributedStringIsHighlightedAttributeName = @"IsHighlighted"; NSString *const RCTAttributedStringEventEmitterKey = @"EventEmitter"; + +// String representation of either `role` or `accessibilityRole` NSString *const RCTTextAttributesAccessibilityRoleAttributeName = @"AccessibilityRole"; /* diff --git a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm index 68388d1c839880..7db4677a329f4f 100644 --- a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +++ b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm @@ -7,6 +7,7 @@ #import "RCTAttributedTextUtils.h" +#include #include #include #include @@ -288,130 +289,12 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex attributes[RCTAttributedStringIsHighlightedAttributeName] = @YES; } - if (textAttributes.accessibilityRole.has_value()) { - auto accessibilityRole = textAttributes.accessibilityRole.value(); - switch (accessibilityRole) { - case AccessibilityRole::None: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("none"); - break; - case AccessibilityRole::Button: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("button"); - break; - case AccessibilityRole::Dropdownlist: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("dropdownlist"); - break; - case AccessibilityRole::Togglebutton: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("togglebutton"); - break; - case AccessibilityRole::Link: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("link"); - break; - case AccessibilityRole::Search: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("search"); - break; - case AccessibilityRole::Image: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("image"); - break; - case AccessibilityRole::Keyboardkey: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("keyboardkey"); - break; - case AccessibilityRole::Text: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("text"); - break; - case AccessibilityRole::Adjustable: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("adjustable"); - break; - case AccessibilityRole::Imagebutton: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("imagebutton"); - break; - case AccessibilityRole::Header: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("header"); - break; - case AccessibilityRole::Summary: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("summary"); - break; - case AccessibilityRole::Alert: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("alert"); - break; - case AccessibilityRole::Checkbox: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("checkbox"); - break; - case AccessibilityRole::Combobox: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("combobox"); - break; - case AccessibilityRole::Menu: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("menu"); - break; - case AccessibilityRole::Menubar: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("menubar"); - break; - case AccessibilityRole::Menuitem: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("menuitem"); - break; - case AccessibilityRole::Progressbar: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("progressbar"); - break; - case AccessibilityRole::Radio: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("radio"); - break; - case AccessibilityRole::Radiogroup: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("radiogroup"); - break; - case AccessibilityRole::Scrollbar: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("scrollbar"); - break; - case AccessibilityRole::Spinbutton: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("spinbutton"); - break; - case AccessibilityRole::Switch: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("switch"); - break; - case AccessibilityRole::Tab: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("tab"); - break; - case AccessibilityRole::Tabbar: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("tabbar"); - break; - case AccessibilityRole::Tablist: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("tablist"); - break; - case AccessibilityRole::Timer: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("timer"); - break; - case AccessibilityRole::List: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("list"); - break; - case AccessibilityRole::Toolbar: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("toolbar"); - break; - case AccessibilityRole::Grid: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("grid"); - break; - case AccessibilityRole::Pager: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("pager"); - break; - case AccessibilityRole::Scrollview: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("scrollview"); - break; - case AccessibilityRole::Horizontalscrollview: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("horizontalscrollview"); - break; - case AccessibilityRole::Viewgroup: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("viewgroup"); - break; - case AccessibilityRole::Webview: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("webview"); - break; - case AccessibilityRole::Drawerlayout: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("drawerlayout"); - break; - case AccessibilityRole::Slidingdrawer: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("slidingdrawer"); - break; - case AccessibilityRole::Iconmenu: - attributes[RCTTextAttributesAccessibilityRoleAttributeName] = @("iconmenu"); - break; - }; + if (textAttributes.role.has_value()) { + std::string roleStr = toString(textAttributes.role.value()); + attributes[RCTTextAttributesAccessibilityRoleAttributeName] = [NSString stringWithCString:roleStr.c_str()]; + } else if (textAttributes.accessibilityRole.has_value()) { + std::string roleStr = toString(textAttributes.accessibilityRole.value()); + attributes[RCTTextAttributesAccessibilityRoleAttributeName] = [NSString stringWithCString:roleStr.c_str()]; } return [attributes copy];