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,267 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
* This file is auto-generated from AndroidSwitchNativeComponent spec file in flow / TypeScript.
|
|
4
|
+
*/
|
|
5
|
+
// clang-format off
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include <NativeModules.h>
|
|
9
|
+
|
|
10
|
+
#ifdef RNW_NEW_ARCH
|
|
11
|
+
#include <JSValueComposition.h>
|
|
12
|
+
|
|
13
|
+
#include <winrt/Microsoft.ReactNative.Composition.h>
|
|
14
|
+
#include <winrt/Microsoft.UI.Composition.h>
|
|
15
|
+
#endif // #ifdef RNW_NEW_ARCH
|
|
16
|
+
|
|
17
|
+
#ifdef RNW_NEW_ARCH
|
|
18
|
+
|
|
19
|
+
namespace Microsoft::ReactNativeSpecs {
|
|
20
|
+
|
|
21
|
+
REACT_STRUCT(AndroidSwitchProps)
|
|
22
|
+
struct AndroidSwitchProps : winrt::implements<AndroidSwitchProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
|
23
|
+
AndroidSwitchProps(winrt::Microsoft::ReactNative::ViewProps props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom)
|
|
24
|
+
: ViewProps(props)
|
|
25
|
+
{
|
|
26
|
+
if (cloneFrom) {
|
|
27
|
+
auto cloneFromProps = cloneFrom.as<AndroidSwitchProps>();
|
|
28
|
+
disabled = cloneFromProps->disabled;
|
|
29
|
+
enabled = cloneFromProps->enabled;
|
|
30
|
+
thumbColor = cloneFromProps->thumbColor;
|
|
31
|
+
trackColorForFalse = cloneFromProps->trackColorForFalse;
|
|
32
|
+
trackColorForTrue = cloneFromProps->trackColorForTrue;
|
|
33
|
+
value = cloneFromProps->value;
|
|
34
|
+
on = cloneFromProps->on;
|
|
35
|
+
thumbTintColor = cloneFromProps->thumbTintColor;
|
|
36
|
+
trackTintColor = cloneFromProps->trackTintColor;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
|
41
|
+
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
REACT_FIELD(disabled)
|
|
45
|
+
std::optional<bool> disabled{};
|
|
46
|
+
|
|
47
|
+
REACT_FIELD(enabled)
|
|
48
|
+
bool enabled{true};
|
|
49
|
+
|
|
50
|
+
REACT_FIELD(thumbColor)
|
|
51
|
+
winrt::Microsoft::ReactNative::Color thumbColor{nullptr};
|
|
52
|
+
|
|
53
|
+
REACT_FIELD(trackColorForFalse)
|
|
54
|
+
winrt::Microsoft::ReactNative::Color trackColorForFalse{nullptr};
|
|
55
|
+
|
|
56
|
+
REACT_FIELD(trackColorForTrue)
|
|
57
|
+
winrt::Microsoft::ReactNative::Color trackColorForTrue{nullptr};
|
|
58
|
+
|
|
59
|
+
REACT_FIELD(value)
|
|
60
|
+
std::optional<bool> value{};
|
|
61
|
+
|
|
62
|
+
REACT_FIELD(on)
|
|
63
|
+
std::optional<bool> on{};
|
|
64
|
+
|
|
65
|
+
REACT_FIELD(thumbTintColor)
|
|
66
|
+
winrt::Microsoft::ReactNative::Color thumbTintColor{nullptr};
|
|
67
|
+
|
|
68
|
+
REACT_FIELD(trackTintColor)
|
|
69
|
+
winrt::Microsoft::ReactNative::Color trackTintColor{nullptr};
|
|
70
|
+
|
|
71
|
+
const winrt::Microsoft::ReactNative::ViewProps ViewProps;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
REACT_STRUCT(AndroidSwitch_OnChange)
|
|
75
|
+
struct AndroidSwitch_OnChange {
|
|
76
|
+
REACT_FIELD(value)
|
|
77
|
+
bool value{};
|
|
78
|
+
|
|
79
|
+
REACT_FIELD(target)
|
|
80
|
+
int32_t target{};
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
struct AndroidSwitchEventEmitter {
|
|
84
|
+
AndroidSwitchEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
|
|
85
|
+
: m_eventEmitter(eventEmitter) {}
|
|
86
|
+
|
|
87
|
+
using OnChange = AndroidSwitch_OnChange;
|
|
88
|
+
|
|
89
|
+
void onChange(OnChange &value) const {
|
|
90
|
+
m_eventEmitter.DispatchEvent(L"change", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
|
|
91
|
+
winrt::Microsoft::ReactNative::WriteValue(writer, value);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private:
|
|
96
|
+
winrt::Microsoft::ReactNative::EventEmitter m_eventEmitter{nullptr};
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
template<typename TUserData>
|
|
100
|
+
struct BaseAndroidSwitch {
|
|
101
|
+
|
|
102
|
+
virtual void UpdateProps(
|
|
103
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
104
|
+
const winrt::com_ptr<AndroidSwitchProps> &newProps,
|
|
105
|
+
const winrt::com_ptr<AndroidSwitchProps> &/*oldProps*/) noexcept {
|
|
106
|
+
m_props = newProps;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// UpdateLayoutMetrics will only be called if this method is overridden
|
|
110
|
+
virtual void UpdateLayoutMetrics(
|
|
111
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
112
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &/*newLayoutMetrics*/,
|
|
113
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &/*oldLayoutMetrics*/) noexcept {
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// UpdateState will only be called if this method is overridden
|
|
117
|
+
virtual void UpdateState(
|
|
118
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
119
|
+
const winrt::Microsoft::ReactNative::IComponentState &/*newState*/) noexcept {
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
virtual void UpdateEventEmitter(const std::shared_ptr<AndroidSwitchEventEmitter> &eventEmitter) noexcept {
|
|
123
|
+
m_eventEmitter = eventEmitter;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// MountChildComponentView will only be called if this method is overridden
|
|
127
|
+
virtual void MountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
128
|
+
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &/*args*/) noexcept {
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// UnmountChildComponentView will only be called if this method is overridden
|
|
132
|
+
virtual void UnmountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
133
|
+
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &/*args*/) noexcept {
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Initialize will only be called if this method is overridden
|
|
137
|
+
virtual void Initialize(const winrt::Microsoft::ReactNative::ComponentView &/*view*/) noexcept {
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// CreateVisual will only be called if this method is overridden
|
|
141
|
+
virtual winrt::Microsoft::UI::Composition::Visual CreateVisual(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
142
|
+
return view.as<winrt::Microsoft::ReactNative::Composition::ComponentView>().Compositor().CreateSpriteVisual();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// FinalizeUpdate will only be called if this method is overridden
|
|
146
|
+
virtual void FinalizeUpdate(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
147
|
+
winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept {
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// You must provide an implementation of this method to handle the "setNativeValue" command
|
|
151
|
+
virtual void HandleSetNativeValueCommand(bool value) noexcept = 0;
|
|
152
|
+
|
|
153
|
+
void HandleCommand(const winrt::Microsoft::ReactNative::ComponentView &view, const winrt::Microsoft::ReactNative::HandleCommandArgs& args) noexcept {
|
|
154
|
+
auto userData = view.UserData().as<TUserData>();
|
|
155
|
+
auto commandName = args.CommandName();
|
|
156
|
+
if (commandName == L"setNativeValue") {
|
|
157
|
+
bool value;
|
|
158
|
+
winrt::Microsoft::ReactNative::ReadArgs(args.CommandArgs(), value);
|
|
159
|
+
userData->HandleSetNativeValueCommand(value);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const std::shared_ptr<AndroidSwitchEventEmitter>& EventEmitter() const { return m_eventEmitter; }
|
|
165
|
+
const winrt::com_ptr<AndroidSwitchProps>& Props() const { return m_props; }
|
|
166
|
+
|
|
167
|
+
private:
|
|
168
|
+
winrt::com_ptr<AndroidSwitchProps> m_props;
|
|
169
|
+
std::shared_ptr<AndroidSwitchEventEmitter> m_eventEmitter;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
template <typename TUserData>
|
|
173
|
+
void RegisterAndroidSwitchNativeComponent(
|
|
174
|
+
winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder,
|
|
175
|
+
std::function<void(const winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder&)> builderCallback) noexcept {
|
|
176
|
+
packageBuilder.as<winrt::Microsoft::ReactNative::IReactPackageBuilderFabric>().AddViewComponent(
|
|
177
|
+
L"AndroidSwitch", [builderCallback](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
|
178
|
+
auto compBuilder = builder.as<winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder>();
|
|
179
|
+
|
|
180
|
+
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props,
|
|
181
|
+
const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) noexcept {
|
|
182
|
+
return winrt::make<AndroidSwitchProps>(props, cloneFrom);
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
builder.SetUpdatePropsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
186
|
+
const winrt::Microsoft::ReactNative::IComponentProps &newProps,
|
|
187
|
+
const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept {
|
|
188
|
+
auto userData = view.UserData().as<TUserData>();
|
|
189
|
+
userData->UpdateProps(view, newProps ? newProps.as<AndroidSwitchProps>() : nullptr, oldProps ? oldProps.as<AndroidSwitchProps>() : nullptr);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
compBuilder.SetUpdateLayoutMetricsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
193
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &newLayoutMetrics,
|
|
194
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &oldLayoutMetrics) noexcept {
|
|
195
|
+
auto userData = view.UserData().as<TUserData>();
|
|
196
|
+
userData->UpdateLayoutMetrics(view, newLayoutMetrics, oldLayoutMetrics);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
builder.SetUpdateEventEmitterHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
200
|
+
const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter) noexcept {
|
|
201
|
+
auto userData = view.UserData().as<TUserData>();
|
|
202
|
+
userData->UpdateEventEmitter(std::make_shared<AndroidSwitchEventEmitter>(eventEmitter));
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
if constexpr (&TUserData::FinalizeUpdate != &BaseAndroidSwitch<TUserData>::FinalizeUpdate) {
|
|
206
|
+
builder.SetFinalizeUpdateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
207
|
+
winrt::Microsoft::ReactNative::ComponentViewUpdateMask mask) noexcept {
|
|
208
|
+
auto userData = view.UserData().as<TUserData>();
|
|
209
|
+
userData->FinalizeUpdate(view, mask);
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if constexpr (&TUserData::UpdateState != &BaseAndroidSwitch<TUserData>::UpdateState) {
|
|
214
|
+
builder.SetUpdateStateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
215
|
+
const winrt::Microsoft::ReactNative::IComponentState &newState) noexcept {
|
|
216
|
+
auto userData = view.UserData().as<TUserData>();
|
|
217
|
+
userData->member(view, newState);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
builder.SetCustomCommandHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
222
|
+
const winrt::Microsoft::ReactNative::HandleCommandArgs& args) noexcept {
|
|
223
|
+
auto userData = view.UserData().as<TUserData>();
|
|
224
|
+
userData->HandleCommand(view, args);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
if constexpr (&TUserData::MountChildComponentView != &BaseAndroidSwitch<TUserData>::MountChildComponentView) {
|
|
228
|
+
builder.SetMountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
229
|
+
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &args) noexcept {
|
|
230
|
+
auto userData = view.UserData().as<TUserData>();
|
|
231
|
+
return userData->MountChildComponentView(view, args);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if constexpr (&TUserData::UnmountChildComponentView != &BaseAndroidSwitch<TUserData>::UnmountChildComponentView) {
|
|
236
|
+
builder.SetUnmountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
237
|
+
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &args) noexcept {
|
|
238
|
+
auto userData = view.UserData().as<TUserData>();
|
|
239
|
+
return userData->UnmountChildComponentView(view, args);
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
244
|
+
auto userData = winrt::make_self<TUserData>();
|
|
245
|
+
if constexpr (&TUserData::Initialize != &BaseAndroidSwitch<TUserData>::Initialize) {
|
|
246
|
+
userData->Initialize(view);
|
|
247
|
+
}
|
|
248
|
+
view.UserData(*userData);
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
if constexpr (&TUserData::CreateVisual != &BaseAndroidSwitch<TUserData>::CreateVisual) {
|
|
252
|
+
compBuilder.SetCreateVisualHandler([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
253
|
+
auto userData = view.UserData().as<TUserData>();
|
|
254
|
+
return userData->CreateVisual(view);
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// Allow app to further customize the builder
|
|
259
|
+
if (builderCallback) {
|
|
260
|
+
builderCallback(compBuilder);
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
} // namespace Microsoft::ReactNativeSpecs
|
|
266
|
+
|
|
267
|
+
#endif // #ifdef RNW_NEW_ARCH
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
* This file is auto-generated from DebuggingOverlayNativeComponent spec file in flow / TypeScript.
|
|
4
|
+
*/
|
|
5
|
+
// clang-format off
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include <NativeModules.h>
|
|
9
|
+
|
|
10
|
+
#ifdef RNW_NEW_ARCH
|
|
11
|
+
#include <JSValueComposition.h>
|
|
12
|
+
|
|
13
|
+
#include <winrt/Microsoft.ReactNative.Composition.h>
|
|
14
|
+
#include <winrt/Microsoft.UI.Composition.h>
|
|
15
|
+
#endif // #ifdef RNW_NEW_ARCH
|
|
16
|
+
|
|
17
|
+
#ifdef RNW_NEW_ARCH
|
|
18
|
+
|
|
19
|
+
namespace Microsoft::ReactNativeSpecs {
|
|
20
|
+
|
|
21
|
+
REACT_STRUCT(DebuggingOverlayProps)
|
|
22
|
+
struct DebuggingOverlayProps : winrt::implements<DebuggingOverlayProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
|
23
|
+
DebuggingOverlayProps(winrt::Microsoft::ReactNative::ViewProps props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom)
|
|
24
|
+
: ViewProps(props)
|
|
25
|
+
{
|
|
26
|
+
if (cloneFrom) {
|
|
27
|
+
auto cloneFromProps = cloneFrom.as<DebuggingOverlayProps>();
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
|
33
|
+
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const winrt::Microsoft::ReactNative::ViewProps ViewProps;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
struct DebuggingOverlayEventEmitter {
|
|
40
|
+
DebuggingOverlayEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
|
|
41
|
+
: m_eventEmitter(eventEmitter) {}
|
|
42
|
+
|
|
43
|
+
private:
|
|
44
|
+
winrt::Microsoft::ReactNative::EventEmitter m_eventEmitter{nullptr};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
template<typename TUserData>
|
|
48
|
+
struct BaseDebuggingOverlay {
|
|
49
|
+
|
|
50
|
+
virtual void UpdateProps(
|
|
51
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
52
|
+
const winrt::com_ptr<DebuggingOverlayProps> &newProps,
|
|
53
|
+
const winrt::com_ptr<DebuggingOverlayProps> &/*oldProps*/) noexcept {
|
|
54
|
+
m_props = newProps;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// UpdateLayoutMetrics will only be called if this method is overridden
|
|
58
|
+
virtual void UpdateLayoutMetrics(
|
|
59
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
60
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &/*newLayoutMetrics*/,
|
|
61
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &/*oldLayoutMetrics*/) noexcept {
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// UpdateState will only be called if this method is overridden
|
|
65
|
+
virtual void UpdateState(
|
|
66
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
67
|
+
const winrt::Microsoft::ReactNative::IComponentState &/*newState*/) noexcept {
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
virtual void UpdateEventEmitter(const std::shared_ptr<DebuggingOverlayEventEmitter> &eventEmitter) noexcept {
|
|
71
|
+
m_eventEmitter = eventEmitter;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// MountChildComponentView will only be called if this method is overridden
|
|
75
|
+
virtual void MountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
76
|
+
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &/*args*/) noexcept {
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// UnmountChildComponentView will only be called if this method is overridden
|
|
80
|
+
virtual void UnmountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
81
|
+
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &/*args*/) noexcept {
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Initialize will only be called if this method is overridden
|
|
85
|
+
virtual void Initialize(const winrt::Microsoft::ReactNative::ComponentView &/*view*/) noexcept {
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// CreateVisual will only be called if this method is overridden
|
|
89
|
+
virtual winrt::Microsoft::UI::Composition::Visual CreateVisual(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
90
|
+
return view.as<winrt::Microsoft::ReactNative::Composition::ComponentView>().Compositor().CreateSpriteVisual();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// FinalizeUpdate will only be called if this method is overridden
|
|
94
|
+
virtual void FinalizeUpdate(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
95
|
+
winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept {
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// You must provide an implementation of this method to handle the "highlightTraceUpdates" command
|
|
99
|
+
virtual void HandleHighlightTraceUpdatesCommand(std::vector<winrt::Microsoft::ReactNative::JSValue> updates) noexcept = 0;
|
|
100
|
+
|
|
101
|
+
// You must provide an implementation of this method to handle the "highlightElements" command
|
|
102
|
+
virtual void HandleHighlightElementsCommand(std::vector<winrt::Microsoft::ReactNative::JSValue> elements) noexcept = 0;
|
|
103
|
+
|
|
104
|
+
// You must provide an implementation of this method to handle the "clearElementsHighlights" command
|
|
105
|
+
virtual void HandleClearElementsHighlightsCommand() noexcept = 0;
|
|
106
|
+
|
|
107
|
+
void HandleCommand(const winrt::Microsoft::ReactNative::ComponentView &view, const winrt::Microsoft::ReactNative::HandleCommandArgs& args) noexcept {
|
|
108
|
+
auto userData = view.UserData().as<TUserData>();
|
|
109
|
+
auto commandName = args.CommandName();
|
|
110
|
+
if (commandName == L"highlightTraceUpdates") {
|
|
111
|
+
std::vector<winrt::Microsoft::ReactNative::JSValue> updates;
|
|
112
|
+
winrt::Microsoft::ReactNative::ReadArgs(args.CommandArgs(), updates);
|
|
113
|
+
userData->HandleHighlightTraceUpdatesCommand(updates);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (commandName == L"highlightElements") {
|
|
118
|
+
std::vector<winrt::Microsoft::ReactNative::JSValue> elements;
|
|
119
|
+
winrt::Microsoft::ReactNative::ReadArgs(args.CommandArgs(), elements);
|
|
120
|
+
userData->HandleHighlightElementsCommand(elements);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (commandName == L"clearElementsHighlights") {
|
|
125
|
+
|
|
126
|
+
userData->HandleClearElementsHighlightsCommand();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const std::shared_ptr<DebuggingOverlayEventEmitter>& EventEmitter() const { return m_eventEmitter; }
|
|
132
|
+
const winrt::com_ptr<DebuggingOverlayProps>& Props() const { return m_props; }
|
|
133
|
+
|
|
134
|
+
private:
|
|
135
|
+
winrt::com_ptr<DebuggingOverlayProps> m_props;
|
|
136
|
+
std::shared_ptr<DebuggingOverlayEventEmitter> m_eventEmitter;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
template <typename TUserData>
|
|
140
|
+
void RegisterDebuggingOverlayNativeComponent(
|
|
141
|
+
winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder,
|
|
142
|
+
std::function<void(const winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder&)> builderCallback) noexcept {
|
|
143
|
+
packageBuilder.as<winrt::Microsoft::ReactNative::IReactPackageBuilderFabric>().AddViewComponent(
|
|
144
|
+
L"DebuggingOverlay", [builderCallback](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
|
145
|
+
auto compBuilder = builder.as<winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder>();
|
|
146
|
+
|
|
147
|
+
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props,
|
|
148
|
+
const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) noexcept {
|
|
149
|
+
return winrt::make<DebuggingOverlayProps>(props, cloneFrom);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
builder.SetUpdatePropsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
153
|
+
const winrt::Microsoft::ReactNative::IComponentProps &newProps,
|
|
154
|
+
const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept {
|
|
155
|
+
auto userData = view.UserData().as<TUserData>();
|
|
156
|
+
userData->UpdateProps(view, newProps ? newProps.as<DebuggingOverlayProps>() : nullptr, oldProps ? oldProps.as<DebuggingOverlayProps>() : nullptr);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
compBuilder.SetUpdateLayoutMetricsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
160
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &newLayoutMetrics,
|
|
161
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &oldLayoutMetrics) noexcept {
|
|
162
|
+
auto userData = view.UserData().as<TUserData>();
|
|
163
|
+
userData->UpdateLayoutMetrics(view, newLayoutMetrics, oldLayoutMetrics);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
builder.SetUpdateEventEmitterHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
167
|
+
const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter) noexcept {
|
|
168
|
+
auto userData = view.UserData().as<TUserData>();
|
|
169
|
+
userData->UpdateEventEmitter(std::make_shared<DebuggingOverlayEventEmitter>(eventEmitter));
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
if constexpr (&TUserData::FinalizeUpdate != &BaseDebuggingOverlay<TUserData>::FinalizeUpdate) {
|
|
173
|
+
builder.SetFinalizeUpdateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
174
|
+
winrt::Microsoft::ReactNative::ComponentViewUpdateMask mask) noexcept {
|
|
175
|
+
auto userData = view.UserData().as<TUserData>();
|
|
176
|
+
userData->FinalizeUpdate(view, mask);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if constexpr (&TUserData::UpdateState != &BaseDebuggingOverlay<TUserData>::UpdateState) {
|
|
181
|
+
builder.SetUpdateStateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
182
|
+
const winrt::Microsoft::ReactNative::IComponentState &newState) noexcept {
|
|
183
|
+
auto userData = view.UserData().as<TUserData>();
|
|
184
|
+
userData->member(view, newState);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
builder.SetCustomCommandHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
189
|
+
const winrt::Microsoft::ReactNative::HandleCommandArgs& args) noexcept {
|
|
190
|
+
auto userData = view.UserData().as<TUserData>();
|
|
191
|
+
userData->HandleCommand(view, args);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
if constexpr (&TUserData::MountChildComponentView != &BaseDebuggingOverlay<TUserData>::MountChildComponentView) {
|
|
195
|
+
builder.SetMountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
196
|
+
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &args) noexcept {
|
|
197
|
+
auto userData = view.UserData().as<TUserData>();
|
|
198
|
+
return userData->MountChildComponentView(view, args);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if constexpr (&TUserData::UnmountChildComponentView != &BaseDebuggingOverlay<TUserData>::UnmountChildComponentView) {
|
|
203
|
+
builder.SetUnmountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
204
|
+
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &args) noexcept {
|
|
205
|
+
auto userData = view.UserData().as<TUserData>();
|
|
206
|
+
return userData->UnmountChildComponentView(view, args);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
211
|
+
auto userData = winrt::make_self<TUserData>();
|
|
212
|
+
if constexpr (&TUserData::Initialize != &BaseDebuggingOverlay<TUserData>::Initialize) {
|
|
213
|
+
userData->Initialize(view);
|
|
214
|
+
}
|
|
215
|
+
view.UserData(*userData);
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
if constexpr (&TUserData::CreateVisual != &BaseDebuggingOverlay<TUserData>::CreateVisual) {
|
|
219
|
+
compBuilder.SetCreateVisualHandler([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
220
|
+
auto userData = view.UserData().as<TUserData>();
|
|
221
|
+
return userData->CreateVisual(view);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Allow app to further customize the builder
|
|
226
|
+
if (builderCallback) {
|
|
227
|
+
builderCallback(compBuilder);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
} // namespace Microsoft::ReactNativeSpecs
|
|
233
|
+
|
|
234
|
+
#endif // #ifdef RNW_NEW_ARCH
|