react-native-windows 0.77.0 → 0.78.0-preview.2

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.
Files changed (234) hide show
  1. package/.flowconfig +1 -1
  2. package/Chakra/ChakraTracing.cpp +1 -1
  3. package/Libraries/Animated/animations/Animation.js +22 -1
  4. package/Libraries/Animated/animations/DecayAnimation.js +1 -0
  5. package/Libraries/Animated/animations/SpringAnimation.js +1 -0
  6. package/Libraries/Animated/animations/TimingAnimation.js +1 -0
  7. package/Libraries/Animated/nodes/AnimatedAddition.js +9 -2
  8. package/Libraries/Animated/nodes/AnimatedColor.js +4 -1
  9. package/Libraries/Animated/nodes/AnimatedDiffClamp.js +10 -2
  10. package/Libraries/Animated/nodes/AnimatedDivision.js +9 -2
  11. package/Libraries/Animated/nodes/AnimatedInterpolation.js +5 -1
  12. package/Libraries/Animated/nodes/AnimatedModulo.js +5 -2
  13. package/Libraries/Animated/nodes/AnimatedMultiplication.js +9 -2
  14. package/Libraries/Animated/nodes/AnimatedNode.js +25 -46
  15. package/Libraries/Animated/nodes/AnimatedObject.js +9 -2
  16. package/Libraries/Animated/nodes/AnimatedProps.js +5 -1
  17. package/Libraries/Animated/nodes/AnimatedStyle.js +5 -1
  18. package/Libraries/Animated/nodes/AnimatedSubtraction.js +9 -2
  19. package/Libraries/Animated/nodes/AnimatedTracking.js +5 -1
  20. package/Libraries/Animated/nodes/AnimatedTransform.js +5 -1
  21. package/Libraries/Animated/nodes/AnimatedValue.js +49 -4
  22. package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
  23. package/Libraries/Animated/useAnimatedProps.js +0 -43
  24. package/Libraries/Components/Button.windows.js +3 -0
  25. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +1 -1
  26. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +3 -1
  27. package/Libraries/Components/LayoutConformance/LayoutConformance.d.ts +21 -0
  28. package/Libraries/Components/LayoutConformance/LayoutConformance.js +59 -0
  29. package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +29 -0
  30. package/Libraries/Components/Pressable/Pressable.windows.js +3 -0
  31. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
  32. package/Libraries/Components/TextInput/TextInput.d.ts +5 -0
  33. package/Libraries/Components/TextInput/TextInput.flow.js +6 -0
  34. package/Libraries/Components/TextInput/TextInput.js +6 -0
  35. package/Libraries/Components/TextInput/TextInput.windows.js +9 -0
  36. package/Libraries/Components/Touchable/TouchableBounce.windows.js +2 -0
  37. package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +2 -0
  38. package/Libraries/Components/Touchable/TouchableOpacity.windows.js +2 -0
  39. package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +2 -0
  40. package/Libraries/Components/View/View.windows.js +3 -0
  41. package/Libraries/Components/View/ViewAccessibility.d.ts +7 -2
  42. package/Libraries/Components/View/ViewAccessibility.windows.js +1 -0
  43. package/Libraries/Components/View/ViewPropTypes.d.ts +0 -7
  44. package/Libraries/Components/View/ViewPropTypes.js +0 -9
  45. package/Libraries/Components/View/ViewPropTypes.windows.js +1 -9
  46. package/Libraries/Core/ReactNativeVersion.js +2 -2
  47. package/Libraries/Core/setUpBatchedBridge.js +1 -16
  48. package/Libraries/EventEmitter/RCTEventEmitter.js +2 -6
  49. package/Libraries/Image/AssetSourceResolver.js +11 -0
  50. package/Libraries/Image/AssetSourceResolver.windows.js +11 -0
  51. package/Libraries/Image/Image.windows.js +2 -0
  52. package/Libraries/Inspector/BorderBox.js +26 -14
  53. package/Libraries/Inspector/BoxInspector.js +60 -42
  54. package/Libraries/Inspector/ElementBox.js +55 -48
  55. package/Libraries/Inspector/StyleInspector.js +36 -30
  56. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
  57. package/Libraries/Lists/FlatList.d.ts +1 -1
  58. package/Libraries/Modal/Modal.js +2 -0
  59. package/Libraries/Modal/Modal.windows.js +2 -0
  60. package/Libraries/NativeComponent/BaseViewConfig.android.js +0 -2
  61. package/Libraries/NativeComponent/BaseViewConfig.ios.js +0 -2
  62. package/Libraries/NativeComponent/BaseViewConfig.windows.js +0 -2
  63. package/Libraries/Network/RCTNetworking.android.js +24 -16
  64. package/Libraries/Network/RCTNetworking.ios.js +1 -46
  65. package/Libraries/Network/RCTNetworking.windows.js +1 -46
  66. package/Libraries/Network/RCTNetworkingEventDefinitions.flow.js +57 -0
  67. package/Libraries/ReactNative/UIManagerProperties.js +3 -1
  68. package/Libraries/Renderer/implementations/ReactFabric-dev.js +15828 -26461
  69. package/Libraries/Renderer/implementations/ReactFabric-prod.js +3907 -2560
  70. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4399 -2878
  71. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +16102 -26908
  72. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +4034 -2695
  73. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4535 -3045
  74. package/Libraries/Renderer/shims/ReactNativeTypes.js +5 -6
  75. package/Libraries/StyleSheet/processTransform.js +6 -0
  76. package/Libraries/Text/Text.d.ts +6 -1
  77. package/Libraries/Text/Text.windows.js +4 -0
  78. package/Libraries/Text/TextProps.js +2 -2
  79. package/Libraries/Text/TextProps.windows.js +3 -2
  80. package/Libraries/Utilities/BackHandler.android.js +5 -4
  81. package/Libraries/Utilities/BackHandler.ios.js +4 -5
  82. package/Libraries/Utilities/BackHandler.windows.js +5 -4
  83. package/Microsoft.ReactNative/CompositionComponentView.idl +13 -1
  84. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +0 -1
  85. package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +0 -5
  86. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +92 -17
  87. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +9 -0
  88. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +13 -33
  89. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -3
  90. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +43 -5
  91. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +2 -1
  92. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +12 -10
  93. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +11 -9
  94. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +1 -1
  95. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +191 -329
  96. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +3 -61
  97. package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.cpp +66 -0
  98. package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.h +52 -0
  99. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +21 -0
  100. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +7 -4
  101. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +79 -19
  102. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +12 -6
  103. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +71 -17
  104. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +16 -0
  105. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +5 -10
  106. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +4 -4
  107. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +138 -110
  108. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +27 -27
  109. package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +1 -1
  110. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +38 -33
  111. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +0 -2
  112. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +5 -16
  113. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +0 -3
  114. package/Microsoft.ReactNative/Fabric/ImageManager.cpp +9 -0
  115. package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +0 -2
  116. package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp +1 -1
  117. package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +5 -0
  118. package/Microsoft.ReactNative/IReactContext.cpp +2 -2
  119. package/Microsoft.ReactNative/IReactContext.h +1 -1
  120. package/Microsoft.ReactNative/IReactContext.idl +2 -2
  121. package/Microsoft.ReactNative/IReactPackageBuilder.idl +3 -3
  122. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +97 -87
  123. package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +4 -0
  124. package/Microsoft.ReactNative/Modules/AlertModule.cpp +9 -4
  125. package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.cpp +1 -1
  126. package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +32 -35
  127. package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.h +7 -4
  128. package/Microsoft.ReactNative/Modules/AppStateModule.cpp +1 -1
  129. package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +2 -2
  130. package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +2 -2
  131. package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +3 -3
  132. package/Microsoft.ReactNative/Modules/I18nManagerModule.cpp +1 -1
  133. package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +7 -5
  134. package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -1
  135. package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +10 -10
  136. package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +24 -24
  137. package/Microsoft.ReactNative/Modules/Timing.cpp +2 -2
  138. package/Microsoft.ReactNative/ReactHost/IReactInstance.h +5 -0
  139. package/Microsoft.ReactNative/ReactHost/React.h +0 -3
  140. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +39 -16
  141. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +4 -2
  142. package/Microsoft.ReactNative/ReactNativeHost.cpp +9 -4
  143. package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -1
  144. package/Microsoft.ReactNative/ReactPackageBuilder.cpp +3 -3
  145. package/Microsoft.ReactNative/ReactPackageBuilder.h +4 -4
  146. package/Microsoft.ReactNative/Utils/Helpers.cpp +0 -2
  147. package/Microsoft.ReactNative/Views/DebuggingOverlayViewManager.cpp +0 -1
  148. package/Microsoft.ReactNative/Views/DevMenu.cpp +6 -6
  149. package/Microsoft.ReactNative/Views/DevMenu.h +1 -1
  150. package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +2 -2
  151. package/Microsoft.ReactNative/Views/ViewPanel.cpp +1 -1
  152. package/Microsoft.ReactNative/Views/ViewViewManager.cpp +2 -2
  153. package/Microsoft.ReactNative/XamlUIService.cpp +13 -7
  154. package/Microsoft.ReactNative/XamlUIService.h +4 -1
  155. package/Microsoft.ReactNative/XamlUIService.idl +2 -0
  156. package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +6 -2
  157. package/Microsoft.ReactNative.Cxx/ReactContext.h +1 -1
  158. package/Microsoft.ReactNative.Cxx/XamlUtils.h +12 -0
  159. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  160. package/PropertySheets/React.Cpp.props +3 -0
  161. package/PropertySheets/WebView2.props +1 -1
  162. package/PropertySheets/WinUI.props +5 -4
  163. package/ReactCommon/ReactCommon.vcxproj +5 -1
  164. package/ReactCommon/ReactCommon.vcxproj.filters +1 -1
  165. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +3 -3
  166. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +3 -3
  167. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +91 -0
  168. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +1 -12
  169. package/{Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h → ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/textinput/TextInputState.h} +37 -35
  170. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +1 -0
  171. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +4 -0
  172. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/ImageRequestParams.h +30 -0
  173. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/runtimescheduler/SchedulerPriorityUtils.h +4 -3
  174. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/primitives.h +179 -0
  175. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +43 -57
  176. package/Shared/HermesRuntimeHolder.cpp +2 -2
  177. package/Shared/Shared.vcxitems +8 -14
  178. package/Shared/Shared.vcxitems.filters +4 -16
  179. package/Shared/Threading/BatchingQueueThread.cpp +3 -3
  180. package/codegen/NativeCPUTimeSpec.g.h +41 -0
  181. package/codegen/NativeFantomSpec.g.h +78 -0
  182. package/codegen/NativePerformanceSpec.g.h +31 -43
  183. package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +84 -84
  184. package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +212 -0
  185. package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +295 -0
  186. package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +200 -0
  187. package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +224 -0
  188. package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +250 -0
  189. package/codegen/react/components/rnwcore/AndroidSwitch.g.h +267 -0
  190. package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +234 -0
  191. package/codegen/react/components/rnwcore/InputAccessory.g.h +200 -0
  192. package/codegen/react/components/rnwcore/ModalHostView.g.h +283 -0
  193. package/codegen/react/components/rnwcore/PullToRefreshView.g.h +246 -0
  194. package/codegen/react/components/rnwcore/SafeAreaView.g.h +197 -0
  195. package/codegen/react/components/rnwcore/Switch.g.h +263 -0
  196. package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +200 -0
  197. package/codegen/rnwcoreJSI-generated.cpp +90 -57
  198. package/codegen/rnwcoreJSI.h +241 -104
  199. package/index.js +5 -0
  200. package/index.windows.js +5 -0
  201. package/just-task.js +1 -1
  202. package/package.json +25 -26
  203. package/src/private/animated/NativeAnimatedValidation.js +1 -1
  204. package/src/private/featureflags/ReactNativeFeatureFlags.js +33 -27
  205. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -5
  206. package/src/private/renderer/errorhandling/ErrorHandlers.js +12 -55
  207. package/src/private/specs/modules/{NativeJSCSamplingProfiler.js → NativeCPUTime.js} +7 -2
  208. package/src/private/specs/modules/NativeFantom.js +37 -0
  209. package/src/private/utilities/ensureInstance.js +21 -0
  210. package/src/private/webapis/dom/nodes/ReactNativeElement.js +49 -6
  211. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +17 -9
  212. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +11 -11
  213. package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +1 -1
  214. package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -1
  215. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
  216. package/src/private/webapis/performance/Performance.js +0 -12
  217. package/src/private/webapis/performance/specs/NativePerformance.js +0 -11
  218. package/types/index.d.ts +1 -0
  219. package/Libraries/HeapCapture/HeapCapture.js +0 -29
  220. package/Libraries/HeapCapture/NativeJSCHeapCapture.js +0 -13
  221. package/Libraries/Performance/NativeJSCSamplingProfiler.js +0 -13
  222. package/Libraries/Performance/SamplingProfiler.js +0 -39
  223. package/Libraries/ReactNative/__mocks__/FabricUIManager.js +0 -334
  224. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +0 -39
  225. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +0 -18
  226. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h +0 -39
  227. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +0 -34
  228. package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.cpp +0 -53
  229. package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.h +0 -26
  230. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/LayoutableShadowNode.cpp +0 -363
  231. package/codegen/NativeJSCSamplingProfilerSpec.g.h +0 -35
  232. package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +0 -413
  233. package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +0 -181
  234. package/src/private/webapis/mutationobserver/specs/__mocks__/NativeMutationObserver.js +0 -327
@@ -0,0 +1,200 @@
1
+
2
+ /*
3
+ * This file is auto-generated from AndroidHorizontalScrollContentViewNativeComponent 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(AndroidHorizontalScrollContentViewProps)
22
+ struct AndroidHorizontalScrollContentViewProps : winrt::implements<AndroidHorizontalScrollContentViewProps, winrt::Microsoft::ReactNative::IComponentProps> {
23
+ AndroidHorizontalScrollContentViewProps(winrt::Microsoft::ReactNative::ViewProps props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom)
24
+ : ViewProps(props)
25
+ {
26
+ if (cloneFrom) {
27
+ auto cloneFromProps = cloneFrom.as<AndroidHorizontalScrollContentViewProps>();
28
+ removeClippedSubviews = cloneFromProps->removeClippedSubviews;
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
+ REACT_FIELD(removeClippedSubviews)
37
+ std::optional<bool> removeClippedSubviews{};
38
+
39
+ const winrt::Microsoft::ReactNative::ViewProps ViewProps;
40
+ };
41
+
42
+ struct AndroidHorizontalScrollContentViewEventEmitter {
43
+ AndroidHorizontalScrollContentViewEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
44
+ : m_eventEmitter(eventEmitter) {}
45
+
46
+ private:
47
+ winrt::Microsoft::ReactNative::EventEmitter m_eventEmitter{nullptr};
48
+ };
49
+
50
+ template<typename TUserData>
51
+ struct BaseAndroidHorizontalScrollContentView {
52
+
53
+ virtual void UpdateProps(
54
+ const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
55
+ const winrt::com_ptr<AndroidHorizontalScrollContentViewProps> &newProps,
56
+ const winrt::com_ptr<AndroidHorizontalScrollContentViewProps> &/*oldProps*/) noexcept {
57
+ m_props = newProps;
58
+ }
59
+
60
+ // UpdateLayoutMetrics will only be called if this method is overridden
61
+ virtual void UpdateLayoutMetrics(
62
+ const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
63
+ const winrt::Microsoft::ReactNative::LayoutMetrics &/*newLayoutMetrics*/,
64
+ const winrt::Microsoft::ReactNative::LayoutMetrics &/*oldLayoutMetrics*/) noexcept {
65
+ }
66
+
67
+ // UpdateState will only be called if this method is overridden
68
+ virtual void UpdateState(
69
+ const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
70
+ const winrt::Microsoft::ReactNative::IComponentState &/*newState*/) noexcept {
71
+ }
72
+
73
+ virtual void UpdateEventEmitter(const std::shared_ptr<AndroidHorizontalScrollContentViewEventEmitter> &eventEmitter) noexcept {
74
+ m_eventEmitter = eventEmitter;
75
+ }
76
+
77
+ // MountChildComponentView will only be called if this method is overridden
78
+ virtual void MountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
79
+ const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &/*args*/) noexcept {
80
+ }
81
+
82
+ // UnmountChildComponentView will only be called if this method is overridden
83
+ virtual void UnmountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
84
+ const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &/*args*/) noexcept {
85
+ }
86
+
87
+ // Initialize will only be called if this method is overridden
88
+ virtual void Initialize(const winrt::Microsoft::ReactNative::ComponentView &/*view*/) noexcept {
89
+ }
90
+
91
+ // CreateVisual will only be called if this method is overridden
92
+ virtual winrt::Microsoft::UI::Composition::Visual CreateVisual(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
93
+ return view.as<winrt::Microsoft::ReactNative::Composition::ComponentView>().Compositor().CreateSpriteVisual();
94
+ }
95
+
96
+ // FinalizeUpdate will only be called if this method is overridden
97
+ virtual void FinalizeUpdate(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
98
+ winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept {
99
+ }
100
+
101
+
102
+
103
+ const std::shared_ptr<AndroidHorizontalScrollContentViewEventEmitter>& EventEmitter() const { return m_eventEmitter; }
104
+ const winrt::com_ptr<AndroidHorizontalScrollContentViewProps>& Props() const { return m_props; }
105
+
106
+ private:
107
+ winrt::com_ptr<AndroidHorizontalScrollContentViewProps> m_props;
108
+ std::shared_ptr<AndroidHorizontalScrollContentViewEventEmitter> m_eventEmitter;
109
+ };
110
+
111
+ template <typename TUserData>
112
+ void RegisterAndroidHorizontalScrollContentViewNativeComponent(
113
+ winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder,
114
+ std::function<void(const winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder&)> builderCallback) noexcept {
115
+ packageBuilder.as<winrt::Microsoft::ReactNative::IReactPackageBuilderFabric>().AddViewComponent(
116
+ L"AndroidHorizontalScrollContentView", [builderCallback](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
117
+ auto compBuilder = builder.as<winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder>();
118
+
119
+ builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props,
120
+ const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) noexcept {
121
+ return winrt::make<AndroidHorizontalScrollContentViewProps>(props, cloneFrom);
122
+ });
123
+
124
+ builder.SetUpdatePropsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
125
+ const winrt::Microsoft::ReactNative::IComponentProps &newProps,
126
+ const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept {
127
+ auto userData = view.UserData().as<TUserData>();
128
+ userData->UpdateProps(view, newProps ? newProps.as<AndroidHorizontalScrollContentViewProps>() : nullptr, oldProps ? oldProps.as<AndroidHorizontalScrollContentViewProps>() : nullptr);
129
+ });
130
+
131
+ compBuilder.SetUpdateLayoutMetricsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
132
+ const winrt::Microsoft::ReactNative::LayoutMetrics &newLayoutMetrics,
133
+ const winrt::Microsoft::ReactNative::LayoutMetrics &oldLayoutMetrics) noexcept {
134
+ auto userData = view.UserData().as<TUserData>();
135
+ userData->UpdateLayoutMetrics(view, newLayoutMetrics, oldLayoutMetrics);
136
+ });
137
+
138
+ builder.SetUpdateEventEmitterHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
139
+ const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter) noexcept {
140
+ auto userData = view.UserData().as<TUserData>();
141
+ userData->UpdateEventEmitter(std::make_shared<AndroidHorizontalScrollContentViewEventEmitter>(eventEmitter));
142
+ });
143
+
144
+ if constexpr (&TUserData::FinalizeUpdate != &BaseAndroidHorizontalScrollContentView<TUserData>::FinalizeUpdate) {
145
+ builder.SetFinalizeUpdateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
146
+ winrt::Microsoft::ReactNative::ComponentViewUpdateMask mask) noexcept {
147
+ auto userData = view.UserData().as<TUserData>();
148
+ userData->FinalizeUpdate(view, mask);
149
+ });
150
+ }
151
+
152
+ if constexpr (&TUserData::UpdateState != &BaseAndroidHorizontalScrollContentView<TUserData>::UpdateState) {
153
+ builder.SetUpdateStateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
154
+ const winrt::Microsoft::ReactNative::IComponentState &newState) noexcept {
155
+ auto userData = view.UserData().as<TUserData>();
156
+ userData->member(view, newState);
157
+ });
158
+ }
159
+
160
+ if constexpr (&TUserData::MountChildComponentView != &BaseAndroidHorizontalScrollContentView<TUserData>::MountChildComponentView) {
161
+ builder.SetMountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
162
+ const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &args) noexcept {
163
+ auto userData = view.UserData().as<TUserData>();
164
+ return userData->MountChildComponentView(view, args);
165
+ });
166
+ }
167
+
168
+ if constexpr (&TUserData::UnmountChildComponentView != &BaseAndroidHorizontalScrollContentView<TUserData>::UnmountChildComponentView) {
169
+ builder.SetUnmountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
170
+ const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &args) noexcept {
171
+ auto userData = view.UserData().as<TUserData>();
172
+ return userData->UnmountChildComponentView(view, args);
173
+ });
174
+ }
175
+
176
+ compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
177
+ auto userData = winrt::make_self<TUserData>();
178
+ if constexpr (&TUserData::Initialize != &BaseAndroidHorizontalScrollContentView<TUserData>::Initialize) {
179
+ userData->Initialize(view);
180
+ }
181
+ view.UserData(*userData);
182
+ });
183
+
184
+ if constexpr (&TUserData::CreateVisual != &BaseAndroidHorizontalScrollContentView<TUserData>::CreateVisual) {
185
+ compBuilder.SetCreateVisualHandler([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
186
+ auto userData = view.UserData().as<TUserData>();
187
+ return userData->CreateVisual(view);
188
+ });
189
+ }
190
+
191
+ // Allow app to further customize the builder
192
+ if (builderCallback) {
193
+ builderCallback(compBuilder);
194
+ }
195
+ });
196
+ }
197
+
198
+ } // namespace Microsoft::ReactNativeSpecs
199
+
200
+ #endif // #ifdef RNW_NEW_ARCH
@@ -0,0 +1,224 @@
1
+
2
+ /*
3
+ * This file is auto-generated from AndroidProgressBarNativeComponent 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(AndroidProgressBarProps)
22
+ struct AndroidProgressBarProps : winrt::implements<AndroidProgressBarProps, winrt::Microsoft::ReactNative::IComponentProps> {
23
+ AndroidProgressBarProps(winrt::Microsoft::ReactNative::ViewProps props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom)
24
+ : ViewProps(props)
25
+ {
26
+ if (cloneFrom) {
27
+ auto cloneFromProps = cloneFrom.as<AndroidProgressBarProps>();
28
+ styleAttr = cloneFromProps->styleAttr;
29
+ typeAttr = cloneFromProps->typeAttr;
30
+ indeterminate = cloneFromProps->indeterminate;
31
+ progress = cloneFromProps->progress;
32
+ animating = cloneFromProps->animating;
33
+ color = cloneFromProps->color;
34
+ testID = cloneFromProps->testID;
35
+ }
36
+ }
37
+
38
+ void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
39
+ winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
40
+ }
41
+
42
+ REACT_FIELD(styleAttr)
43
+ std::optional<std::string> styleAttr;
44
+
45
+ REACT_FIELD(typeAttr)
46
+ std::optional<std::string> typeAttr;
47
+
48
+ REACT_FIELD(indeterminate)
49
+ bool indeterminate{};
50
+
51
+ REACT_FIELD(progress)
52
+ std::optional<double> progress{};
53
+
54
+ REACT_FIELD(animating)
55
+ bool animating{true};
56
+
57
+ REACT_FIELD(color)
58
+ winrt::Microsoft::ReactNative::Color color{nullptr};
59
+
60
+ REACT_FIELD(testID)
61
+ std::optional<std::string> testID;
62
+
63
+ const winrt::Microsoft::ReactNative::ViewProps ViewProps;
64
+ };
65
+
66
+ struct AndroidProgressBarEventEmitter {
67
+ AndroidProgressBarEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
68
+ : m_eventEmitter(eventEmitter) {}
69
+
70
+ private:
71
+ winrt::Microsoft::ReactNative::EventEmitter m_eventEmitter{nullptr};
72
+ };
73
+
74
+ template<typename TUserData>
75
+ struct BaseAndroidProgressBar {
76
+
77
+ virtual void UpdateProps(
78
+ const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
79
+ const winrt::com_ptr<AndroidProgressBarProps> &newProps,
80
+ const winrt::com_ptr<AndroidProgressBarProps> &/*oldProps*/) noexcept {
81
+ m_props = newProps;
82
+ }
83
+
84
+ // UpdateLayoutMetrics will only be called if this method is overridden
85
+ virtual void UpdateLayoutMetrics(
86
+ const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
87
+ const winrt::Microsoft::ReactNative::LayoutMetrics &/*newLayoutMetrics*/,
88
+ const winrt::Microsoft::ReactNative::LayoutMetrics &/*oldLayoutMetrics*/) noexcept {
89
+ }
90
+
91
+ // UpdateState will only be called if this method is overridden
92
+ virtual void UpdateState(
93
+ const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
94
+ const winrt::Microsoft::ReactNative::IComponentState &/*newState*/) noexcept {
95
+ }
96
+
97
+ virtual void UpdateEventEmitter(const std::shared_ptr<AndroidProgressBarEventEmitter> &eventEmitter) noexcept {
98
+ m_eventEmitter = eventEmitter;
99
+ }
100
+
101
+ // MountChildComponentView will only be called if this method is overridden
102
+ virtual void MountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
103
+ const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &/*args*/) noexcept {
104
+ }
105
+
106
+ // UnmountChildComponentView will only be called if this method is overridden
107
+ virtual void UnmountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
108
+ const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &/*args*/) noexcept {
109
+ }
110
+
111
+ // Initialize will only be called if this method is overridden
112
+ virtual void Initialize(const winrt::Microsoft::ReactNative::ComponentView &/*view*/) noexcept {
113
+ }
114
+
115
+ // CreateVisual will only be called if this method is overridden
116
+ virtual winrt::Microsoft::UI::Composition::Visual CreateVisual(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
117
+ return view.as<winrt::Microsoft::ReactNative::Composition::ComponentView>().Compositor().CreateSpriteVisual();
118
+ }
119
+
120
+ // FinalizeUpdate will only be called if this method is overridden
121
+ virtual void FinalizeUpdate(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
122
+ winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept {
123
+ }
124
+
125
+
126
+
127
+ const std::shared_ptr<AndroidProgressBarEventEmitter>& EventEmitter() const { return m_eventEmitter; }
128
+ const winrt::com_ptr<AndroidProgressBarProps>& Props() const { return m_props; }
129
+
130
+ private:
131
+ winrt::com_ptr<AndroidProgressBarProps> m_props;
132
+ std::shared_ptr<AndroidProgressBarEventEmitter> m_eventEmitter;
133
+ };
134
+
135
+ template <typename TUserData>
136
+ void RegisterAndroidProgressBarNativeComponent(
137
+ winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder,
138
+ std::function<void(const winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder&)> builderCallback) noexcept {
139
+ packageBuilder.as<winrt::Microsoft::ReactNative::IReactPackageBuilderFabric>().AddViewComponent(
140
+ L"AndroidProgressBar", [builderCallback](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
141
+ auto compBuilder = builder.as<winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder>();
142
+
143
+ builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props,
144
+ const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) noexcept {
145
+ return winrt::make<AndroidProgressBarProps>(props, cloneFrom);
146
+ });
147
+
148
+ builder.SetUpdatePropsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
149
+ const winrt::Microsoft::ReactNative::IComponentProps &newProps,
150
+ const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept {
151
+ auto userData = view.UserData().as<TUserData>();
152
+ userData->UpdateProps(view, newProps ? newProps.as<AndroidProgressBarProps>() : nullptr, oldProps ? oldProps.as<AndroidProgressBarProps>() : nullptr);
153
+ });
154
+
155
+ compBuilder.SetUpdateLayoutMetricsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
156
+ const winrt::Microsoft::ReactNative::LayoutMetrics &newLayoutMetrics,
157
+ const winrt::Microsoft::ReactNative::LayoutMetrics &oldLayoutMetrics) noexcept {
158
+ auto userData = view.UserData().as<TUserData>();
159
+ userData->UpdateLayoutMetrics(view, newLayoutMetrics, oldLayoutMetrics);
160
+ });
161
+
162
+ builder.SetUpdateEventEmitterHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
163
+ const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter) noexcept {
164
+ auto userData = view.UserData().as<TUserData>();
165
+ userData->UpdateEventEmitter(std::make_shared<AndroidProgressBarEventEmitter>(eventEmitter));
166
+ });
167
+
168
+ if constexpr (&TUserData::FinalizeUpdate != &BaseAndroidProgressBar<TUserData>::FinalizeUpdate) {
169
+ builder.SetFinalizeUpdateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
170
+ winrt::Microsoft::ReactNative::ComponentViewUpdateMask mask) noexcept {
171
+ auto userData = view.UserData().as<TUserData>();
172
+ userData->FinalizeUpdate(view, mask);
173
+ });
174
+ }
175
+
176
+ if constexpr (&TUserData::UpdateState != &BaseAndroidProgressBar<TUserData>::UpdateState) {
177
+ builder.SetUpdateStateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
178
+ const winrt::Microsoft::ReactNative::IComponentState &newState) noexcept {
179
+ auto userData = view.UserData().as<TUserData>();
180
+ userData->member(view, newState);
181
+ });
182
+ }
183
+
184
+ if constexpr (&TUserData::MountChildComponentView != &BaseAndroidProgressBar<TUserData>::MountChildComponentView) {
185
+ builder.SetMountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
186
+ const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &args) noexcept {
187
+ auto userData = view.UserData().as<TUserData>();
188
+ return userData->MountChildComponentView(view, args);
189
+ });
190
+ }
191
+
192
+ if constexpr (&TUserData::UnmountChildComponentView != &BaseAndroidProgressBar<TUserData>::UnmountChildComponentView) {
193
+ builder.SetUnmountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
194
+ const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &args) noexcept {
195
+ auto userData = view.UserData().as<TUserData>();
196
+ return userData->UnmountChildComponentView(view, args);
197
+ });
198
+ }
199
+
200
+ compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
201
+ auto userData = winrt::make_self<TUserData>();
202
+ if constexpr (&TUserData::Initialize != &BaseAndroidProgressBar<TUserData>::Initialize) {
203
+ userData->Initialize(view);
204
+ }
205
+ view.UserData(*userData);
206
+ });
207
+
208
+ if constexpr (&TUserData::CreateVisual != &BaseAndroidProgressBar<TUserData>::CreateVisual) {
209
+ compBuilder.SetCreateVisualHandler([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
210
+ auto userData = view.UserData().as<TUserData>();
211
+ return userData->CreateVisual(view);
212
+ });
213
+ }
214
+
215
+ // Allow app to further customize the builder
216
+ if (builderCallback) {
217
+ builderCallback(compBuilder);
218
+ }
219
+ });
220
+ }
221
+
222
+ } // namespace Microsoft::ReactNativeSpecs
223
+
224
+ #endif // #ifdef RNW_NEW_ARCH
@@ -0,0 +1,250 @@
1
+
2
+ /*
3
+ * This file is auto-generated from AndroidSwipeRefreshLayoutNativeComponent 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(AndroidSwipeRefreshLayoutProps)
22
+ struct AndroidSwipeRefreshLayoutProps : winrt::implements<AndroidSwipeRefreshLayoutProps, winrt::Microsoft::ReactNative::IComponentProps> {
23
+ AndroidSwipeRefreshLayoutProps(winrt::Microsoft::ReactNative::ViewProps props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom)
24
+ : ViewProps(props)
25
+ {
26
+ if (cloneFrom) {
27
+ auto cloneFromProps = cloneFrom.as<AndroidSwipeRefreshLayoutProps>();
28
+ enabled = cloneFromProps->enabled;
29
+ colors = cloneFromProps->colors;
30
+ progressBackgroundColor = cloneFromProps->progressBackgroundColor;
31
+ size = cloneFromProps->size;
32
+ progressViewOffset = cloneFromProps->progressViewOffset;
33
+ refreshing = cloneFromProps->refreshing;
34
+ }
35
+ }
36
+
37
+ void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
38
+ winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
39
+ }
40
+
41
+ REACT_FIELD(enabled)
42
+ bool enabled{true};
43
+
44
+ REACT_FIELD(colors)
45
+ std::optional<std::vector<winrt::Microsoft::ReactNative::Color>> colors;
46
+
47
+ REACT_FIELD(progressBackgroundColor)
48
+ winrt::Microsoft::ReactNative::Color progressBackgroundColor{nullptr};
49
+
50
+ REACT_FIELD(size)
51
+ std::optional<std::string> size;
52
+
53
+ REACT_FIELD(progressViewOffset)
54
+ std::optional<float> progressViewOffset{};
55
+
56
+ REACT_FIELD(refreshing)
57
+ bool refreshing{};
58
+
59
+ const winrt::Microsoft::ReactNative::ViewProps ViewProps;
60
+ };
61
+
62
+ REACT_STRUCT(AndroidSwipeRefreshLayout_OnRefresh)
63
+ struct AndroidSwipeRefreshLayout_OnRefresh {
64
+ };
65
+
66
+ struct AndroidSwipeRefreshLayoutEventEmitter {
67
+ AndroidSwipeRefreshLayoutEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
68
+ : m_eventEmitter(eventEmitter) {}
69
+
70
+ using OnRefresh = AndroidSwipeRefreshLayout_OnRefresh;
71
+
72
+ void onRefresh(OnRefresh &value) const {
73
+ m_eventEmitter.DispatchEvent(L"refresh", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
74
+ winrt::Microsoft::ReactNative::WriteValue(writer, value);
75
+ });
76
+ }
77
+
78
+ private:
79
+ winrt::Microsoft::ReactNative::EventEmitter m_eventEmitter{nullptr};
80
+ };
81
+
82
+ template<typename TUserData>
83
+ struct BaseAndroidSwipeRefreshLayout {
84
+
85
+ virtual void UpdateProps(
86
+ const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
87
+ const winrt::com_ptr<AndroidSwipeRefreshLayoutProps> &newProps,
88
+ const winrt::com_ptr<AndroidSwipeRefreshLayoutProps> &/*oldProps*/) noexcept {
89
+ m_props = newProps;
90
+ }
91
+
92
+ // UpdateLayoutMetrics will only be called if this method is overridden
93
+ virtual void UpdateLayoutMetrics(
94
+ const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
95
+ const winrt::Microsoft::ReactNative::LayoutMetrics &/*newLayoutMetrics*/,
96
+ const winrt::Microsoft::ReactNative::LayoutMetrics &/*oldLayoutMetrics*/) noexcept {
97
+ }
98
+
99
+ // UpdateState will only be called if this method is overridden
100
+ virtual void UpdateState(
101
+ const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
102
+ const winrt::Microsoft::ReactNative::IComponentState &/*newState*/) noexcept {
103
+ }
104
+
105
+ virtual void UpdateEventEmitter(const std::shared_ptr<AndroidSwipeRefreshLayoutEventEmitter> &eventEmitter) noexcept {
106
+ m_eventEmitter = eventEmitter;
107
+ }
108
+
109
+ // MountChildComponentView will only be called if this method is overridden
110
+ virtual void MountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
111
+ const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &/*args*/) noexcept {
112
+ }
113
+
114
+ // UnmountChildComponentView will only be called if this method is overridden
115
+ virtual void UnmountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
116
+ const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &/*args*/) noexcept {
117
+ }
118
+
119
+ // Initialize will only be called if this method is overridden
120
+ virtual void Initialize(const winrt::Microsoft::ReactNative::ComponentView &/*view*/) noexcept {
121
+ }
122
+
123
+ // CreateVisual will only be called if this method is overridden
124
+ virtual winrt::Microsoft::UI::Composition::Visual CreateVisual(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
125
+ return view.as<winrt::Microsoft::ReactNative::Composition::ComponentView>().Compositor().CreateSpriteVisual();
126
+ }
127
+
128
+ // FinalizeUpdate will only be called if this method is overridden
129
+ virtual void FinalizeUpdate(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
130
+ winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept {
131
+ }
132
+
133
+ // You must provide an implementation of this method to handle the "setNativeRefreshing" command
134
+ virtual void HandleSetNativeRefreshingCommand(bool value) noexcept = 0;
135
+
136
+ void HandleCommand(const winrt::Microsoft::ReactNative::ComponentView &view, const winrt::Microsoft::ReactNative::HandleCommandArgs& args) noexcept {
137
+ auto userData = view.UserData().as<TUserData>();
138
+ auto commandName = args.CommandName();
139
+ if (commandName == L"setNativeRefreshing") {
140
+ bool value;
141
+ winrt::Microsoft::ReactNative::ReadArgs(args.CommandArgs(), value);
142
+ userData->HandleSetNativeRefreshingCommand(value);
143
+ return;
144
+ }
145
+ }
146
+
147
+ const std::shared_ptr<AndroidSwipeRefreshLayoutEventEmitter>& EventEmitter() const { return m_eventEmitter; }
148
+ const winrt::com_ptr<AndroidSwipeRefreshLayoutProps>& Props() const { return m_props; }
149
+
150
+ private:
151
+ winrt::com_ptr<AndroidSwipeRefreshLayoutProps> m_props;
152
+ std::shared_ptr<AndroidSwipeRefreshLayoutEventEmitter> m_eventEmitter;
153
+ };
154
+
155
+ template <typename TUserData>
156
+ void RegisterAndroidSwipeRefreshLayoutNativeComponent(
157
+ winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder,
158
+ std::function<void(const winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder&)> builderCallback) noexcept {
159
+ packageBuilder.as<winrt::Microsoft::ReactNative::IReactPackageBuilderFabric>().AddViewComponent(
160
+ L"AndroidSwipeRefreshLayout", [builderCallback](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
161
+ auto compBuilder = builder.as<winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder>();
162
+
163
+ builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props,
164
+ const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) noexcept {
165
+ return winrt::make<AndroidSwipeRefreshLayoutProps>(props, cloneFrom);
166
+ });
167
+
168
+ builder.SetUpdatePropsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
169
+ const winrt::Microsoft::ReactNative::IComponentProps &newProps,
170
+ const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept {
171
+ auto userData = view.UserData().as<TUserData>();
172
+ userData->UpdateProps(view, newProps ? newProps.as<AndroidSwipeRefreshLayoutProps>() : nullptr, oldProps ? oldProps.as<AndroidSwipeRefreshLayoutProps>() : nullptr);
173
+ });
174
+
175
+ compBuilder.SetUpdateLayoutMetricsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
176
+ const winrt::Microsoft::ReactNative::LayoutMetrics &newLayoutMetrics,
177
+ const winrt::Microsoft::ReactNative::LayoutMetrics &oldLayoutMetrics) noexcept {
178
+ auto userData = view.UserData().as<TUserData>();
179
+ userData->UpdateLayoutMetrics(view, newLayoutMetrics, oldLayoutMetrics);
180
+ });
181
+
182
+ builder.SetUpdateEventEmitterHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
183
+ const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter) noexcept {
184
+ auto userData = view.UserData().as<TUserData>();
185
+ userData->UpdateEventEmitter(std::make_shared<AndroidSwipeRefreshLayoutEventEmitter>(eventEmitter));
186
+ });
187
+
188
+ if constexpr (&TUserData::FinalizeUpdate != &BaseAndroidSwipeRefreshLayout<TUserData>::FinalizeUpdate) {
189
+ builder.SetFinalizeUpdateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
190
+ winrt::Microsoft::ReactNative::ComponentViewUpdateMask mask) noexcept {
191
+ auto userData = view.UserData().as<TUserData>();
192
+ userData->FinalizeUpdate(view, mask);
193
+ });
194
+ }
195
+
196
+ if constexpr (&TUserData::UpdateState != &BaseAndroidSwipeRefreshLayout<TUserData>::UpdateState) {
197
+ builder.SetUpdateStateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
198
+ const winrt::Microsoft::ReactNative::IComponentState &newState) noexcept {
199
+ auto userData = view.UserData().as<TUserData>();
200
+ userData->member(view, newState);
201
+ });
202
+ }
203
+
204
+ builder.SetCustomCommandHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
205
+ const winrt::Microsoft::ReactNative::HandleCommandArgs& args) noexcept {
206
+ auto userData = view.UserData().as<TUserData>();
207
+ userData->HandleCommand(view, args);
208
+ });
209
+
210
+ if constexpr (&TUserData::MountChildComponentView != &BaseAndroidSwipeRefreshLayout<TUserData>::MountChildComponentView) {
211
+ builder.SetMountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
212
+ const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &args) noexcept {
213
+ auto userData = view.UserData().as<TUserData>();
214
+ return userData->MountChildComponentView(view, args);
215
+ });
216
+ }
217
+
218
+ if constexpr (&TUserData::UnmountChildComponentView != &BaseAndroidSwipeRefreshLayout<TUserData>::UnmountChildComponentView) {
219
+ builder.SetUnmountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
220
+ const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &args) noexcept {
221
+ auto userData = view.UserData().as<TUserData>();
222
+ return userData->UnmountChildComponentView(view, args);
223
+ });
224
+ }
225
+
226
+ compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
227
+ auto userData = winrt::make_self<TUserData>();
228
+ if constexpr (&TUserData::Initialize != &BaseAndroidSwipeRefreshLayout<TUserData>::Initialize) {
229
+ userData->Initialize(view);
230
+ }
231
+ view.UserData(*userData);
232
+ });
233
+
234
+ if constexpr (&TUserData::CreateVisual != &BaseAndroidSwipeRefreshLayout<TUserData>::CreateVisual) {
235
+ compBuilder.SetCreateVisualHandler([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
236
+ auto userData = view.UserData().as<TUserData>();
237
+ return userData->CreateVisual(view);
238
+ });
239
+ }
240
+
241
+ // Allow app to further customize the builder
242
+ if (builderCallback) {
243
+ builderCallback(compBuilder);
244
+ }
245
+ });
246
+ }
247
+
248
+ } // namespace Microsoft::ReactNativeSpecs
249
+
250
+ #endif // #ifdef RNW_NEW_ARCH