react-native-windows 0.77.0-preview.4 → 0.78.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 +1 -1
- package/Chakra/ChakraTracing.cpp +1 -1
- package/Libraries/Animated/animations/Animation.js +22 -1
- package/Libraries/Animated/animations/DecayAnimation.js +1 -0
- package/Libraries/Animated/animations/SpringAnimation.js +1 -0
- package/Libraries/Animated/animations/TimingAnimation.js +1 -0
- package/Libraries/Animated/nodes/AnimatedAddition.js +9 -2
- package/Libraries/Animated/nodes/AnimatedColor.js +4 -1
- package/Libraries/Animated/nodes/AnimatedDiffClamp.js +10 -2
- package/Libraries/Animated/nodes/AnimatedDivision.js +9 -2
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +5 -1
- package/Libraries/Animated/nodes/AnimatedModulo.js +5 -2
- package/Libraries/Animated/nodes/AnimatedMultiplication.js +9 -2
- package/Libraries/Animated/nodes/AnimatedNode.js +25 -46
- package/Libraries/Animated/nodes/AnimatedObject.js +9 -2
- package/Libraries/Animated/nodes/AnimatedProps.js +5 -1
- package/Libraries/Animated/nodes/AnimatedStyle.js +5 -1
- package/Libraries/Animated/nodes/AnimatedSubtraction.js +9 -2
- package/Libraries/Animated/nodes/AnimatedTracking.js +5 -1
- package/Libraries/Animated/nodes/AnimatedTransform.js +5 -1
- package/Libraries/Animated/nodes/AnimatedValue.js +49 -4
- package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
- package/Libraries/Animated/useAnimatedProps.js +0 -43
- package/Libraries/Components/Button.windows.js +3 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +1 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +3 -1
- package/Libraries/Components/LayoutConformance/LayoutConformance.d.ts +21 -0
- package/Libraries/Components/LayoutConformance/LayoutConformance.js +59 -0
- package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +29 -0
- package/Libraries/Components/Pressable/Pressable.windows.js +3 -0
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
- package/Libraries/Components/TextInput/TextInput.d.ts +5 -0
- package/Libraries/Components/TextInput/TextInput.flow.js +6 -0
- package/Libraries/Components/TextInput/TextInput.js +6 -0
- package/Libraries/Components/TextInput/TextInput.windows.js +9 -0
- package/Libraries/Components/Touchable/TouchableBounce.windows.js +2 -0
- package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +2 -0
- package/Libraries/Components/Touchable/TouchableOpacity.windows.js +2 -0
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +2 -0
- package/Libraries/Components/View/View.windows.js +3 -0
- package/Libraries/Components/View/ViewAccessibility.d.ts +7 -2
- package/Libraries/Components/View/ViewAccessibility.windows.js +1 -0
- package/Libraries/Components/View/ViewPropTypes.d.ts +0 -7
- package/Libraries/Components/View/ViewPropTypes.js +0 -9
- package/Libraries/Components/View/ViewPropTypes.windows.js +1 -9
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/setUpBatchedBridge.js +1 -16
- package/Libraries/EventEmitter/RCTEventEmitter.js +2 -6
- package/Libraries/Image/AssetSourceResolver.js +11 -0
- package/Libraries/Image/AssetSourceResolver.windows.js +11 -0
- package/Libraries/Image/Image.windows.js +2 -0
- package/Libraries/Inspector/BorderBox.js +26 -14
- package/Libraries/Inspector/BoxInspector.js +60 -42
- package/Libraries/Inspector/ElementBox.js +55 -48
- package/Libraries/Inspector/StyleInspector.js +36 -30
- package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
- package/Libraries/Lists/FlatList.d.ts +1 -1
- package/Libraries/Modal/Modal.js +2 -0
- package/Libraries/Modal/Modal.windows.js +2 -0
- package/Libraries/NativeComponent/BaseViewConfig.android.js +0 -2
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +0 -2
- package/Libraries/NativeComponent/BaseViewConfig.windows.js +0 -2
- package/Libraries/Network/RCTNetworking.android.js +24 -16
- package/Libraries/Network/RCTNetworking.ios.js +1 -46
- package/Libraries/Network/RCTNetworking.windows.js +1 -46
- package/Libraries/Network/RCTNetworkingEventDefinitions.flow.js +57 -0
- package/Libraries/ReactNative/UIManagerProperties.js +3 -1
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +15828 -26461
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +3907 -2560
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4399 -2878
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +16102 -26908
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +4034 -2695
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4535 -3045
- package/Libraries/Renderer/shims/ReactNativeTypes.js +5 -6
- package/Libraries/StyleSheet/processTransform.js +6 -0
- package/Libraries/Text/Text.d.ts +6 -1
- package/Libraries/Text/Text.windows.js +4 -0
- package/Libraries/Text/TextProps.js +2 -2
- package/Libraries/Text/TextProps.windows.js +3 -2
- package/Libraries/Utilities/BackHandler.android.js +5 -4
- package/Libraries/Utilities/BackHandler.ios.js +4 -5
- package/Libraries/Utilities/BackHandler.windows.js +5 -4
- package/Microsoft.ReactNative/CompositionComponentView.idl +13 -1
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +0 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +92 -17
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +9 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +13 -33
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +43 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +12 -10
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +11 -9
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +191 -329
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +3 -61
- package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.cpp +66 -0
- package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.h +52 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +21 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +7 -4
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +79 -19
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +12 -6
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +71 -17
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +16 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +5 -10
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +4 -4
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +138 -110
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +27 -27
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +38 -33
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +0 -2
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +5 -16
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +0 -3
- package/Microsoft.ReactNative/Fabric/ImageManager.cpp +9 -0
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +0 -2
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp +1 -1
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +5 -0
- package/Microsoft.ReactNative/IReactContext.cpp +2 -2
- package/Microsoft.ReactNative/IReactContext.h +1 -1
- package/Microsoft.ReactNative/IReactContext.idl +2 -2
- package/Microsoft.ReactNative/IReactPackageBuilder.idl +3 -3
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +97 -87
- package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +4 -0
- package/Microsoft.ReactNative/Modules/AlertModule.cpp +9 -4
- package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.cpp +1 -1
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +32 -35
- package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.h +7 -4
- package/Microsoft.ReactNative/Modules/AppStateModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +2 -2
- package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +2 -2
- package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +3 -3
- package/Microsoft.ReactNative/Modules/I18nManagerModule.cpp +1 -1
- package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +7 -5
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -1
- package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +10 -10
- package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +24 -24
- package/Microsoft.ReactNative/Modules/Timing.cpp +2 -2
- package/Microsoft.ReactNative/ReactHost/IReactInstance.h +5 -0
- package/Microsoft.ReactNative/ReactHost/React.h +0 -3
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +39 -16
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +4 -2
- package/Microsoft.ReactNative/ReactNativeHost.cpp +9 -4
- package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -1
- package/Microsoft.ReactNative/ReactPackageBuilder.cpp +3 -3
- package/Microsoft.ReactNative/ReactPackageBuilder.h +4 -4
- package/Microsoft.ReactNative/Utils/Helpers.cpp +0 -2
- package/Microsoft.ReactNative/Views/DevMenu.cpp +6 -6
- package/Microsoft.ReactNative/Views/DevMenu.h +1 -1
- package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +2 -2
- package/Microsoft.ReactNative/Views/ViewPanel.cpp +1 -1
- package/Microsoft.ReactNative/Views/ViewViewManager.cpp +2 -2
- package/Microsoft.ReactNative/XamlUIService.cpp +13 -7
- package/Microsoft.ReactNative/XamlUIService.h +4 -1
- package/Microsoft.ReactNative/XamlUIService.idl +2 -0
- package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +6 -2
- package/Microsoft.ReactNative.Cxx/ReactContext.h +1 -1
- package/Microsoft.ReactNative.Cxx/XamlUtils.h +12 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/React.Cpp.props +3 -0
- package/PropertySheets/WebView2.props +1 -1
- package/PropertySheets/WinUI.props +5 -4
- package/ReactCommon/ReactCommon.vcxproj +5 -1
- package/ReactCommon/ReactCommon.vcxproj.filters +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +3 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +3 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +91 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +1 -12
- package/{Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h → ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/textinput/TextInputState.h} +37 -35
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +1 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +4 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/ImageRequestParams.h +30 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/runtimescheduler/SchedulerPriorityUtils.h +4 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/primitives.h +179 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +43 -57
- package/Shared/HermesRuntimeHolder.cpp +2 -2
- package/Shared/Shared.vcxitems +8 -14
- package/Shared/Shared.vcxitems.filters +4 -16
- package/Shared/Threading/BatchingQueueThread.cpp +3 -3
- package/codegen/NativeCPUTimeSpec.g.h +41 -0
- package/codegen/NativeFantomSpec.g.h +78 -0
- package/codegen/NativePerformanceSpec.g.h +31 -43
- package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +84 -84
- package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +212 -0
- package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +295 -0
- package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +200 -0
- package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +224 -0
- package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +250 -0
- package/codegen/react/components/rnwcore/AndroidSwitch.g.h +267 -0
- package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +234 -0
- package/codegen/react/components/rnwcore/InputAccessory.g.h +200 -0
- package/codegen/react/components/rnwcore/ModalHostView.g.h +283 -0
- package/codegen/react/components/rnwcore/PullToRefreshView.g.h +246 -0
- package/codegen/react/components/rnwcore/SafeAreaView.g.h +197 -0
- package/codegen/react/components/rnwcore/Switch.g.h +263 -0
- package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +200 -0
- package/codegen/rnwcoreJSI-generated.cpp +90 -57
- package/codegen/rnwcoreJSI.h +241 -104
- package/index.js +5 -0
- package/index.windows.js +5 -0
- package/just-task.js +1 -1
- package/package.json +23 -24
- package/src/private/animated/NativeAnimatedValidation.js +1 -1
- package/src/private/featureflags/ReactNativeFeatureFlags.js +32 -26
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -5
- package/src/private/renderer/errorhandling/ErrorHandlers.js +12 -55
- package/src/private/specs/modules/{NativeJSCSamplingProfiler.js → NativeCPUTime.js} +7 -2
- package/src/private/specs/modules/NativeFantom.js +37 -0
- package/src/private/utilities/ensureInstance.js +21 -0
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +49 -6
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +17 -9
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +11 -11
- package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +1 -1
- package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -1
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
- package/src/private/webapis/performance/Performance.js +0 -12
- package/src/private/webapis/performance/specs/NativePerformance.js +0 -11
- package/types/index.d.ts +1 -0
- package/Libraries/HeapCapture/HeapCapture.js +0 -29
- package/Libraries/HeapCapture/NativeJSCHeapCapture.js +0 -13
- package/Libraries/Performance/NativeJSCSamplingProfiler.js +0 -13
- package/Libraries/Performance/SamplingProfiler.js +0 -39
- package/Libraries/ReactNative/__mocks__/FabricUIManager.js +0 -334
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +0 -39
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +0 -18
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h +0 -39
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +0 -34
- package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.cpp +0 -53
- package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.h +0 -26
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/LayoutableShadowNode.cpp +0 -363
- package/codegen/NativeJSCSamplingProfilerSpec.g.h +0 -35
- package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +0 -413
- package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +0 -181
- package/src/private/webapis/mutationobserver/specs/__mocks__/NativeMutationObserver.js +0 -327
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#include "PortalComponentView.h"
|
|
8
|
+
|
|
9
|
+
#include "Composition.PortalComponentView.g.cpp"
|
|
10
|
+
|
|
11
|
+
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
12
|
+
|
|
13
|
+
PortalComponentView::PortalComponentView(
|
|
14
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
15
|
+
facebook::react::Tag tag,
|
|
16
|
+
winrt::Microsoft::ReactNative::ReactContext const &reactContext,
|
|
17
|
+
winrt::Microsoft::ReactNative::Composition::ReactCompositionViewComponentBuilder *builder)
|
|
18
|
+
: base_type(tag, reactContext, builder) {
|
|
19
|
+
m_rootComponentView = winrt::make_self<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>(
|
|
20
|
+
compContext, *this, reactContext);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
PortalComponentView::~PortalComponentView() {}
|
|
24
|
+
|
|
25
|
+
winrt::Microsoft::ReactNative::Composition::RootComponentView PortalComponentView::ContentRoot() const noexcept {
|
|
26
|
+
return *m_rootComponentView;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
void PortalComponentView::MountChildComponentView(
|
|
30
|
+
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
31
|
+
uint32_t index) noexcept {
|
|
32
|
+
m_rootComponentView->MountChildComponentView(childComponentView, index);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
void PortalComponentView::UnmountChildComponentView(
|
|
36
|
+
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
37
|
+
uint32_t index) noexcept {
|
|
38
|
+
m_rootComponentView->UnmountChildComponentView(childComponentView, index);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const winrt::Microsoft::ReactNative::IComponentProps PortalComponentView::userProps(
|
|
42
|
+
facebook::react::Props::Shared const &props) noexcept {
|
|
43
|
+
const auto &abiViewProps = *std::static_pointer_cast<const ::Microsoft::ReactNative::AbiViewProps>(props);
|
|
44
|
+
return abiViewProps.UserProps();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
void PortalComponentView::updateProps(
|
|
48
|
+
facebook::react::Props::Shared const &props,
|
|
49
|
+
facebook::react::Props::Shared const &oldProps) noexcept {
|
|
50
|
+
m_rootComponentView->updateProps(props, oldProps);
|
|
51
|
+
base_type::updateProps(props, oldProps);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
void PortalComponentView::updateLayoutMetrics(
|
|
55
|
+
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
56
|
+
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept {
|
|
57
|
+
m_rootComponentView->updateLayoutMetrics(layoutMetrics, oldLayoutMetrics);
|
|
58
|
+
base_type::updateLayoutMetrics(layoutMetrics, oldLayoutMetrics);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
void PortalComponentView::FinalizeUpdates(winrt::Microsoft::ReactNative::ComponentViewUpdateMask updateMask) noexcept {
|
|
62
|
+
m_rootComponentView->FinalizeUpdates(updateMask);
|
|
63
|
+
base_type::FinalizeUpdates(updateMask);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#include <Fabric/ComponentView.h>
|
|
8
|
+
#include <Microsoft.ReactNative.Cxx/ReactContext.h>
|
|
9
|
+
#include "RootComponentView.h"
|
|
10
|
+
|
|
11
|
+
#include "Composition.PortalComponentView.g.h"
|
|
12
|
+
|
|
13
|
+
namespace Microsoft::ReactNative {
|
|
14
|
+
struct CompContext;
|
|
15
|
+
} // namespace Microsoft::ReactNative
|
|
16
|
+
|
|
17
|
+
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
18
|
+
|
|
19
|
+
struct PortalComponentView
|
|
20
|
+
: public PortalComponentViewT<PortalComponentView, winrt::Microsoft::ReactNative::implementation::ComponentView> {
|
|
21
|
+
PortalComponentView(
|
|
22
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
23
|
+
facebook::react::Tag tag,
|
|
24
|
+
winrt::Microsoft::ReactNative::ReactContext const &reactContext,
|
|
25
|
+
winrt::Microsoft::ReactNative::Composition::ReactCompositionViewComponentBuilder *builder);
|
|
26
|
+
virtual ~PortalComponentView();
|
|
27
|
+
|
|
28
|
+
winrt::Microsoft::ReactNative::Composition::RootComponentView ContentRoot() const noexcept;
|
|
29
|
+
|
|
30
|
+
void MountChildComponentView(
|
|
31
|
+
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
32
|
+
uint32_t index) noexcept override;
|
|
33
|
+
void UnmountChildComponentView(
|
|
34
|
+
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
35
|
+
uint32_t index) noexcept override;
|
|
36
|
+
|
|
37
|
+
const winrt::Microsoft::ReactNative::IComponentProps userProps(
|
|
38
|
+
facebook::react::Props::Shared const &props) noexcept override;
|
|
39
|
+
void updateProps(facebook::react::Props::Shared const &props, facebook::react::Props::Shared const &oldProps) noexcept
|
|
40
|
+
override;
|
|
41
|
+
|
|
42
|
+
void updateLayoutMetrics(
|
|
43
|
+
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
44
|
+
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept override;
|
|
45
|
+
|
|
46
|
+
void FinalizeUpdates(winrt::Microsoft::ReactNative::ComponentViewUpdateMask updateMask) noexcept override;
|
|
47
|
+
|
|
48
|
+
private:
|
|
49
|
+
winrt::com_ptr<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView> m_rootComponentView;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
#include "ReactCompositionViewComponentBuilder.h"
|
|
6
6
|
#include <Fabric/Composition/CompositionViewComponentView.h>
|
|
7
7
|
#include <Fabric/Composition/ContentIslandComponentView.h>
|
|
8
|
+
#include <Fabric/Composition/PortalComponentView.h>
|
|
8
9
|
#include <strsafe.h>
|
|
9
10
|
#include "CompositionContextHelper.h"
|
|
10
11
|
#include "DynamicWriter.h"
|
|
@@ -111,6 +112,26 @@ void ReactCompositionViewComponentBuilder::SetContentIslandComponentViewInitiali
|
|
|
111
112
|
};
|
|
112
113
|
}
|
|
113
114
|
|
|
115
|
+
void ReactCompositionViewComponentBuilder::SetPortalComponentViewInitializer(
|
|
116
|
+
const PortalComponentViewInitializer &initializer) noexcept {
|
|
117
|
+
m_fnCreateView = [initializer](
|
|
118
|
+
const IReactContext &reactContext,
|
|
119
|
+
int32_t tag,
|
|
120
|
+
const Experimental::ICompositionContext &context,
|
|
121
|
+
ComponentViewFeatures /*features*/,
|
|
122
|
+
ReactCompositionViewComponentBuilder &builder)
|
|
123
|
+
-> winrt::Microsoft::ReactNative::Composition::PortalComponentView {
|
|
124
|
+
auto view = winrt::make<winrt::Microsoft::ReactNative::Composition::implementation::PortalComponentView>(
|
|
125
|
+
context, tag, reactContext, &builder);
|
|
126
|
+
initializer(view);
|
|
127
|
+
return view;
|
|
128
|
+
};
|
|
129
|
+
m_descriptorConstructorFactory = []() {
|
|
130
|
+
return &facebook::react::concreteComponentDescriptorConstructor<
|
|
131
|
+
::Microsoft::ReactNative::AbiViewComponentDescriptor>;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
114
135
|
// (Object handle, Microsoft.ReactNative.IComponentState state) => void
|
|
115
136
|
// void ReactCompositionViewComponentBuilder::SetStateUpdater(StateUpdater impl) noexcept {
|
|
116
137
|
// m_stateUpdater = impl;
|
|
@@ -12,10 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
namespace winrt::Microsoft::ReactNative::Composition {
|
|
14
14
|
|
|
15
|
-
struct ReactCompositionViewComponentBuilder
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
struct ReactCompositionViewComponentBuilder
|
|
16
|
+
: winrt::implements<
|
|
17
|
+
ReactCompositionViewComponentBuilder,
|
|
18
|
+
IReactViewComponentBuilder,
|
|
19
|
+
Composition::IReactCompositionViewComponentBuilder,
|
|
20
|
+
Composition::Experimental::IReactCompositionViewComponentInternalBuilder> {
|
|
19
21
|
ReactCompositionViewComponentBuilder() noexcept;
|
|
20
22
|
|
|
21
23
|
public: // IReactViewComponentBuilder
|
|
@@ -42,6 +44,7 @@ struct ReactCompositionViewComponentBuilder : winrt::implements<
|
|
|
42
44
|
public: // Composition::IReactCompositionViewComponentBuilder
|
|
43
45
|
void SetViewComponentViewInitializer(const ViewComponentViewInitializer &initializer) noexcept;
|
|
44
46
|
void SetContentIslandComponentViewInitializer(const ComponentIslandComponentViewInitializer &initializer) noexcept;
|
|
47
|
+
void SetPortalComponentViewInitializer(const PortalComponentViewInitializer &initializer) noexcept;
|
|
45
48
|
void SetCreateVisualHandler(CreateVisualDelegate impl) noexcept;
|
|
46
49
|
void SetViewFeatures(ComponentViewFeatures viewFeatures) noexcept;
|
|
47
50
|
void SetVisualToMountChildrenIntoHandler(VisualToMountChildrenIntoDelegate impl) noexcept;
|
|
@@ -127,21 +127,39 @@ ReactNativeIsland::ReactNativeIsland(const winrt::Microsoft::UI::Composition::Co
|
|
|
127
127
|
InitTextScaleMultiplier();
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
// Constructor to initialize ReactNativeIsland with context and componentView
|
|
131
130
|
ReactNativeIsland::ReactNativeIsland(
|
|
132
|
-
const winrt::Microsoft::
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
: m_compositor(compositor),
|
|
136
|
-
m_context(context),
|
|
131
|
+
const winrt::Microsoft::ReactNative::Composition::PortalComponentView &portal) noexcept
|
|
132
|
+
: m_compositor(portal.ContentRoot().Compositor()),
|
|
133
|
+
m_context(portal.ReactContext()),
|
|
137
134
|
m_layoutConstraints({{0, 0}, {0, 0}, winrt::Microsoft::ReactNative::LayoutDirection::Undefined}),
|
|
138
135
|
m_isFragment(true) {
|
|
139
|
-
|
|
136
|
+
m_portal = winrt::make_weak(portal);
|
|
137
|
+
|
|
138
|
+
auto trueRoot =
|
|
139
|
+
winrt::get_self<winrt::Microsoft::ReactNative::Composition::implementation::PortalComponentView>(portal)
|
|
140
|
+
->rootComponentView();
|
|
141
|
+
while (auto p = trueRoot->Portal()) {
|
|
142
|
+
trueRoot = winrt::get_self<winrt::Microsoft::ReactNative::Composition::implementation::PortalComponentView>(p)
|
|
143
|
+
->rootComponentView();
|
|
144
|
+
};
|
|
145
|
+
m_rootTag = trueRoot->Tag();
|
|
146
|
+
|
|
140
147
|
InitTextScaleMultiplier();
|
|
141
|
-
AddFragmentCompositionEventHandler(
|
|
148
|
+
AddFragmentCompositionEventHandler(m_context.Handle(), portal.ContentRoot());
|
|
149
|
+
auto selfPortal = winrt::get_self<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>(
|
|
150
|
+
portal.ContentRoot());
|
|
151
|
+
selfPortal->ReactNativeIsland(*this);
|
|
152
|
+
NotifySizeChanged();
|
|
153
|
+
selfPortal->start(*this);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
winrt::Microsoft::ReactNative::ReactNativeIsland ReactNativeIsland::CreatePortal(
|
|
157
|
+
const winrt::Microsoft::ReactNative::Composition::PortalComponentView &portal) noexcept {
|
|
158
|
+
return winrt::make<ReactNativeIsland>(portal);
|
|
142
159
|
}
|
|
143
160
|
|
|
144
|
-
ReactNativeIsland::ReactNativeIsland() noexcept
|
|
161
|
+
ReactNativeIsland::ReactNativeIsland() noexcept
|
|
162
|
+
: ReactNativeIsland(winrt::Microsoft::UI::Composition::Compositor{nullptr}) {}
|
|
145
163
|
|
|
146
164
|
ReactNativeIsland::~ReactNativeIsland() noexcept {
|
|
147
165
|
#ifdef USE_WINUI3
|
|
@@ -159,14 +177,20 @@ ReactNativeIsland::~ReactNativeIsland() noexcept {
|
|
|
159
177
|
assert(m_uiDispatcher.HasThreadAccess());
|
|
160
178
|
UninitRootView();
|
|
161
179
|
}
|
|
180
|
+
|
|
181
|
+
if (m_island) {
|
|
182
|
+
m_island.Close();
|
|
183
|
+
}
|
|
162
184
|
}
|
|
163
185
|
|
|
164
186
|
ReactNative::IReactViewHost ReactNativeIsland::ReactViewHost() noexcept {
|
|
165
187
|
return m_reactViewHost;
|
|
166
188
|
}
|
|
167
189
|
|
|
168
|
-
void ReactNativeIsland::ReactViewHost(winrt::Microsoft::ReactNative::IReactViewHost const &value)
|
|
169
|
-
|
|
190
|
+
void ReactNativeIsland::ReactViewHost(winrt::Microsoft::ReactNative::IReactViewHost const &value) {
|
|
191
|
+
if (m_isFragment)
|
|
192
|
+
winrt::throw_hresult(E_ACCESSDENIED);
|
|
193
|
+
|
|
170
194
|
if (m_reactViewHost == value) {
|
|
171
195
|
return;
|
|
172
196
|
}
|
|
@@ -217,6 +241,8 @@ void ReactNativeIsland::AddRenderedVisual(
|
|
|
217
241
|
|
|
218
242
|
void ReactNativeIsland::RemoveRenderedVisual(
|
|
219
243
|
const winrt::Microsoft::ReactNative::Composition::Experimental::IVisual &visual) noexcept {
|
|
244
|
+
if (m_isFragment)
|
|
245
|
+
return;
|
|
220
246
|
assert(m_hasRenderedVisual);
|
|
221
247
|
InternalRootVisual().Remove(visual);
|
|
222
248
|
m_hasRenderedVisual = false;
|
|
@@ -442,7 +468,7 @@ void ReactNativeIsland::InitRootView(
|
|
|
442
468
|
|
|
443
469
|
m_context = winrt::Microsoft::ReactNative::ReactContext(std::move(context));
|
|
444
470
|
m_reactViewOptions = std::move(viewOptions);
|
|
445
|
-
m_CompositionEventHandler = std::make_shared<::Microsoft::ReactNative::CompositionEventHandler>(m_context, *this
|
|
471
|
+
m_CompositionEventHandler = std::make_shared<::Microsoft::ReactNative::CompositionEventHandler>(m_context, *this);
|
|
446
472
|
m_CompositionEventHandler->Initialize();
|
|
447
473
|
|
|
448
474
|
UpdateRootViewInternal();
|
|
@@ -457,15 +483,13 @@ void ReactNativeIsland::AddFragmentCompositionEventHandler(
|
|
|
457
483
|
.Get(winrt::Microsoft::ReactNative::ReactDispatcherHelper::UIDispatcherProperty())
|
|
458
484
|
.try_as<IReactDispatcher>();
|
|
459
485
|
VerifyElseCrash(m_uiDispatcher.HasThreadAccess());
|
|
460
|
-
VerifyElseCrash(m_rootTag != -1);
|
|
461
486
|
auto uiManager = ::Microsoft::ReactNative::FabricUIManager::FromProperties(
|
|
462
487
|
winrt::Microsoft::ReactNative::ReactPropertyBag(context.Properties()));
|
|
463
488
|
|
|
464
489
|
if (!m_CompositionEventHandler) {
|
|
465
490
|
// Create CompositionEventHandler if not already created
|
|
466
491
|
m_context = winrt::Microsoft::ReactNative::ReactContext(context);
|
|
467
|
-
m_CompositionEventHandler =
|
|
468
|
-
std::make_shared<::Microsoft::ReactNative::CompositionEventHandler>(m_context, *this, componentView.Tag());
|
|
492
|
+
m_CompositionEventHandler = std::make_shared<::Microsoft::ReactNative::CompositionEventHandler>(m_context, *this);
|
|
469
493
|
m_CompositionEventHandler->Initialize();
|
|
470
494
|
m_isInitialized = true;
|
|
471
495
|
}
|
|
@@ -545,6 +569,7 @@ void ReactNativeIsland::ClearLoadingUI() noexcept {
|
|
|
545
569
|
void ReactNativeIsland::EnsureLoadingUI() noexcept {}
|
|
546
570
|
|
|
547
571
|
void ReactNativeIsland::ShowInstanceLoaded() noexcept {
|
|
572
|
+
VerifyElseCrash(!m_isFragment);
|
|
548
573
|
if (m_rootVisual) {
|
|
549
574
|
ClearLoadingUI();
|
|
550
575
|
|
|
@@ -740,6 +765,9 @@ void ReactNativeIsland::InitTextScaleMultiplier() noexcept {
|
|
|
740
765
|
winrt::Windows::Foundation::Size ReactNativeIsland::Measure(
|
|
741
766
|
const winrt::Microsoft::ReactNative::LayoutConstraints &layoutConstraints,
|
|
742
767
|
const winrt::Windows::Foundation::Point &viewportOffset) const {
|
|
768
|
+
if (m_isFragment)
|
|
769
|
+
winrt::throw_hresult(E_ILLEGAL_METHOD_CALL);
|
|
770
|
+
|
|
743
771
|
facebook::react::Size size{0, 0};
|
|
744
772
|
|
|
745
773
|
if (layoutConstraints.LayoutDirection != winrt::Microsoft::ReactNative::LayoutDirection::LeftToRight &&
|
|
@@ -781,7 +809,7 @@ void ReactNativeIsland::Arrange(
|
|
|
781
809
|
facebook::react::LayoutConstraints fbLayoutConstraints;
|
|
782
810
|
ApplyConstraints(layoutConstraints, fbLayoutConstraints);
|
|
783
811
|
|
|
784
|
-
if (m_isInitialized && m_rootTag != -1) {
|
|
812
|
+
if (m_isInitialized && m_rootTag != -1 && !m_isFragment) {
|
|
785
813
|
if (auto fabricuiManager = ::Microsoft::ReactNative::FabricUIManager::FromProperties(
|
|
786
814
|
winrt::Microsoft::ReactNative::ReactPropertyBag(m_context.Properties()))) {
|
|
787
815
|
facebook::react::LayoutContext context;
|
|
@@ -820,6 +848,23 @@ winrt::Microsoft::UI::Content::ContentIsland ReactNativeIsland::Island() {
|
|
|
820
848
|
rootVisual));
|
|
821
849
|
m_island = winrt::Microsoft::UI::Content::ContentIsland::Create(rootVisual);
|
|
822
850
|
|
|
851
|
+
auto focusController = winrt::Microsoft::UI::Input::InputFocusController::GetForIsland(m_island);
|
|
852
|
+
focusController.NavigateFocusRequested(
|
|
853
|
+
[weakThis = get_weak()](
|
|
854
|
+
const auto &sender, const winrt::Microsoft::UI::Input::FocusNavigationRequestEventArgs &args) {
|
|
855
|
+
if (auto pThis = weakThis.get()) {
|
|
856
|
+
if (auto rootView = pThis->GetComponentView()) {
|
|
857
|
+
args.Result(
|
|
858
|
+
rootView->NavigateFocus(winrt::Microsoft::ReactNative::FocusNavigationRequest(
|
|
859
|
+
winrt::Microsoft::ReactNative::FocusNavigationReason::First))
|
|
860
|
+
? winrt::Microsoft::UI::Input::FocusNavigationResult::Moved
|
|
861
|
+
: winrt::Microsoft::UI::Input::FocusNavigationResult::NotMoved);
|
|
862
|
+
} else {
|
|
863
|
+
args.Result(winrt::Microsoft::UI::Input::FocusNavigationResult::NoFocusableElements);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
});
|
|
867
|
+
|
|
823
868
|
// ContentIsland does not support weak_ref, so we cannot use auto_revoke for these events
|
|
824
869
|
m_islandAutomationProviderRequestedToken = m_island.AutomationProviderRequested(
|
|
825
870
|
[weakThis = get_weak()](
|
|
@@ -903,13 +948,29 @@ void ReactNativeIsland::OnUnmounted() noexcept {
|
|
|
903
948
|
if (!m_mounted)
|
|
904
949
|
return;
|
|
905
950
|
m_mounted = false;
|
|
951
|
+
|
|
952
|
+
if (m_island && m_island.IsConnected()) {
|
|
953
|
+
auto focusController = winrt::Microsoft::UI::Input::InputFocusController::GetForIsland(m_island);
|
|
954
|
+
auto request = winrt::Microsoft::UI::Input::FocusNavigationRequest::Create(
|
|
955
|
+
winrt::Microsoft::UI::Input::FocusNavigationReason::Programmatic);
|
|
956
|
+
if (focusController.HasFocus()) {
|
|
957
|
+
focusController.DepartFocus(request);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
|
|
906
961
|
if (auto componentView = GetComponentView()) {
|
|
907
962
|
componentView->onUnmounted();
|
|
908
963
|
}
|
|
909
964
|
}
|
|
910
965
|
|
|
911
|
-
winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView
|
|
966
|
+
winrt::com_ptr<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>
|
|
912
967
|
ReactNativeIsland::GetComponentView() noexcept {
|
|
968
|
+
if (auto portal = m_portal.get()) {
|
|
969
|
+
return winrt::get_self<winrt::Microsoft::ReactNative::Composition::implementation::PortalComponentView>(portal)
|
|
970
|
+
->ContentRoot()
|
|
971
|
+
.as<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>();
|
|
972
|
+
}
|
|
973
|
+
|
|
913
974
|
if (!m_context || m_context.Handle().LoadingState() != winrt::Microsoft::ReactNative::LoadingState::Loaded ||
|
|
914
975
|
m_rootTag == -1)
|
|
915
976
|
return nullptr;
|
|
@@ -919,8 +980,7 @@ ReactNativeIsland::GetComponentView() noexcept {
|
|
|
919
980
|
auto rootComponentViewDescriptor = fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(
|
|
920
981
|
static_cast<facebook::react::SurfaceId>(m_rootTag));
|
|
921
982
|
return rootComponentViewDescriptor.view
|
|
922
|
-
.as<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>()
|
|
923
|
-
.get();
|
|
983
|
+
.as<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>();
|
|
924
984
|
}
|
|
925
985
|
return nullptr;
|
|
926
986
|
}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
#include <winrt/Microsoft.ReactNative.h>
|
|
13
13
|
#include <winrt/Windows.UI.ViewManagement.h>
|
|
14
14
|
#include "CompositionEventHandler.h"
|
|
15
|
+
#include "PortalComponentView.h"
|
|
15
16
|
#include "ReactHost/React.h"
|
|
16
17
|
|
|
17
18
|
namespace winrt::Microsoft::ReactNative::implementation {
|
|
@@ -48,15 +49,15 @@ struct ReactNativeIsland
|
|
|
48
49
|
~ReactNativeIsland() noexcept;
|
|
49
50
|
|
|
50
51
|
ReactNativeIsland(const winrt::Microsoft::UI::Composition::Compositor &compositor) noexcept;
|
|
51
|
-
ReactNativeIsland(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
winrt::Microsoft::ReactNative::
|
|
52
|
+
ReactNativeIsland(const winrt::Microsoft::ReactNative::Composition::PortalComponentView &portal) noexcept;
|
|
53
|
+
|
|
54
|
+
static winrt::Microsoft::ReactNative::ReactNativeIsland CreatePortal(
|
|
55
|
+
const winrt::Microsoft::ReactNative::Composition::PortalComponentView &portal) noexcept;
|
|
55
56
|
winrt::Microsoft::UI::Content::ContentIsland Island();
|
|
56
57
|
|
|
57
58
|
// property ReactViewHost
|
|
58
59
|
ReactNative::IReactViewHost ReactViewHost() noexcept;
|
|
59
|
-
void ReactViewHost(ReactNative::IReactViewHost const &value)
|
|
60
|
+
void ReactViewHost(ReactNative::IReactViewHost const &value);
|
|
60
61
|
|
|
61
62
|
winrt::Microsoft::UI::Composition::Visual RootVisual() noexcept;
|
|
62
63
|
|
|
@@ -104,7 +105,8 @@ struct ReactNativeIsland
|
|
|
104
105
|
winrt::Microsoft::ReactNative::FocusNavigationResult NavigateFocus(
|
|
105
106
|
const winrt::Microsoft::ReactNative::FocusNavigationRequest &request) noexcept;
|
|
106
107
|
|
|
107
|
-
winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView
|
|
108
|
+
winrt::com_ptr<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>
|
|
109
|
+
GetComponentView() noexcept;
|
|
108
110
|
|
|
109
111
|
int64_t RootTag() const noexcept;
|
|
110
112
|
|
|
@@ -153,8 +155,12 @@ struct ReactNativeIsland
|
|
|
153
155
|
bool m_hasRenderedVisual{false};
|
|
154
156
|
bool m_showingLoadingUI{false};
|
|
155
157
|
bool m_mounted{false};
|
|
158
|
+
winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::PortalComponentView> m_portal{nullptr};
|
|
156
159
|
IReactDispatcher m_uiDispatcher{nullptr};
|
|
157
160
|
winrt::IInspectable m_uiaProvider{nullptr};
|
|
161
|
+
|
|
162
|
+
// This is the surfaceId that this island belongs to.
|
|
163
|
+
// In the case of portal content root, this will be the surfaceId that contains the portal.
|
|
158
164
|
int64_t m_rootTag{-1};
|
|
159
165
|
float m_scaleFactor{1.0};
|
|
160
166
|
float m_textScaleMultiplier{1.0};
|
|
@@ -17,7 +17,8 @@ namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
|
17
17
|
RootComponentView::RootComponentView(
|
|
18
18
|
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
19
19
|
facebook::react::Tag tag,
|
|
20
|
-
winrt::Microsoft::ReactNative::ReactContext const &reactContext
|
|
20
|
+
winrt::Microsoft::ReactNative::ReactContext const &reactContext,
|
|
21
|
+
ReactCompositionViewComponentBuilder *builder)
|
|
21
22
|
: base_type(
|
|
22
23
|
{}, // default viewProps
|
|
23
24
|
compContext,
|
|
@@ -25,20 +26,34 @@ RootComponentView::RootComponentView(
|
|
|
25
26
|
reactContext,
|
|
26
27
|
ComponentViewFeatures::Default &
|
|
27
28
|
~(ComponentViewFeatures::Background | ComponentViewFeatures::ShadowProps |
|
|
28
|
-
ComponentViewFeatures::NativeBorder | ComponentViewFeatures::FocusVisual)
|
|
29
|
+
ComponentViewFeatures::NativeBorder | ComponentViewFeatures::FocusVisual),
|
|
30
|
+
builder) {}
|
|
31
|
+
|
|
32
|
+
RootComponentView::RootComponentView(
|
|
33
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
34
|
+
const winrt::Microsoft::ReactNative::Composition::PortalComponentView &portal,
|
|
35
|
+
winrt::Microsoft::ReactNative::ReactContext const &reactContext)
|
|
36
|
+
: base_type(
|
|
37
|
+
{}, // default viewProps
|
|
38
|
+
compContext,
|
|
39
|
+
-1,
|
|
40
|
+
reactContext,
|
|
41
|
+
ComponentViewFeatures::Default &
|
|
42
|
+
~(ComponentViewFeatures::Background | ComponentViewFeatures::ShadowProps |
|
|
43
|
+
ComponentViewFeatures::NativeBorder | ComponentViewFeatures::FocusVisual),
|
|
44
|
+
nullptr // builder,
|
|
45
|
+
),
|
|
46
|
+
m_wkPortal(portal) {}
|
|
29
47
|
|
|
30
48
|
RootComponentView::~RootComponentView() {
|
|
31
|
-
|
|
32
|
-
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(rootView)->RemoveRenderedVisual(
|
|
33
|
-
OuterVisual());
|
|
34
|
-
}
|
|
49
|
+
stop();
|
|
35
50
|
}
|
|
36
51
|
|
|
37
52
|
winrt::Microsoft::ReactNative::ComponentView RootComponentView::Create(
|
|
38
53
|
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
39
54
|
facebook::react::Tag tag,
|
|
40
55
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept {
|
|
41
|
-
return winrt::make<RootComponentView>(compContext, tag, reactContext);
|
|
56
|
+
return winrt::make<RootComponentView>(compContext, tag, reactContext, nullptr);
|
|
42
57
|
}
|
|
43
58
|
|
|
44
59
|
RootComponentView *RootComponentView::rootComponentView() const noexcept {
|
|
@@ -84,13 +99,13 @@ void RootComponentView::SetFocusedComponent(const winrt::Microsoft::ReactNative:
|
|
|
84
99
|
|
|
85
100
|
bool RootComponentView::NavigateFocus(const winrt::Microsoft::ReactNative::FocusNavigationRequest &request) noexcept {
|
|
86
101
|
if (request.Reason() == winrt::Microsoft::ReactNative::FocusNavigationReason::Restore) {
|
|
87
|
-
|
|
88
|
-
|
|
102
|
+
if (m_focusedComponent)
|
|
103
|
+
return true;
|
|
89
104
|
}
|
|
90
105
|
|
|
91
|
-
auto view = (request.Reason() == winrt::Microsoft::ReactNative::FocusNavigationReason::
|
|
92
|
-
? FocusManager::
|
|
93
|
-
: FocusManager::
|
|
106
|
+
auto view = (request.Reason() == winrt::Microsoft::ReactNative::FocusNavigationReason::Last)
|
|
107
|
+
? FocusManager::FindLastFocusableElement(*this)
|
|
108
|
+
: FocusManager::FindFirstFocusableElement(*this);
|
|
94
109
|
if (view) {
|
|
95
110
|
TrySetFocusedComponent(
|
|
96
111
|
view,
|
|
@@ -116,8 +131,10 @@ bool RootComponentView::TrySetFocusedComponent(
|
|
|
116
131
|
selfView = winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(target);
|
|
117
132
|
}
|
|
118
133
|
|
|
119
|
-
if (selfView && selfView->rootComponentView() != this)
|
|
134
|
+
if (selfView && selfView->rootComponentView() != this) {
|
|
135
|
+
assert(false);
|
|
120
136
|
return false;
|
|
137
|
+
}
|
|
121
138
|
|
|
122
139
|
auto losingFocusArgs = winrt::make<winrt::Microsoft::ReactNative::implementation::LosingFocusEventArgs>(
|
|
123
140
|
target, direction, m_focusedComponent, target);
|
|
@@ -197,7 +214,7 @@ HRESULT RootComponentView::GetFragmentRoot(IRawElementProviderFragmentRoot **pRe
|
|
|
197
214
|
if (uiManager == nullptr)
|
|
198
215
|
return UIA_E_ELEMENTNOTAVAILABLE;
|
|
199
216
|
|
|
200
|
-
auto rootView
|
|
217
|
+
auto rootView = m_wkRootView.get();
|
|
201
218
|
if (!rootView) {
|
|
202
219
|
return UIA_E_ELEMENTNOTAVAILABLE;
|
|
203
220
|
}
|
|
@@ -214,10 +231,43 @@ uint32_t RootComponentView::overlayIndex() noexcept {
|
|
|
214
231
|
return 1;
|
|
215
232
|
}
|
|
216
233
|
|
|
217
|
-
void RootComponentView::start(const winrt::Microsoft::ReactNative::ReactNativeIsland &
|
|
218
|
-
winrt::get_self<winrt::Microsoft::ReactNative::implementation::
|
|
234
|
+
void RootComponentView::start(const winrt::Microsoft::ReactNative::ReactNativeIsland &island) noexcept {
|
|
235
|
+
theme(winrt::get_self<winrt::Microsoft::ReactNative::Composition::implementation::Theme>(island.Theme()));
|
|
236
|
+
|
|
237
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(island)->AddRenderedVisual(
|
|
219
238
|
OuterVisual());
|
|
220
|
-
|
|
239
|
+
m_visualAddedToIsland = true;
|
|
240
|
+
ReactNativeIsland(island);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
void RootComponentView::stop() noexcept {
|
|
244
|
+
SetFocusedComponent(nullptr);
|
|
245
|
+
if (m_visualAddedToIsland) {
|
|
246
|
+
if (auto rootView = m_wkRootView.get()) {
|
|
247
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(rootView)->RemoveRenderedVisual(
|
|
248
|
+
OuterVisual());
|
|
249
|
+
}
|
|
250
|
+
m_visualAddedToIsland = false;
|
|
251
|
+
}
|
|
252
|
+
// Disconnect from the Island. In case of an instance reload, the island may now
|
|
253
|
+
// be attached to a new RootComponentView, so we should stop interacting with it.
|
|
254
|
+
ReactNativeIsland(nullptr);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
void RootComponentView::ReactNativeIsland(const winrt::Microsoft::ReactNative::ReactNativeIsland &island) noexcept {
|
|
258
|
+
m_wkRootView = island;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
winrt::Microsoft::ReactNative::ReactNativeIsland RootComponentView::ReactNativeIsland() noexcept {
|
|
262
|
+
return m_wkRootView.get();
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
winrt::Microsoft::ReactNative::Composition::PortalComponentView RootComponentView::Portal() const noexcept {
|
|
266
|
+
return m_wkPortal.get();
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
facebook::react::Point RootComponentView::getClientOffset() const noexcept {
|
|
270
|
+
return {};
|
|
221
271
|
}
|
|
222
272
|
|
|
223
273
|
winrt::IInspectable RootComponentView::UiaProviderFromPoint(const POINT &ptPixels) noexcept {
|
|
@@ -226,6 +276,10 @@ winrt::IInspectable RootComponentView::UiaProviderFromPoint(const POINT &ptPixel
|
|
|
226
276
|
static_cast<facebook::react::Float>(ptPixels.y) / m_layoutMetrics.pointScaleFactor};
|
|
227
277
|
|
|
228
278
|
facebook::react::Point localPt;
|
|
279
|
+
|
|
280
|
+
// In the case of a sub rootview, we may have a non-zero origin. hitTest takes a pt in the parent coords, so we need
|
|
281
|
+
// to apply the current origin
|
|
282
|
+
ptDips += m_layoutMetrics.frame.origin;
|
|
229
283
|
auto tag = hitTest(ptDips, localPt, true);
|
|
230
284
|
|
|
231
285
|
auto uiManager = ::Microsoft::ReactNative::FabricUIManager::FromProperties(m_reactContext.Properties());
|
|
@@ -46,6 +46,12 @@ struct RootComponentView : RootComponentViewT<RootComponentView, ViewComponentVi
|
|
|
46
46
|
// Index that visuals can be inserted into OuterVisual for debugging UI
|
|
47
47
|
uint32_t overlayIndex() noexcept;
|
|
48
48
|
void start(const winrt::Microsoft::ReactNative::ReactNativeIsland &rootView) noexcept;
|
|
49
|
+
void stop() noexcept;
|
|
50
|
+
|
|
51
|
+
void ReactNativeIsland(const winrt::Microsoft::ReactNative::ReactNativeIsland &rootView) noexcept;
|
|
52
|
+
winrt::Microsoft::ReactNative::ReactNativeIsland ReactNativeIsland() noexcept;
|
|
53
|
+
|
|
54
|
+
facebook::react::Point getClientOffset() const noexcept override;
|
|
49
55
|
|
|
50
56
|
HRESULT GetFragmentRoot(IRawElementProviderFragmentRoot **pRetVal) noexcept;
|
|
51
57
|
winrt::Microsoft::ReactNative::implementation::ClipState getClipState() noexcept override;
|
|
@@ -60,8 +66,16 @@ struct RootComponentView : RootComponentViewT<RootComponentView, ViewComponentVi
|
|
|
60
66
|
RootComponentView(
|
|
61
67
|
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
62
68
|
facebook::react::Tag tag,
|
|
69
|
+
winrt::Microsoft::ReactNative::ReactContext const &reactContext,
|
|
70
|
+
ReactCompositionViewComponentBuilder *builder);
|
|
71
|
+
|
|
72
|
+
RootComponentView(
|
|
73
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
74
|
+
const winrt::Microsoft::ReactNative::Composition::PortalComponentView &portal,
|
|
63
75
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext);
|
|
64
76
|
|
|
77
|
+
winrt::Microsoft::ReactNative::Composition::PortalComponentView Portal() const noexcept;
|
|
78
|
+
|
|
65
79
|
virtual ~RootComponentView();
|
|
66
80
|
|
|
67
81
|
winrt::Microsoft::ReactNative::ComponentView FindFirstFocusableElement() noexcept;
|
|
@@ -75,6 +89,8 @@ struct RootComponentView : RootComponentViewT<RootComponentView, ViewComponentVi
|
|
|
75
89
|
// happening.
|
|
76
90
|
winrt::Microsoft::ReactNative::ComponentView m_focusedComponent{nullptr};
|
|
77
91
|
winrt::weak_ref<winrt::Microsoft::ReactNative::ReactNativeIsland> m_wkRootView{nullptr};
|
|
92
|
+
winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::PortalComponentView> m_wkPortal{nullptr};
|
|
93
|
+
bool m_visualAddedToIsland{false};
|
|
78
94
|
};
|
|
79
95
|
|
|
80
96
|
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h
CHANGED
|
@@ -20,11 +20,8 @@ namespace facebook::react {
|
|
|
20
20
|
class WindowsTextInputComponentDescriptor final : public ConcreteComponentDescriptor<WindowsTextInputShadowNode> {
|
|
21
21
|
public:
|
|
22
22
|
WindowsTextInputComponentDescriptor(const ComponentDescriptorParameters ¶meters)
|
|
23
|
-
: ConcreteComponentDescriptor<WindowsTextInputShadowNode>(parameters)
|
|
24
|
-
|
|
25
|
-
// a shared `TextLayoutManager`.
|
|
26
|
-
m_textLayoutManager = std::make_shared<TextLayoutManager>(contextContainer_);
|
|
27
|
-
}
|
|
23
|
+
: ConcreteComponentDescriptor<WindowsTextInputShadowNode>(parameters),
|
|
24
|
+
textLayoutManager_(std::make_shared<TextLayoutManager>(contextContainer_)) {}
|
|
28
25
|
|
|
29
26
|
/*
|
|
30
27
|
virtual State::Shared createInitialState(
|
|
@@ -71,11 +68,9 @@ virtual State::Shared createInitialState(
|
|
|
71
68
|
void adopt(ShadowNode &shadowNode) const override {
|
|
72
69
|
auto &textInputShadowNode = static_cast<WindowsTextInputShadowNode &>(shadowNode);
|
|
73
70
|
|
|
74
|
-
// `
|
|
71
|
+
// `TextInputShadowNode` uses `TextLayoutManager` to measure text content
|
|
75
72
|
// and communicate text rendering metrics to mounting layer.
|
|
76
|
-
textInputShadowNode.setTextLayoutManager(
|
|
77
|
-
|
|
78
|
-
textInputShadowNode.setContextContainer(const_cast<ContextContainer *>(getContextContainer().get()));
|
|
73
|
+
textInputShadowNode.setTextLayoutManager(textLayoutManager_);
|
|
79
74
|
|
|
80
75
|
/*
|
|
81
76
|
int surfaceId = textInputShadowNode.getSurfaceId();
|
|
@@ -161,7 +156,7 @@ virtual State::Shared createInitialState(
|
|
|
161
156
|
// TODO T68526882: Unify with Binding::UIManagerJavaDescriptor
|
|
162
157
|
constexpr static auto UIManagerJavaDescriptor = "com/facebook/react/fabric/FabricUIManager";
|
|
163
158
|
|
|
164
|
-
|
|
159
|
+
const std::shared_ptr<TextLayoutManager> textLayoutManager_;
|
|
165
160
|
mutable std::unordered_map<int, ThemePadding> surfaceIdToThemePaddingMap_;
|
|
166
161
|
};
|
|
167
162
|
|