react-native-windows 0.75.4 → 0.76.0-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.flowconfig +6 -4
- package/Directory.Build.props +4 -0
- package/Directory.Build.targets +5 -0
- package/Libraries/Alert/Alert.js +3 -0
- package/Libraries/Alert/Alert.windows.js +3 -0
- package/Libraries/Animated/AnimatedEvent.js +1 -1
- package/Libraries/Animated/AnimatedImplementation.js +7 -7
- package/Libraries/Animated/NativeAnimatedAllowlist.js +111 -0
- package/Libraries/Animated/animations/Animation.js +11 -1
- package/Libraries/Animated/animations/DecayAnimation.js +1 -1
- package/Libraries/Animated/animations/SpringAnimation.js +1 -1
- package/Libraries/Animated/animations/TimingAnimation.js +2 -1
- package/Libraries/Animated/components/AnimatedScrollView.js +3 -2
- package/Libraries/Animated/createAnimatedComponent.js +10 -9
- package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +3 -2
- package/Libraries/Animated/nodes/AnimatedNode.js +42 -33
- package/Libraries/Animated/nodes/AnimatedObject.js +56 -50
- package/Libraries/Animated/nodes/AnimatedProps.js +77 -40
- package/Libraries/Animated/nodes/AnimatedStyle.js +103 -59
- package/Libraries/Animated/nodes/AnimatedTracking.js +1 -1
- package/Libraries/Animated/nodes/AnimatedTransform.js +102 -67
- package/Libraries/Animated/nodes/AnimatedValue.js +2 -1
- package/Libraries/Animated/nodes/AnimatedWithChildren.js +21 -22
- package/Libraries/Animated/useAnimatedProps.js +142 -7
- package/Libraries/BatchedBridge/NativeModules.js +2 -0
- package/Libraries/Blob/FileReader.js +1 -1
- package/Libraries/Blob/URL.js +2 -62
- package/Libraries/Blob/URLSearchParams.js +71 -0
- package/Libraries/Components/Button.windows.js +0 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -1
- package/Libraries/Components/Keyboard/KeyboardExt.js.map +1 -1
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +1 -1
- package/Libraries/Components/ScrollView/ScrollView.js +131 -169
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.js +3 -1
- package/Libraries/Components/TextInput/TextInput.d.ts +32 -2
- package/Libraries/Components/TextInput/TextInput.js +230 -94
- package/Libraries/Components/TextInput/TextInput.windows.js +230 -105
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +22 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.js +2 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.windows.js +2 -0
- package/Libraries/Components/View/View.windows.js +32 -30
- package/Libraries/Components/View/ViewAccessibility.d.ts +15 -0
- package/Libraries/Components/View/ViewNativeComponent.js +0 -1
- package/Libraries/Components/View/ViewPropTypes.js +14 -0
- package/Libraries/Components/View/ViewPropTypes.windows.js +14 -0
- package/Libraries/Core/ExceptionsManager.js +2 -0
- package/Libraries/Core/InitializeCore.js +3 -1
- package/Libraries/Core/ReactFiberErrorDialog.js +3 -0
- package/Libraries/Core/ReactNativeVersion.js +4 -4
- package/Libraries/Core/setUpErrorHandling.js +7 -1
- package/Libraries/Core/setUpGlobals.js +1 -0
- package/Libraries/Core/setUpReactRefresh.js +0 -4
- package/Libraries/Image/AssetSourceResolver.js +28 -1
- package/Libraries/Image/AssetSourceResolver.windows.js +28 -1
- package/Libraries/Image/Image.android.js +9 -14
- package/Libraries/Image/Image.ios.js +11 -22
- package/Libraries/Image/Image.windows.js +11 -22
- package/Libraries/Image/ImageBackground.js +1 -8
- package/Libraries/Image/ImageUtils.js +9 -9
- package/Libraries/Image/ImageViewNativeComponent.js +1 -0
- package/Libraries/Inspector/Inspector.js +3 -2
- package/Libraries/Inspector/InspectorPanel.js +16 -10
- package/Libraries/Inspector/NetworkOverlay.js +1 -1
- package/Libraries/Interaction/TaskQueue.js +1 -0
- package/Libraries/Lists/FlatList.js +1 -1
- package/Libraries/Lists/SectionList.js +2 -2
- package/Libraries/Lists/SectionListModern.js +3 -3
- package/Libraries/LogBox/Data/LogBoxData.js +24 -3
- package/Libraries/LogBox/LogBoxNotificationContainer.js +3 -2
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +9 -8
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.windows.js +9 -8
- package/Libraries/Modal/Modal.js +0 -1
- package/Libraries/NativeComponent/BaseViewConfig.android.js +8 -0
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +7 -0
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +7 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +22 -22
- package/Libraries/NativeComponent/StaticViewConfigValidator.js +0 -21
- package/Libraries/Network/XMLHttpRequest.js +4 -2
- package/Libraries/ReactNative/AppContainer-dev.js +1 -5
- package/Libraries/ReactNative/AppContainer-prod.js +1 -5
- package/Libraries/ReactNative/AppContainer.js +1 -2
- package/Libraries/ReactNative/AppRegistry.d.ts +0 -4
- package/Libraries/ReactNative/AppRegistry.js +1 -7
- package/Libraries/ReactNative/BridgelessUIManager.js +1 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +1 -1
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +5 -5
- package/Libraries/ReactNative/RendererImplementation.js +26 -4
- package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -0
- package/Libraries/ReactNative/renderApplication.js +1 -3
- package/Libraries/Renderer/shims/ReactNativeTypes.js +11 -4
- package/Libraries/StyleSheet/StyleSheet.js +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +57 -0
- package/Libraries/StyleSheet/StyleSheetTypes.js +60 -5
- package/Libraries/StyleSheet/processBackgroundImage.js +384 -0
- package/Libraries/StyleSheet/processBoxShadow.js +211 -0
- package/Libraries/StyleSheet/processFilter.js +231 -42
- package/Libraries/Text/Text.js +394 -196
- package/Libraries/Text/Text.windows.js +476 -300
- package/Libraries/Text/TextNativeComponent.js +2 -1
- package/Libraries/TurboModule/TurboModuleRegistry.js +13 -50
- package/Libraries/Types/CodegenTypes.js +3 -1
- package/Libraries/Utilities/Appearance.js +108 -84
- package/Libraries/Utilities/DevLoadingView.js +2 -4
- package/Libraries/Utilities/HMRClient.js +2 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
- package/Libraries/Utilities/createPerformanceLogger.js +0 -9
- package/Libraries/Utilities/stringifyViewConfig.js +22 -0
- package/Libraries/Utilities/useColorScheme.js +3 -3
- package/Libraries/WebSocket/WebSocket.js +1 -1
- package/Libraries/promiseRejectionTrackingOptions.js +1 -1
- package/Libraries/vendor/emitter/EventEmitter.js +6 -5
- package/Microsoft.ReactNative/ComponentView.idl +11 -0
- package/Microsoft.ReactNative/Composition.Input.idl +1 -0
- package/Microsoft.ReactNative/CompositionSwitcher.idl +3 -0
- package/Microsoft.ReactNative/Fabric/AbiComponentDescriptor.cpp +9 -9
- package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.cpp +9 -9
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +7 -9
- package/Microsoft.ReactNative/Fabric/ComponentView.h +5 -6
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +1 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +44 -13
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +42 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +1 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +81 -63
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +2 -3
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +8 -6
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.cpp +20 -6
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.h +13 -6
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +2 -3
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +72 -54
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +14 -4
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +26 -8
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +5 -2
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +18 -7
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +6 -6
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +97 -140
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +8 -4
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +18 -11
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +5 -4
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +0 -13
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h +0 -3
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +29 -4
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +28 -12
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/HostPlatformColor.h +33 -0
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp +26 -9
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.h +10 -4
- package/Microsoft.ReactNative/IReactModuleBuilder.cpp +5 -0
- package/Microsoft.ReactNative/IReactModuleBuilder.h +1 -0
- package/Microsoft.ReactNative/IReactModuleBuilder.idl +9 -0
- package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +8 -1
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +2 -0
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +3 -1
- package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/AppearanceModule.h +7 -1
- package/Microsoft.ReactNative/Modules/DevSettingsModule.cpp +3 -3
- package/Microsoft.ReactNative/Modules/DevSettingsModule.h +1 -1
- package/Microsoft.ReactNative/Modules/LinkingManagerModule.cpp +2 -2
- package/Microsoft.ReactNative/Modules/LinkingManagerModule.h +1 -1
- package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +9 -0
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -0
- package/Microsoft.ReactNative/Modules/SampleTurboModule.cpp +121 -0
- package/Microsoft.ReactNative/Modules/SampleTurboModule.h +90 -0
- package/Microsoft.ReactNative/ReactHost/MsoReactContext.cpp +0 -7
- package/Microsoft.ReactNative/ReactHost/MsoReactContext.h +0 -5
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +5 -1
- package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.cpp +59 -0
- package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.h +23 -0
- package/Microsoft.ReactNative/ReactNativeAppBuilder.cpp +179 -0
- package/Microsoft.ReactNative/ReactNativeAppBuilder.h +35 -0
- package/Microsoft.ReactNative/ReactNativeAppBuilder.idl +69 -0
- package/Microsoft.ReactNative/ReactNativeIsland.idl +2 -0
- package/Microsoft.ReactNative/ReactNativeWin32App.cpp +82 -0
- package/Microsoft.ReactNative/ReactNativeWin32App.h +38 -0
- package/Microsoft.ReactNative/TurboModulesProvider.cpp +45 -0
- package/Microsoft.ReactNative/Views/DynamicAutomationPeer.cpp +2 -1
- package/Microsoft.ReactNative/Views/FlyoutViewManager.cpp +25 -16
- package/Microsoft.ReactNative/packages.fabric.lock.json +159 -0
- package/Microsoft.ReactNative/packages.lock.json +11 -12
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +3 -4
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +3 -0
- package/Microsoft.ReactNative.Cxx/ModuleRegistration.cpp +2 -2
- package/Microsoft.ReactNative.Cxx/ModuleRegistration.h +62 -4
- package/Microsoft.ReactNative.Cxx/NativeModules.h +131 -14
- package/Microsoft.ReactNative.Managed/packages.lock.json +9 -9
- package/Microsoft.ReactNative.Managed.CodeGen/ReactNativeNames.cs +10 -2
- package/PropertySheets/Autolink.props +1 -1
- package/PropertySheets/Bundle.props +1 -1
- package/PropertySheets/Codegen.props +1 -1
- package/PropertySheets/Generated/PackageVersion.g.props +4 -4
- package/PropertySheets/NuGet.LockFile.props +18 -0
- package/README.md +29 -29
- package/ReactCommon/ReactCommon.vcxproj +5 -1
- package/ReactCommon/ReactCommon.vcxproj.filters +11 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +2 -7
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.cpp +441 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.h +266 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/Utf8.h +56 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/Base.h +3 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/Bridging.h +2 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/CallbackWrapper.h +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/Convert.h +172 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/EventEmitter.h +4 -5
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/Function.h +2 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModuleUtils.h +3 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/scrollview/ScrollViewProps.cpp +9 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/LayoutableShadowNode.cpp +363 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/JSRuntimeFactory.h +22 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +118 -51
- package/ReactCommon/packages.lock.json +2 -2
- package/Scripts/NuGetRestoreForceEvaluateAllSolutions.ps1 +8 -1
- package/Scripts/Tfs/Layout-MSRN-Headers.ps1 +2 -2
- package/Shared/Modules/WebSocketModule.cpp +1 -2
- package/Shared/Networking/WinRTWebSocketResource.cpp +4 -1
- package/Shared/Shared.vcxitems +38 -2
- package/Shared/Shared.vcxitems.filters +6 -1
- package/Shared/TurboModuleManager.cpp +0 -3
- package/codegen/NativeLinkingManagerSpec.g.h +3 -3
- package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +198 -54
- package/codegen/NativeSampleTurboModuleSpec.g.h +35 -0
- package/codegen/rnwcoreJSI-generated.cpp +245 -101
- package/codegen/rnwcoreJSI.h +847 -548
- package/index.js +3 -1
- package/index.windows.js +3 -1
- package/jest/mockComponent.js +4 -1
- package/jest/mockModal.js +1 -3
- package/jest/mockScrollView.js +1 -1
- package/jest/renderer.js +2 -2
- package/jest/setup.js +16 -13
- package/package.json +29 -29
- package/src/private/animated/NativeAnimatedHelper.js +438 -0
- package/src/private/animated/NativeAnimatedValidation.js +64 -0
- package/src/private/components/HScrollViewNativeComponents.js +56 -0
- package/src/private/components/SafeAreaView_INTERNAL_DO_NOT_USE.js +27 -0
- package/src/private/components/VScrollViewNativeComponents.js +48 -0
- package/src/private/components/useSyncOnScroll.js +48 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +166 -16
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +29 -5
- package/src/private/fusebox/FuseboxSessionObserver.js +42 -0
- package/{Libraries/Core → src/private/renderer/errorhandling}/ErrorHandlers.js +14 -4
- package/src/private/setup/setUpDOM.js +28 -0
- package/src/private/setup/setUpIntersectionObserver.js +27 -0
- package/src/private/setup/setUpMutationObserver.js +26 -0
- package/src/private/setup/setUpPerformanceObserver.js +64 -0
- package/src/private/specs/modules/NativeAppearance.js +3 -3
- package/src/private/specs/modules/NativeLinkingManager.js +1 -1
- package/src/private/specs/modules/NativePlatformConstantsWindows.js +7 -0
- package/src/private/specs/modules/NativeSampleTurboModule.js +14 -1
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +6 -4
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserver.js +5 -3
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverEntry.js +3 -3
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver}/IntersectionObserverManager.js +14 -17
- package/src/private/{specs/modules → webapis/intersectionobserver/specs}/NativeIntersectionObserver.js +2 -2
- package/{Libraries/IntersectionObserver → src/private/webapis/intersectionobserver/specs}/__mocks__/NativeIntersectionObserver.js +4 -4
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserver.js +5 -3
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationObserverManager.js +24 -15
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver}/MutationRecord.js +4 -6
- package/src/private/{specs/modules → webapis/mutationobserver/specs}/NativeMutationObserver.js +2 -2
- package/{Libraries/MutationObserver → src/private/webapis/mutationobserver/specs}/__mocks__/NativeMutationObserver.js +5 -5
- package/src/private/webapis/performance/{EventCounts.js → EventTiming.js} +65 -3
- package/src/private/webapis/performance/LongTasks.js +39 -0
- package/src/private/webapis/performance/Performance.js +22 -9
- package/src/private/webapis/performance/PerformanceEntry.js +36 -18
- package/src/private/webapis/performance/PerformanceObserver.js +29 -43
- package/src/private/webapis/performance/RawPerformanceEntry.js +24 -1
- package/src/private/webapis/performance/UserTiming.js +17 -12
- package/src/private/webapis/performance/specs/NativePerformanceObserver.js +1 -1
- package/template/cpp-app/src/AutolinkedNativeModules.g.cpp +1 -1
- package/template/cpp-app/src/AutolinkedNativeModules.g.h +1 -1
- package/template/cs-app/src/AutolinkedNativeModules.g.cs +1 -1
- package/template/index.windows.bundle +1 -1
- package/template/metro.config.js +2 -2
- package/template/shared-app/src/AutolinkedNativeModules.g.props +1 -1
- package/template/shared-app/src/AutolinkedNativeModules.g.targets +1 -1
- package/templates/cpp-app/metro.config.js +2 -2
- package/templates/cpp-app/template.config.js +5 -5
- package/templates/cpp-app/windows/MyApp/AutolinkedNativeModules.g.cpp +1 -1
- package/templates/cpp-app/windows/MyApp/AutolinkedNativeModules.g.h +1 -1
- package/templates/cpp-app/windows/MyApp/MyApp.cpp +2 -0
- package/templates/cpp-app/windows/MyApp/MyApp.vcxproj +1 -1
- package/templates/cpp-lib/example/metro.config.js +2 -2
- package/templates/cpp-lib/template.config.js +3 -3
- package/templates/cpp-lib/windows/MyLib/MyLib.h +3 -3
- package/templates/cpp-lib/windows/MyLib/MyLib.vcxproj +1 -1
- package/types/experimental.d.ts +20 -1
- package/Libraries/Animated/NativeAnimatedHelper.js +0 -615
- package/Libraries/Core/setUpIntersectionObserver.js +0 -16
- package/Libraries/Core/setUpMutationObserver.js +0 -16
- package/Libraries/Core/setUpPerformanceObserver.js +0 -18
- package/Libraries/IntersectionObserver/NativeIntersectionObserver.js +0 -13
- package/Libraries/MutationObserver/NativeMutationObserver.js +0 -13
- package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +0 -135
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/algorithm/CalculateLayout.cpp +0 -2396
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/config/Config.cpp +0 -136
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/config/Config.h +0 -92
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/LayoutResults.cpp +0 -48
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/LayoutResults.h +0 -122
- package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/Node.cpp +0 -388
- package/src/private/core/setUpDOM.js +0 -18
- package/src/private/webapis/performance/PerformanceEventTiming.js +0 -55
- /package/src/private/{core → styles}/composeStyles.js +0 -0
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#include "LayoutableShadowNode.h"
|
|
9
|
+
|
|
10
|
+
#include <react/renderer/core/LayoutConstraints.h>
|
|
11
|
+
#include <react/renderer/core/LayoutContext.h>
|
|
12
|
+
#include <react/renderer/core/LayoutMetrics.h>
|
|
13
|
+
#include <react/renderer/core/ShadowNode.h>
|
|
14
|
+
#include <react/renderer/core/graphicsConversions.h>
|
|
15
|
+
#include <react/renderer/debug/DebugStringConvertibleItem.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
template <class T>
|
|
20
|
+
using LayoutableSmallVector = std::vector<T>;
|
|
21
|
+
|
|
22
|
+
LayoutableShadowNode::LayoutableShadowNode(
|
|
23
|
+
const ShadowNodeFragment& fragment,
|
|
24
|
+
const ShadowNodeFamily::Shared& family,
|
|
25
|
+
ShadowNodeTraits traits)
|
|
26
|
+
: ShadowNode(fragment, family, traits), layoutMetrics_({}) {}
|
|
27
|
+
|
|
28
|
+
LayoutableShadowNode::LayoutableShadowNode(
|
|
29
|
+
const ShadowNode& sourceShadowNode,
|
|
30
|
+
const ShadowNodeFragment& fragment)
|
|
31
|
+
: ShadowNode(sourceShadowNode, fragment),
|
|
32
|
+
layoutMetrics_(static_cast<const LayoutableShadowNode&>(sourceShadowNode)
|
|
33
|
+
.layoutMetrics_) {}
|
|
34
|
+
|
|
35
|
+
LayoutMetrics LayoutableShadowNode::computeRelativeLayoutMetrics(
|
|
36
|
+
const ShadowNodeFamily& descendantNodeFamily,
|
|
37
|
+
const LayoutableShadowNode& ancestorNode,
|
|
38
|
+
LayoutInspectingPolicy policy) {
|
|
39
|
+
// Prelude.
|
|
40
|
+
|
|
41
|
+
if (&descendantNodeFamily == &ancestorNode.getFamily()) {
|
|
42
|
+
// Layout metrics of a node computed relatively to the same node are equal
|
|
43
|
+
// to `transform`-ed layout metrics of the node with zero `origin`.
|
|
44
|
+
auto layoutMetrics = ancestorNode.getLayoutMetrics();
|
|
45
|
+
if (layoutMetrics.displayType == DisplayType::None) {
|
|
46
|
+
return EmptyLayoutMetrics;
|
|
47
|
+
}
|
|
48
|
+
if (policy.includeTransform) {
|
|
49
|
+
layoutMetrics.frame = layoutMetrics.frame * ancestorNode.getTransform();
|
|
50
|
+
}
|
|
51
|
+
layoutMetrics.frame.origin = {0, 0};
|
|
52
|
+
return layoutMetrics;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
auto ancestors = descendantNodeFamily.getAncestors(ancestorNode);
|
|
56
|
+
return computeRelativeLayoutMetrics(ancestors, policy);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
LayoutMetrics LayoutableShadowNode::computeRelativeLayoutMetrics(
|
|
60
|
+
const AncestorList& ancestors,
|
|
61
|
+
LayoutInspectingPolicy policy) {
|
|
62
|
+
if (ancestors.empty()) {
|
|
63
|
+
// Specified nodes do not form an ancestor-descender relationship
|
|
64
|
+
// in the same tree. Aborting.
|
|
65
|
+
return EmptyLayoutMetrics;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ------------------------------
|
|
69
|
+
|
|
70
|
+
// Step 1.
|
|
71
|
+
// Creating a list of nodes that form a chain from the descender node to
|
|
72
|
+
// ancestor node inclusively.
|
|
73
|
+
auto shadowNodeList = LayoutableSmallVector<const ShadowNode*>{};
|
|
74
|
+
|
|
75
|
+
// Finding the measured node.
|
|
76
|
+
// The last element in the `AncestorList` is a pair of a parent of the node
|
|
77
|
+
// and an index of this node in the parent's children list.
|
|
78
|
+
auto& pair = ancestors.at(ancestors.size() - 1);
|
|
79
|
+
auto descendantNode = pair.first.get().getChildren().at(pair.second).get();
|
|
80
|
+
|
|
81
|
+
// Putting the node inside the list.
|
|
82
|
+
// Even if this is a node with a `RootNodeKind` trait, we don't treat it as
|
|
83
|
+
// root because we measure it from an outside tree perspective.
|
|
84
|
+
shadowNodeList.push_back(descendantNode);
|
|
85
|
+
|
|
86
|
+
for (auto it = ancestors.rbegin(); it != ancestors.rend(); it++) {
|
|
87
|
+
auto& shadowNode = it->first.get();
|
|
88
|
+
|
|
89
|
+
shadowNodeList.push_back(&shadowNode);
|
|
90
|
+
|
|
91
|
+
if (shadowNode.getTraits().check(ShadowNodeTraits::Trait::RootNodeKind)) {
|
|
92
|
+
// If this is a node with a `RootNodeKind` trait, we need to stop right
|
|
93
|
+
// there.
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ------------------------------
|
|
99
|
+
|
|
100
|
+
// Step 2.
|
|
101
|
+
// Computing the initial size of the measured node.
|
|
102
|
+
auto descendantLayoutableNode =
|
|
103
|
+
dynamic_cast<const LayoutableShadowNode*>(descendantNode);
|
|
104
|
+
|
|
105
|
+
if (descendantLayoutableNode == nullptr) {
|
|
106
|
+
return EmptyLayoutMetrics;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
auto layoutMetrics = descendantLayoutableNode->getLayoutMetrics();
|
|
110
|
+
auto& resultFrame = layoutMetrics.frame;
|
|
111
|
+
resultFrame.origin = {0, 0};
|
|
112
|
+
|
|
113
|
+
// Step 3.
|
|
114
|
+
// Iterating on a list of nodes computing compound offset and size.
|
|
115
|
+
auto size = shadowNodeList.size();
|
|
116
|
+
for (size_t i = 0; i < size; i++) {
|
|
117
|
+
auto currentShadowNode =
|
|
118
|
+
dynamic_cast<const LayoutableShadowNode*>(shadowNodeList.at(i));
|
|
119
|
+
|
|
120
|
+
if (currentShadowNode == nullptr) {
|
|
121
|
+
return EmptyLayoutMetrics;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Descendants of display: none don't have relative layout metrics.
|
|
125
|
+
if (currentShadowNode->getLayoutMetrics().displayType ==
|
|
126
|
+
DisplayType::None) {
|
|
127
|
+
return EmptyLayoutMetrics;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
auto currentFrame = currentShadowNode->getLayoutMetrics().frame;
|
|
131
|
+
if (i == size - 1) {
|
|
132
|
+
// If it's the last element, its origin is irrelevant.
|
|
133
|
+
currentFrame.origin = {0, 0};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
auto isRootNode = currentShadowNode->getTraits().check(
|
|
137
|
+
ShadowNodeTraits::Trait::RootNodeKind);
|
|
138
|
+
|
|
139
|
+
auto shouldApplyTransformation = (policy.includeTransform && !isRootNode) ||
|
|
140
|
+
(policy.includeViewportOffset && isRootNode);
|
|
141
|
+
|
|
142
|
+
// Move frame to the coordinate space of the current node.
|
|
143
|
+
resultFrame.origin += currentFrame.origin;
|
|
144
|
+
|
|
145
|
+
if (shouldApplyTransformation) {
|
|
146
|
+
// If a node has a transform, we need to use the center of that node as
|
|
147
|
+
// the origin of the transform when transforming its children (which
|
|
148
|
+
// affects the result of transforms like `scale` and `rotate`).
|
|
149
|
+
resultFrame = currentShadowNode->getTransform().applyWithCenter(
|
|
150
|
+
resultFrame, currentFrame.getCenter());
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (i != 0 && policy.includeTransform) {
|
|
154
|
+
// Transformation is not applied here and instead we delegated out in
|
|
155
|
+
// getContentOriginOffset. The reason is that for `ScrollViewShadowNode`,
|
|
156
|
+
// we need to consider `scrollAwayPaddingTop` which should NOT be included
|
|
157
|
+
// in the transform.
|
|
158
|
+
resultFrame.origin += currentShadowNode->getContentOriginOffset(true);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (policy.enableOverflowClipping) {
|
|
162
|
+
auto overflowInset = currentShadowNode->getLayoutMetrics().overflowInset;
|
|
163
|
+
auto overflowRect = insetBy(
|
|
164
|
+
currentFrame * currentShadowNode->getTransform(), overflowInset);
|
|
165
|
+
resultFrame = Rect::intersect(resultFrame, overflowRect);
|
|
166
|
+
if (resultFrame.size.width == 0 && resultFrame.size.height == 0) {
|
|
167
|
+
return EmptyLayoutMetrics;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// ------------------------------
|
|
173
|
+
|
|
174
|
+
return layoutMetrics;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
LayoutMetrics LayoutableShadowNode::getLayoutMetrics() const {
|
|
178
|
+
return layoutMetrics_;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
void LayoutableShadowNode::setLayoutMetrics(LayoutMetrics layoutMetrics) {
|
|
182
|
+
ensureUnsealed();
|
|
183
|
+
|
|
184
|
+
if (layoutMetrics_ == layoutMetrics) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
layoutMetrics_ = layoutMetrics;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
Transform LayoutableShadowNode::getTransform() const {
|
|
192
|
+
return Transform::Identity();
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
Point LayoutableShadowNode::getContentOriginOffset(
|
|
196
|
+
bool /*includeTransform*/) const {
|
|
197
|
+
return {0, 0};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
bool LayoutableShadowNode::canBeTouchTarget() const {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
bool LayoutableShadowNode::canChildrenBeTouchTarget() const {
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
LayoutableShadowNode::UnsharedList
|
|
209
|
+
LayoutableShadowNode::getLayoutableChildNodes() const {
|
|
210
|
+
LayoutableShadowNode::UnsharedList layoutableChildren;
|
|
211
|
+
for (const auto& childShadowNode : getChildren()) {
|
|
212
|
+
auto layoutableChildShadowNode =
|
|
213
|
+
dynamic_cast<const LayoutableShadowNode*>(childShadowNode.get());
|
|
214
|
+
if (layoutableChildShadowNode != nullptr) {
|
|
215
|
+
layoutableChildren.push_back(
|
|
216
|
+
const_cast<LayoutableShadowNode*>(layoutableChildShadowNode));
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return layoutableChildren;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
Size LayoutableShadowNode::measureContent(
|
|
223
|
+
const LayoutContext& /*layoutContext*/,
|
|
224
|
+
const LayoutConstraints& /*layoutConstraints*/) const {
|
|
225
|
+
return {};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
Size LayoutableShadowNode::measure(
|
|
229
|
+
const LayoutContext& layoutContext,
|
|
230
|
+
const LayoutConstraints& layoutConstraints) const {
|
|
231
|
+
auto clonedShadowNode = clone({});
|
|
232
|
+
auto& layoutableShadowNode =
|
|
233
|
+
static_cast<LayoutableShadowNode&>(*clonedShadowNode);
|
|
234
|
+
|
|
235
|
+
auto localLayoutContext = layoutContext;
|
|
236
|
+
localLayoutContext.affectedNodes = nullptr;
|
|
237
|
+
|
|
238
|
+
layoutableShadowNode.layoutTree(localLayoutContext, layoutConstraints);
|
|
239
|
+
|
|
240
|
+
return layoutableShadowNode.getLayoutMetrics().frame.size;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
Float LayoutableShadowNode::baseline(
|
|
244
|
+
const LayoutContext& /*layoutContext*/,
|
|
245
|
+
Size /*size*/) const {
|
|
246
|
+
return 0;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
ShadowNode::Shared LayoutableShadowNode::findNodeAtPoint(
|
|
250
|
+
const ShadowNode::Shared& node,
|
|
251
|
+
Point point) {
|
|
252
|
+
auto layoutableShadowNode =
|
|
253
|
+
dynamic_cast<const LayoutableShadowNode*>(node.get());
|
|
254
|
+
|
|
255
|
+
if (layoutableShadowNode == nullptr) {
|
|
256
|
+
return nullptr;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (!layoutableShadowNode->canBeTouchTarget() &&
|
|
260
|
+
!layoutableShadowNode->canChildrenBeTouchTarget()) {
|
|
261
|
+
return nullptr;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
auto transform = layoutableShadowNode->getTransform();
|
|
265
|
+
auto frame = layoutableShadowNode->getLayoutMetrics().frame;
|
|
266
|
+
auto transformedFrame = frame * transform;
|
|
267
|
+
auto isPointInside = transformedFrame.containsPoint(point);
|
|
268
|
+
|
|
269
|
+
if (!isPointInside) {
|
|
270
|
+
return nullptr;
|
|
271
|
+
} else if (!layoutableShadowNode->canChildrenBeTouchTarget()) {
|
|
272
|
+
return node;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
if (Transform::isVerticalInversion(transform) ||
|
|
276
|
+
Transform::isHorizontalInversion(transform)) {
|
|
277
|
+
auto centerX =
|
|
278
|
+
transformedFrame.origin.x + transformedFrame.size.width / 2.0;
|
|
279
|
+
auto centerY =
|
|
280
|
+
transformedFrame.origin.y + transformedFrame.size.height / 2.0;
|
|
281
|
+
|
|
282
|
+
// [Windows - #13644
|
|
283
|
+
auto relativeX = point.x - centerX;
|
|
284
|
+
auto relativeY = point.y - centerY;
|
|
285
|
+
// Windows]
|
|
286
|
+
|
|
287
|
+
if (Transform::isVerticalInversion(transform)) {
|
|
288
|
+
relativeY = -relativeY;
|
|
289
|
+
}
|
|
290
|
+
if (Transform::isHorizontalInversion(transform)) {
|
|
291
|
+
relativeX = -relativeX;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// [Windows - #13644
|
|
295
|
+
point.x = float(centerX + relativeX);
|
|
296
|
+
point.y = float(centerY + relativeY);
|
|
297
|
+
// Windows]
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
auto newPoint = point - transformedFrame.origin -
|
|
301
|
+
layoutableShadowNode->getContentOriginOffset(false);
|
|
302
|
+
|
|
303
|
+
auto sortedChildren = node->getChildren();
|
|
304
|
+
std::stable_sort(
|
|
305
|
+
sortedChildren.begin(),
|
|
306
|
+
sortedChildren.end(),
|
|
307
|
+
[](const auto& lhs, const auto& rhs) -> bool {
|
|
308
|
+
return lhs->getOrderIndex() < rhs->getOrderIndex();
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
for (auto it = sortedChildren.rbegin(); it != sortedChildren.rend(); it++) {
|
|
312
|
+
const auto& childShadowNode = *it;
|
|
313
|
+
auto hitView = findNodeAtPoint(childShadowNode, newPoint);
|
|
314
|
+
if (hitView) {
|
|
315
|
+
return hitView;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return layoutableShadowNode->canBeTouchTarget() ? node : nullptr;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
#if RN_DEBUG_STRING_CONVERTIBLE
|
|
322
|
+
SharedDebugStringConvertibleList LayoutableShadowNode::getDebugProps() const {
|
|
323
|
+
auto list = ShadowNode::getDebugProps();
|
|
324
|
+
|
|
325
|
+
auto layoutInfo = SharedDebugStringConvertibleList{};
|
|
326
|
+
|
|
327
|
+
if (!getIsLayoutClean()) {
|
|
328
|
+
layoutInfo.push_back(std::make_shared<DebugStringConvertibleItem>("dirty"));
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
auto layoutMetrics = getLayoutMetrics();
|
|
332
|
+
auto defaultLayoutMetrics = LayoutMetrics();
|
|
333
|
+
|
|
334
|
+
layoutInfo.push_back(std::make_shared<DebugStringConvertibleItem>(
|
|
335
|
+
"frame", toString(layoutMetrics.frame)));
|
|
336
|
+
|
|
337
|
+
if (layoutMetrics.borderWidth != defaultLayoutMetrics.borderWidth) {
|
|
338
|
+
layoutInfo.push_back(std::make_shared<DebugStringConvertibleItem>(
|
|
339
|
+
"borderWidth", toString(layoutMetrics.borderWidth)));
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
if (layoutMetrics.contentInsets != defaultLayoutMetrics.contentInsets) {
|
|
343
|
+
layoutInfo.push_back(std::make_shared<DebugStringConvertibleItem>(
|
|
344
|
+
"contentInsets", toString(layoutMetrics.contentInsets)));
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (layoutMetrics.displayType == DisplayType::None) {
|
|
348
|
+
layoutInfo.push_back(
|
|
349
|
+
std::make_shared<DebugStringConvertibleItem>("hidden"));
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
if (layoutMetrics.layoutDirection == LayoutDirection::RightToLeft) {
|
|
353
|
+
layoutInfo.push_back(std::make_shared<DebugStringConvertibleItem>("rtl"));
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
list.push_back(
|
|
357
|
+
std::make_shared<DebugStringConvertibleItem>("layout", "", layoutInfo));
|
|
358
|
+
|
|
359
|
+
return list;
|
|
360
|
+
}
|
|
361
|
+
#endif
|
|
362
|
+
|
|
363
|
+
} // namespace facebook::react
|
|
@@ -25,8 +25,28 @@ class JSRuntime : public jsinspector_modern::RuntimeTargetDelegate {
|
|
|
25
25
|
|
|
26
26
|
virtual ~JSRuntime() = default;
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Get a reference to the \c RuntimeTargetDelegate owned (or implemented) by
|
|
30
|
+
* this JSRuntime. This reference must remain valid for the duration of the
|
|
31
|
+
* JSRuntime's lifetime.
|
|
32
|
+
*/
|
|
33
|
+
// virtual jsinspector_modern::RuntimeTargetDelegate& getRuntimeTargetDelegate();
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Run initialize work that must happen on the runtime's JS thread. Used for
|
|
37
|
+
* initializing TLS and registering profiling.
|
|
38
|
+
*
|
|
39
|
+
* TODO T194671568 Move the runtime constructor to the JsThread
|
|
40
|
+
*/
|
|
41
|
+
virtual void unstable_initializeOnJsThread() {}
|
|
42
|
+
|
|
43
|
+
private:
|
|
44
|
+
/**
|
|
45
|
+
* Initialized by \c getRuntimeTargetDelegate if not overridden, and then
|
|
46
|
+
* never changes.
|
|
47
|
+
*/
|
|
48
|
+
std::optional<jsinspector_modern::FallbackRuntimeTargetDelegate>
|
|
49
|
+
runtimeTargetDelegate_;
|
|
30
50
|
};
|
|
31
51
|
|
|
32
52
|
/**
|
|
@@ -43,44 +43,50 @@ ReactInstance::ReactInstance(
|
|
|
43
43
|
std::weak_ptr(timerManager_),
|
|
44
44
|
weakJsThread =
|
|
45
45
|
std::weak_ptr(jsMessageQueueThread_),
|
|
46
|
-
|
|
47
|
-
jsErrorHandler_
|
|
48
|
-
|
|
49
|
-
if (weakRuntime.expired() || !jsErrorHandler) {
|
|
46
|
+
jsErrorHandler =
|
|
47
|
+
jsErrorHandler_](auto callback) {
|
|
48
|
+
if (weakRuntime.expired()) {
|
|
50
49
|
return;
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
/**
|
|
53
|
+
* If a fatal error was caught while executing the main bundle, assume the
|
|
54
|
+
* js runtime is invalid. And stop executing any more js.
|
|
55
|
+
*/
|
|
56
|
+
if (!jsErrorHandler->isRuntimeReady() &&
|
|
57
|
+
jsErrorHandler->hasHandledFatalError()) {
|
|
54
58
|
LOG(INFO)
|
|
55
|
-
<< "RuntimeExecutor: Detected fatal
|
|
59
|
+
<< "RuntimeExecutor: Detected fatal error. Dropping work on non-js thread."
|
|
56
60
|
<< std::endl;
|
|
57
61
|
return;
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
if (auto jsThread = weakJsThread.lock()) {
|
|
61
|
-
jsThread->runOnQueue(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
jsThread->runOnQueue([jsErrorHandler,
|
|
66
|
+
weakRuntime,
|
|
67
|
+
weakTimerManager,
|
|
68
|
+
callback = std::move(callback)]() {
|
|
69
|
+
auto runtime = weakRuntime.lock();
|
|
70
|
+
if (!runtime) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
67
73
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
jsi::Runtime& jsiRuntime = runtime->getRuntime();
|
|
75
|
+
SystraceSection s("ReactInstance::_runtimeExecutor[Callback]");
|
|
76
|
+
try {
|
|
77
|
+
callback(jsiRuntime);
|
|
72
78
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
} catch (jsi::JSError& originalError) {
|
|
81
|
-
handleJSError(jsiRuntime, originalError, true);
|
|
79
|
+
// If we have first-class support for microtasks,
|
|
80
|
+
// they would've been called as part of the previous callback.
|
|
81
|
+
if (!ReactNativeFeatureFlags::enableMicrotasks()) {
|
|
82
|
+
if (auto timerManager = weakTimerManager.lock()) {
|
|
83
|
+
timerManager->callReactNativeMicrotasks(jsiRuntime);
|
|
82
84
|
}
|
|
83
|
-
}
|
|
85
|
+
}
|
|
86
|
+
} catch (jsi::JSError& originalError) {
|
|
87
|
+
jsErrorHandler->handleFatalError(jsiRuntime, originalError);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
84
90
|
}
|
|
85
91
|
};
|
|
86
92
|
|
|
@@ -104,7 +110,7 @@ ReactInstance::ReactInstance(
|
|
|
104
110
|
// creation task to finish before starting the destruction.
|
|
105
111
|
inspectorTarget_ = &hostTarget.registerInstance(*this);
|
|
106
112
|
runtimeInspectorTarget_ =
|
|
107
|
-
&inspectorTarget_->registerRuntime(*runtime_, runtimeExecutor);
|
|
113
|
+
&inspectorTarget_->registerRuntime(*runtime_, runtimeExecutor); // [Windows #13172]
|
|
108
114
|
runtimeExecutorThatWaitsForInspectorSetup->flush();
|
|
109
115
|
});
|
|
110
116
|
|
|
@@ -118,7 +124,17 @@ ReactInstance::ReactInstance(
|
|
|
118
124
|
};
|
|
119
125
|
}
|
|
120
126
|
|
|
121
|
-
runtimeScheduler_ = std::make_shared<RuntimeScheduler>(
|
|
127
|
+
runtimeScheduler_ = std::make_shared<RuntimeScheduler>(
|
|
128
|
+
runtimeExecutor,
|
|
129
|
+
RuntimeSchedulerClock::now,
|
|
130
|
+
[jsErrorHandler = jsErrorHandler_](
|
|
131
|
+
jsi::Runtime& runtime, jsi::JSError& error) {
|
|
132
|
+
jsErrorHandler->handleFatalError(runtime, error);
|
|
133
|
+
});
|
|
134
|
+
runtimeScheduler_->setPerformanceEntryReporter(
|
|
135
|
+
// FIXME: Move creation of PerformanceEntryReporter to here and guarantee
|
|
136
|
+
// that its lifetime is the same as the runtime.
|
|
137
|
+
PerformanceEntryReporter::getInstance().get());
|
|
122
138
|
|
|
123
139
|
bufferedRuntimeExecutor_ = std::make_shared<BufferedRuntimeExecutor>(
|
|
124
140
|
[runtimeScheduler = runtimeScheduler_.get()](
|
|
@@ -148,8 +164,8 @@ RuntimeExecutor ReactInstance::getUnbufferedRuntimeExecutor() noexcept {
|
|
|
148
164
|
|
|
149
165
|
// This BufferedRuntimeExecutor ensures that the main JS bundle finished
|
|
150
166
|
// execution before any JS queued into it from C++ are executed. Use
|
|
151
|
-
//
|
|
152
|
-
// have finished. e.g. setting global variables into JS runtime.
|
|
167
|
+
// getUnbufferedRuntimeExecutor() instead if you do not need the main JS bundle
|
|
168
|
+
// to have finished. e.g. setting global variables into JS runtime.
|
|
153
169
|
RuntimeExecutor ReactInstance::getBufferedRuntimeExecutor() noexcept {
|
|
154
170
|
return [weakBufferedRuntimeExecutor_ =
|
|
155
171
|
std::weak_ptr<BufferedRuntimeExecutor>(bufferedRuntimeExecutor_)](
|
|
@@ -199,28 +215,34 @@ void ReactInstance::loadScript(
|
|
|
199
215
|
buffer = std::move(buffer),
|
|
200
216
|
weakBufferedRuntimeExecuter = std::weak_ptr<BufferedRuntimeExecutor>(
|
|
201
217
|
bufferedRuntimeExecutor_)](jsi::Runtime& runtime) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
218
|
+
SystraceSection s("ReactInstance::loadScript");
|
|
219
|
+
bool hasLogger(ReactMarker::logTaggedMarkerBridgelessImpl);
|
|
220
|
+
if (hasLogger) {
|
|
221
|
+
ReactMarker::logTaggedMarkerBridgeless(
|
|
222
|
+
ReactMarker::RUN_JS_BUNDLE_START, scriptName.c_str());
|
|
223
|
+
}
|
|
209
224
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
225
|
+
runtime.evaluateJavaScript(buffer, sourceURL);
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* TODO(T183610671): We need a safe/reliable way to enable the js
|
|
229
|
+
* pipeline from javascript. Remove this after we figure that out, or
|
|
230
|
+
* after we just remove the js pipeline.
|
|
231
|
+
*/
|
|
232
|
+
if (!jsErrorHandler_->hasHandledFatalError()) {
|
|
233
|
+
jsErrorHandler_->setRuntimeReady();
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (hasLogger) {
|
|
237
|
+
ReactMarker::logTaggedMarkerBridgeless(
|
|
238
|
+
ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str());
|
|
239
|
+
ReactMarker::logMarkerBridgeless(
|
|
240
|
+
ReactMarker::INIT_REACT_RUNTIME_STOP);
|
|
241
|
+
ReactMarker::logMarkerBridgeless(ReactMarker::APP_STARTUP_STOP);
|
|
242
|
+
}
|
|
243
|
+
if (auto strongBufferedRuntimeExecuter =
|
|
244
|
+
weakBufferedRuntimeExecuter.lock()) {
|
|
245
|
+
strongBufferedRuntimeExecuter->flush();
|
|
224
246
|
}
|
|
225
247
|
});
|
|
226
248
|
}
|
|
@@ -332,6 +354,11 @@ void defineReactInstanceFlags(
|
|
|
332
354
|
}
|
|
333
355
|
}
|
|
334
356
|
|
|
357
|
+
bool isTruthy(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
358
|
+
auto Boolean = runtime.global().getPropertyAsFunction(runtime, "Boolean");
|
|
359
|
+
return Boolean.call(runtime, value).getBool();
|
|
360
|
+
}
|
|
361
|
+
|
|
335
362
|
} // namespace
|
|
336
363
|
|
|
337
364
|
void ReactInstance::initializeRuntime(
|
|
@@ -346,8 +373,48 @@ void ReactInstance::initializeRuntime(
|
|
|
346
373
|
RuntimeSchedulerBinding::createAndInstallIfNeeded(
|
|
347
374
|
runtime, runtimeScheduler_);
|
|
348
375
|
|
|
376
|
+
runtime_->unstable_initializeOnJsThread();
|
|
377
|
+
|
|
349
378
|
defineReactInstanceFlags(runtime, options);
|
|
350
379
|
|
|
380
|
+
// TODO(T196834299): We should really use a C++ turbomodule for this
|
|
381
|
+
defineReadOnlyGlobal(
|
|
382
|
+
runtime,
|
|
383
|
+
"RN$handleException",
|
|
384
|
+
jsi::Function::createFromHostFunction(
|
|
385
|
+
runtime,
|
|
386
|
+
jsi::PropNameID::forAscii(runtime, "handleException"),
|
|
387
|
+
2,
|
|
388
|
+
[jsErrorHandler = jsErrorHandler_](
|
|
389
|
+
jsi::Runtime& runtime,
|
|
390
|
+
const jsi::Value& /*unused*/,
|
|
391
|
+
const jsi::Value* args,
|
|
392
|
+
size_t count) {
|
|
393
|
+
if (count < 2) {
|
|
394
|
+
throw jsi::JSError(
|
|
395
|
+
runtime,
|
|
396
|
+
"handleException requires 2 arguments: error, isFatal");
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
auto isFatal = isTruthy(runtime, args[1]);
|
|
400
|
+
if (jsErrorHandler->isRuntimeReady()) {
|
|
401
|
+
if (isFatal) {
|
|
402
|
+
jsErrorHandler->notifyOfFatalError();
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
return jsi::Value(false);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
if (isFatal) {
|
|
409
|
+
auto jsError =
|
|
410
|
+
jsi::JSError(runtime, jsi::Value(runtime, args[0]));
|
|
411
|
+
jsErrorHandler->handleFatalError(runtime, jsError);
|
|
412
|
+
return jsi::Value(true);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
return jsi::Value(false);
|
|
416
|
+
}));
|
|
417
|
+
|
|
351
418
|
defineReadOnlyGlobal(
|
|
352
419
|
runtime,
|
|
353
420
|
"RN$registerCallableModule",
|
|
@@ -11,10 +11,17 @@ try
|
|
|
11
11
|
$packagesSolutions = Get-ChildItem -File -Recurse -Path packages *.sln | Where-Object { !$_.FullName.Contains('node_modules') -and !$_.FullName.Contains('e2etest') }
|
|
12
12
|
$vnextSolutions = Get-ChildItem -File -Path vnext *.sln
|
|
13
13
|
|
|
14
|
+
# Run all solutions with their defaults
|
|
14
15
|
$($packagesSolutions; $vnextSolutions) | Foreach {
|
|
15
|
-
Write-Host Restoring $_.FullName
|
|
16
|
+
Write-Host Restoring $_.FullName with defaults
|
|
16
17
|
& msbuild /t:Restore /p:RestoreForceEvaluate=true $_.FullName
|
|
17
18
|
}
|
|
19
|
+
|
|
20
|
+
# Re-run solutions that we also build a Fabric variant
|
|
21
|
+
@("$RepoRoot\vnext\ReactWindows-Desktop.sln", "$RepoRoot\vnext\Microsoft.ReactNative.CppOnly.slnf") | Foreach {
|
|
22
|
+
Write-Host Restoring $_ with Fabric
|
|
23
|
+
& msbuild /t:Restore /p:RestoreForceEvaluate=true /p:UseFabric=true /p:UseWinUI3=true $_
|
|
24
|
+
}
|
|
18
25
|
}
|
|
19
26
|
finally
|
|
20
27
|
{
|
|
@@ -80,12 +80,12 @@ New-Item -ItemType Directory -Path $TargetRoot\Microsoft.ReactNative.Cxx\ReactCo
|
|
|
80
80
|
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\callinvoker\ReactCommon\CallInvoker.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
|
|
81
81
|
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\callinvoker\ReactCommon\SchedulerPriority.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
|
|
82
82
|
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\bridging\CallbackWrapper.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
|
|
83
|
+
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\bridging\LongLivedObject.cpp -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
|
|
84
|
+
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\bridging\LongLivedObject.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
|
|
83
85
|
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\bridging\EventEmitter.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
|
|
84
86
|
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\bridging\Function.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
|
|
85
87
|
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\bridging\Base.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
|
|
86
88
|
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\bridging\Convert.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
|
|
87
|
-
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\bridging\LongLivedObject.cpp -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
|
|
88
|
-
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\bridging\LongLivedObject.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
|
|
89
89
|
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\nativemodule\core\ReactCommon\TurboModule.cpp -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
|
|
90
90
|
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\nativemodule\core\ReactCommon\TurboModule.h -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
|
|
91
91
|
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\nativemodule\core\ReactCommon\TurboModuleUtils.cpp -Destination $TargetRoot\Microsoft.ReactNative.Cxx\ReactCommon\
|
|
@@ -416,9 +416,8 @@ void WebSocketTurboModule::Connect(
|
|
|
416
416
|
auto &optHeaders = options.headers;
|
|
417
417
|
if (optHeaders.has_value()) {
|
|
418
418
|
auto &headersVal = optHeaders.value();
|
|
419
|
-
for (const auto &
|
|
419
|
+
for (const auto &entry : headersVal.AsObject()) {
|
|
420
420
|
// Each header JSValueObject should only contain one key-value pair
|
|
421
|
-
const auto &entry = *headerVal.AsObject().cbegin();
|
|
422
421
|
rcOptions.emplace(winrt::to_hstring(entry.first), entry.second.AsString());
|
|
423
422
|
}
|
|
424
423
|
}
|