react-native-windows 0.82.3 → 0.83.0-preview.0

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 (224) hide show
  1. package/.flowconfig +2 -7
  2. package/Libraries/Animated/components/AnimatedFlatList.js +5 -3
  3. package/Libraries/Animated/components/AnimatedImage.js +4 -3
  4. package/Libraries/Animated/components/AnimatedSectionList.js +2 -2
  5. package/Libraries/Animated/components/AnimatedText.js +7 -3
  6. package/Libraries/Animated/components/AnimatedView.js +3 -2
  7. package/Libraries/Animated/createAnimatedComponent.js +24 -12
  8. package/Libraries/Animated/nodes/AnimatedColor.js +26 -10
  9. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +43 -15
  10. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +43 -15
  11. package/Libraries/Components/ActivityIndicator/ActivityIndicator.d.ts +2 -2
  12. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +2 -2
  13. package/Libraries/Components/Glyph/Glyph.js +4 -1
  14. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.d.ts +2 -2
  15. package/Libraries/Components/RefreshControl/RefreshControl.d.ts +3 -3
  16. package/Libraries/Components/SafeAreaView/SafeAreaView.d.ts +2 -2
  17. package/Libraries/Components/ScrollView/ScrollView.js +1 -0
  18. package/Libraries/Components/ScrollView/ScrollView.windows.js +1 -0
  19. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +6 -6
  20. package/Libraries/Components/Switch/Switch.d.ts +2 -2
  21. package/Libraries/Components/Switch/Switch.windows.js +1 -1
  22. package/Libraries/Components/TextInput/TextInput.d.ts +2 -5
  23. package/Libraries/Components/TextInput/TextInput.js +6 -0
  24. package/Libraries/Components/TextInput/TextInput.windows.js +6 -0
  25. package/Libraries/Components/Touchable/TouchableBounce.js +7 -7
  26. package/Libraries/Components/Touchable/TouchableBounce.windows.js +7 -7
  27. package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +1 -1
  28. package/Libraries/Components/View/ReactNativeStyleAttributes.js +19 -1
  29. package/Libraries/Components/View/View.d.ts +2 -2
  30. package/Libraries/Components/View/View.windows.js +0 -1
  31. package/Libraries/Components/View/ViewNativeComponent.js +13 -1
  32. package/Libraries/Core/ReactNativeVersion.js +3 -3
  33. package/Libraries/Core/setUpPerformance.js +2 -0
  34. package/Libraries/Debugging/DebuggingOverlay.js +14 -14
  35. package/Libraries/Debugging/DebuggingOverlayRegistry.js +8 -2
  36. package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +5 -2
  37. package/Libraries/Image/Image.d.ts +3 -3
  38. package/Libraries/Image/ImageInjection.js +3 -6
  39. package/Libraries/Image/ImageTypes.flow.js +3 -7
  40. package/Libraries/Lists/FlatList.js +8 -8
  41. package/Libraries/Lists/SectionList.d.ts +5 -1
  42. package/Libraries/Lists/ViewabilityHelper.js +1 -1
  43. package/Libraries/Lists/VirtualizedList.js +1 -0
  44. package/Libraries/LogBox/UI/AnsiHighlight.js +4 -1
  45. package/Libraries/NativeComponent/BaseViewConfig.android.js +11 -2
  46. package/Libraries/NativeComponent/NativeComponentRegistry.d.ts +98 -0
  47. package/Libraries/NativeComponent/NativeComponentRegistry.js +2 -0
  48. package/Libraries/NativeComponent/NativeComponentRegistryUnstable.js +3 -1
  49. package/Libraries/NativeComponent/ViewConfigIgnore.windows.js +45 -0
  50. package/Libraries/Network/RCTNetworking.android.js +3 -1
  51. package/Libraries/Network/RCTNetworking.ios.js +3 -0
  52. package/Libraries/Network/RCTNetworking.windows.js +3 -0
  53. package/Libraries/Network/XMLHttpRequest.js +1 -41
  54. package/Libraries/Pressability/usePressability.js +14 -3
  55. package/Libraries/ReactNative/PaperUIManager.windows.js +3 -3
  56. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +20 -82
  57. package/Libraries/ReactNative/getNativeComponentAttributes.js +12 -0
  58. package/Libraries/Renderer/implementations/ReactFabric-dev.js +6759 -4478
  59. package/Libraries/Renderer/implementations/ReactFabric-prod.js +3169 -3119
  60. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4732 -3535
  61. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +6646 -4070
  62. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3136 -2825
  63. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4761 -3312
  64. package/Libraries/Renderer/shims/ReactNative.js +3 -1
  65. package/Libraries/Renderer/shims/ReactNativeTypes.js +2 -1
  66. package/Libraries/Renderer/shims/ReactNativeTypes.windows.js +2 -1
  67. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +1 -1
  68. package/Libraries/StyleSheet/StyleSheetTypes.js +44 -0
  69. package/Libraries/StyleSheet/processBackgroundPosition.js +284 -0
  70. package/Libraries/StyleSheet/processBackgroundRepeat.js +105 -0
  71. package/Libraries/StyleSheet/processBackgroundSize.js +104 -0
  72. package/Libraries/Text/Text.d.ts +2 -2
  73. package/Libraries/Text/TextNativeComponent.js +10 -0
  74. package/Libraries/TurboModule/TurboModuleRegistry.js +3 -9
  75. package/Libraries/Utilities/DevLoadingView.js +14 -6
  76. package/Libraries/Utilities/HMRClient.js +13 -5
  77. package/Microsoft.ReactNative/CompositionComponentView.idl +2 -0
  78. package/Microsoft.ReactNative/CompositionHwndHost.idl +1 -0
  79. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +1 -1
  80. package/Microsoft.ReactNative/Fabric/ComponentView.h +1 -1
  81. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +2 -52
  82. package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +10 -40
  83. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +3 -80
  84. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +45 -12
  85. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +8 -0
  86. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +61 -74
  87. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +4 -0
  88. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +1 -0
  89. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +4 -3
  90. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +2 -1
  91. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeWindow.cpp +245 -0
  92. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeWindow.h +80 -0
  93. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +20 -36
  94. package/Microsoft.ReactNative/Fabric/Composition/UriImageManager.cpp +5 -0
  95. package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +1 -0
  96. package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +1 -1
  97. package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +20 -94
  98. package/Microsoft.ReactNative/Modules/LogBoxModule.h +1 -3
  99. package/Microsoft.ReactNative/ReactNativeAppBuilder.cpp +0 -41
  100. package/Microsoft.ReactNative/ReactNativeAppBuilder.idl +0 -11
  101. package/Microsoft.ReactNative/ReactNativeIsland.idl +2 -3
  102. package/Microsoft.ReactNative/ReactNativeWin32App.cpp +31 -101
  103. package/Microsoft.ReactNative/ReactNativeWin32App.h +2 -13
  104. package/Microsoft.ReactNative/ReactNativeWindow.idl +44 -0
  105. package/Microsoft.ReactNative.Cxx/AutoDraw.h +9 -1
  106. package/Microsoft.ReactNative.Cxx/ReactCommon/CallInvoker.h +13 -16
  107. package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModule.h +24 -36
  108. package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModuleUtils.h +5 -8
  109. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/AString.h +8 -6
  110. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Array.h +32 -49
  111. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Base.h +27 -76
  112. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Bool.h +4 -2
  113. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/CallbackWrapper.h +19 -18
  114. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Class.h +25 -48
  115. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Convert.h +38 -31
  116. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Error.h +11 -6
  117. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/EventEmitter.h +47 -45
  118. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Function.h +69 -89
  119. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/HighResTimeStamp.h +8 -8
  120. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/LongLivedObject.h +6 -6
  121. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Number.h +16 -8
  122. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Object.h +17 -24
  123. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Promise.h +17 -17
  124. package/Microsoft.ReactNative.Cxx/ReactCommon/react/bridging/Value.h +20 -29
  125. package/Microsoft.ReactNative.Cxx/ReactCommon/react/debug/react_native_assert.h +2 -7
  126. package/Microsoft.ReactNative.Cxx/ReactCommon/react/timing/primitives.h +127 -115
  127. package/PropertySheets/Generated/PackageVersion.g.props +5 -5
  128. package/PropertySheets/Warnings.props +2 -1
  129. package/ReactCommon/ReactCommon.vcxproj +11 -2
  130. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/CxxNativeModule.cpp +2 -2
  131. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/Instance.cpp +4 -2
  132. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +4 -2
  133. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSIndexedRAMBundle.cpp +4 -2
  134. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/MethodCall.cpp +4 -2
  135. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ModuleRegistry.cpp +5 -3
  136. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +4 -4
  137. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/RAMBundleRegistry.cpp +6 -4
  138. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ReactMarker.cpp +2 -0
  139. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/TraceSection.h +25 -35
  140. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +86 -67
  141. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsiexecutor/jsireact/JSIExecutor.cpp +15 -8
  142. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsiexecutor/jsireact/JSINativeModules.cpp +4 -2
  143. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.cpp +84 -68
  144. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.h +31 -35
  145. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/Utf8.h +4 -5
  146. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/network/HttpUtils.cpp +2 -1
  147. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +24 -36
  148. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/dom/NativeDOM.h +28 -66
  149. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/webperformance/NativePerformance.cpp +5 -0
  150. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +3 -3
  151. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/image/conversions.h +8 -4
  152. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/ParagraphShadowNode.cpp +19 -16
  153. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/platform/android/react/renderer/components/text/ParagraphState.h +8 -9
  154. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +25 -95
  155. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +85 -42
  156. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventDispatcher.cpp +2 -0
  157. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventQueueProcessor.cpp +2 -0
  158. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/primitives.h +25 -31
  159. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/UIManager.cpp +19 -5
  160. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +16 -1
  161. package/Scripts/Tfs/Layout-Desktop-Headers.ps1 +1 -15
  162. package/Scripts/creaternwapp.cmd +1 -1
  163. package/Scripts/perf/compare-results.js +357 -0
  164. package/Scripts/perf/create-perf-test.js +343 -0
  165. package/Scripts/perf/post-pr-comment.js +210 -0
  166. package/Shared/Hermes/HermesRuntimeTargetDelegate.cpp +8 -0
  167. package/Shared/Hermes/HermesRuntimeTargetDelegate.h +3 -0
  168. package/Shared/Shared.vcxitems +15 -3
  169. package/Shared/Shared.vcxitems.filters +11 -3
  170. package/codegen/NativeIntersectionObserverSpec.g.h +2 -0
  171. package/codegen/NativeNetworkingIOSSpec.g.h +2 -0
  172. package/codegen/NativePerformanceSpec.g.h +6 -0
  173. package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +229 -139
  174. package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +2 -1
  175. package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +42 -25
  176. package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +2 -1
  177. package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +2 -1
  178. package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +11 -6
  179. package/codegen/react/components/rnwcore/AndroidSwitch.g.h +11 -6
  180. package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +1 -0
  181. package/codegen/react/components/rnwcore/InputAccessory.g.h +2 -1
  182. package/codegen/react/components/rnwcore/ModalHostView.g.h +40 -23
  183. package/codegen/react/components/rnwcore/Props.cpp +6 -1
  184. package/codegen/react/components/rnwcore/Props.h +1 -0
  185. package/codegen/react/components/rnwcore/PullToRefreshView.g.h +11 -6
  186. package/codegen/react/components/rnwcore/SafeAreaView.g.h +1 -0
  187. package/codegen/react/components/rnwcore/Switch.g.h +11 -6
  188. package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +2 -1
  189. package/codegen/react/components/rnwcore/VirtualView.g.h +41 -8
  190. package/codegen/react/components/rnwcore/VirtualViewExperimental.g.h +45 -8
  191. package/codegen/rnwcoreJSI.h +3973 -6059
  192. package/index.js +6 -0
  193. package/index.windows.js +6 -0
  194. package/jest/mockComponent.js +6 -6
  195. package/jest/setup.js +15 -10
  196. package/package.json +27 -27
  197. package/src/private/components/virtualview/VirtualView.js +22 -27
  198. package/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.js +6 -0
  199. package/src/private/featureflags/ReactNativeFeatureFlags.js +100 -19
  200. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +18 -3
  201. package/src/private/setup/setUpDefaultReactNativeEnvironment.js +6 -0
  202. package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -1
  203. package/src/private/specs_DEPRECATED/modules/NativeNetworkingIOS.js +1 -0
  204. package/src/private/webapis/dom/nodes/ReactNativeElement.js +12 -2
  205. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +76 -15
  206. package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +1 -0
  207. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
  208. package/src/private/webapis/performance/ResourceTiming.js +31 -4
  209. package/src/private/webapis/performance/internals/RawPerformanceEntry.js +4 -1
  210. package/src/private/webapis/performance/specs/NativePerformance.js +3 -0
  211. package/stubs/double-conversion/double-conversion.h +5 -0
  212. package/templates/cpp-app/template.config.js +1 -1
  213. package/templates/cpp-app/windows/MyApp/MyApp.vcxproj +1 -1
  214. package/templates/cpp-lib/template.config.js +1 -1
  215. package/templates/cpp-lib/windows/MyLib/MyLib.vcxproj +1 -1
  216. package/types/index.d.ts +1 -0
  217. package/types/public/ReactNativeTypes.d.ts +115 -2
  218. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +0 -152
  219. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/BaseViewProps.cpp +0 -628
  220. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/conversions.h +0 -1574
  221. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/ShadowNode.cpp +0 -528
  222. package/Scripts/OpenSSL.nuspec +0 -39
  223. package/Scripts/OpenSSL.targets +0 -36
  224. package/codegen/rnwcoreJSI-generated.cpp +0 -3470
@@ -1,628 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- #include "BaseViewProps.h"
9
-
10
- #include <algorithm>
11
-
12
- #include <react/featureflags/ReactNativeFeatureFlags.h>
13
- #include <react/renderer/components/view/BoxShadowPropsConversions.h>
14
- #include <react/renderer/components/view/FilterPropsConversions.h>
15
- #include <react/renderer/components/view/conversions.h>
16
- #include <react/renderer/components/view/primitives.h>
17
- #include <react/renderer/components/view/propsConversions.h>
18
- #include <react/renderer/core/graphicsConversions.h>
19
- #include <react/renderer/core/propsConversions.h>
20
- #include <react/renderer/debug/debugStringConvertibleUtils.h>
21
- #include <react/renderer/graphics/ValueUnit.h>
22
-
23
- namespace facebook::react {
24
-
25
- namespace {
26
-
27
- std::array<float, 3> getTranslateForTransformOrigin(
28
- float viewWidth,
29
- float viewHeight,
30
- TransformOrigin transformOrigin) {
31
- float viewCenterX = viewWidth / 2;
32
- float viewCenterY = viewHeight / 2;
33
-
34
- std::array<float, 3> origin = {viewCenterX, viewCenterY, transformOrigin.z};
35
-
36
- for (size_t i = 0; i < transformOrigin.xy.size(); ++i) {
37
- auto& currentOrigin = transformOrigin.xy[i];
38
- if (currentOrigin.unit == UnitType::Point) {
39
- origin[i] = currentOrigin.value;
40
- } else if (currentOrigin.unit == UnitType::Percent) {
41
- origin[i] =
42
- ((i == 0) ? viewWidth : viewHeight) * currentOrigin.value / 100.0f;
43
- }
44
- }
45
-
46
- float newTranslateX = -viewCenterX + origin[0];
47
- float newTranslateY = -viewCenterY + origin[1];
48
- float newTranslateZ = origin[2];
49
-
50
- return std::array{newTranslateX, newTranslateY, newTranslateZ};
51
- }
52
-
53
- } // namespace
54
-
55
- BaseViewProps::BaseViewProps(
56
- const PropsParserContext& context,
57
- const BaseViewProps& sourceProps,
58
- const RawProps& rawProps,
59
- const std::function<bool(const std::string&)>& filterObjectKeys)
60
- : YogaStylableProps(context, sourceProps, rawProps, filterObjectKeys),
61
- AccessibilityProps(context, sourceProps, rawProps),
62
- opacity(
63
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
64
- ? sourceProps.opacity
65
- : convertRawProp(
66
- context,
67
- rawProps,
68
- "opacity",
69
- sourceProps.opacity,
70
- (Float)1.0)),
71
- backgroundColor(
72
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
73
- ? sourceProps.backgroundColor
74
- : convertRawProp(
75
- context,
76
- rawProps,
77
- "backgroundColor",
78
- sourceProps.backgroundColor,
79
- {})),
80
- borderRadii(
81
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
82
- ? sourceProps.borderRadii
83
- : convertRawProp(
84
- context,
85
- rawProps,
86
- "border",
87
- "Radius",
88
- sourceProps.borderRadii,
89
- {})),
90
- borderColors(
91
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
92
- ? sourceProps.borderColors
93
- : convertRawProp(
94
- context,
95
- rawProps,
96
- "border",
97
- "Color",
98
- sourceProps.borderColors,
99
- {})),
100
- borderCurves(
101
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
102
- ? sourceProps.borderCurves
103
- : convertRawProp(
104
- context,
105
- rawProps,
106
- "border",
107
- "Curve",
108
- sourceProps.borderCurves,
109
- {})),
110
- borderStyles(
111
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
112
- ? sourceProps.borderStyles
113
- : convertRawProp(
114
- context,
115
- rawProps,
116
- "border",
117
- "Style",
118
- sourceProps.borderStyles,
119
- {})),
120
- outlineColor(
121
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
122
- ? sourceProps.outlineColor
123
- : convertRawProp(
124
- context,
125
- rawProps,
126
- "outlineColor",
127
- sourceProps.outlineColor,
128
- {})),
129
- outlineOffset(
130
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
131
- ? sourceProps.outlineOffset
132
- : convertRawProp(
133
- context,
134
- rawProps,
135
- "outlineOffset",
136
- sourceProps.outlineOffset,
137
- {})),
138
- outlineStyle(
139
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
140
- ? sourceProps.outlineStyle
141
- : convertRawProp(
142
- context,
143
- rawProps,
144
- "outlineStyle",
145
- sourceProps.outlineStyle,
146
- {})),
147
- outlineWidth(
148
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
149
- ? sourceProps.outlineWidth
150
- : convertRawProp(
151
- context,
152
- rawProps,
153
- "outlineWidth",
154
- sourceProps.outlineWidth,
155
- {})),
156
- shadowColor(
157
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
158
- ? sourceProps.shadowColor
159
- : convertRawProp(
160
- context,
161
- rawProps,
162
- "shadowColor",
163
- sourceProps.shadowColor,
164
- {})),
165
- shadowOffset(
166
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
167
- ? sourceProps.shadowOffset
168
- : convertRawProp(
169
- context,
170
- rawProps,
171
- "shadowOffset",
172
- sourceProps.shadowOffset,
173
- {})),
174
- shadowOpacity(
175
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
176
- ? sourceProps.shadowOpacity
177
- : convertRawProp(
178
- context,
179
- rawProps,
180
- "shadowOpacity",
181
- sourceProps.shadowOpacity,
182
- {})),
183
- shadowRadius(
184
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
185
- ? sourceProps.shadowRadius
186
- : convertRawProp(
187
- context,
188
- rawProps,
189
- "shadowRadius",
190
- sourceProps.shadowRadius,
191
- {})),
192
- cursor(
193
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
194
- ? sourceProps.cursor
195
- : convertRawProp(
196
- context,
197
- rawProps,
198
- "cursor",
199
- sourceProps.cursor,
200
- {})),
201
- boxShadow(
202
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
203
- ? sourceProps.boxShadow
204
- : convertRawProp(
205
- context,
206
- rawProps,
207
- "boxShadow",
208
- sourceProps.boxShadow,
209
- {})),
210
- filter(
211
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
212
- ? sourceProps.filter
213
- : convertRawProp(
214
- context,
215
- rawProps,
216
- "filter",
217
- sourceProps.filter,
218
- {})),
219
- backgroundImage(
220
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
221
- ? sourceProps.backgroundImage
222
- : convertRawProp(
223
- context,
224
- rawProps,
225
- "experimental_backgroundImage",
226
- sourceProps.backgroundImage,
227
- {})),
228
- mixBlendMode(
229
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
230
- ? sourceProps.mixBlendMode
231
- : convertRawProp(
232
- context,
233
- rawProps,
234
- "mixBlendMode",
235
- sourceProps.mixBlendMode,
236
- {})),
237
- isolation(
238
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
239
- ? sourceProps.isolation
240
- : convertRawProp(
241
- context,
242
- rawProps,
243
- "isolation",
244
- sourceProps.isolation,
245
- {})),
246
- transform(
247
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
248
- ? sourceProps.transform
249
- : convertRawProp(
250
- context,
251
- rawProps,
252
- "transform",
253
- sourceProps.transform,
254
- {})),
255
- transformOrigin(
256
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
257
- ? sourceProps.transformOrigin
258
- : convertRawProp(
259
- context,
260
- rawProps,
261
- "transformOrigin",
262
- sourceProps.transformOrigin,
263
- {})),
264
- backfaceVisibility(
265
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
266
- ? sourceProps.backfaceVisibility
267
- : convertRawProp(
268
- context,
269
- rawProps,
270
- "backfaceVisibility",
271
- sourceProps.backfaceVisibility,
272
- {})),
273
- shouldRasterize(
274
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
275
- ? sourceProps.shouldRasterize
276
- : convertRawProp(
277
- context,
278
- rawProps,
279
- "shouldRasterizeIOS",
280
- sourceProps.shouldRasterize,
281
- {})),
282
- zIndex(
283
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
284
- ? sourceProps.zIndex
285
- : convertRawProp(
286
- context,
287
- rawProps,
288
- "zIndex",
289
- sourceProps.zIndex,
290
- {})),
291
- pointerEvents(
292
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
293
- ? sourceProps.pointerEvents
294
- : convertRawProp(
295
- context,
296
- rawProps,
297
- "pointerEvents",
298
- sourceProps.pointerEvents,
299
- {})),
300
- hitSlop(
301
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
302
- ? sourceProps.hitSlop
303
- : convertRawProp(
304
- context,
305
- rawProps,
306
- "hitSlop",
307
- sourceProps.hitSlop,
308
- {})),
309
- onLayout(
310
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
311
- ? sourceProps.onLayout
312
- : convertRawProp(
313
- context,
314
- rawProps,
315
- "onLayout",
316
- sourceProps.onLayout,
317
- {})),
318
- events(
319
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
320
- ? sourceProps.events
321
- : convertRawProp(context, rawProps, sourceProps.events, {})),
322
- collapsable(
323
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
324
- ? sourceProps.collapsable
325
- : convertRawProp(
326
- context,
327
- rawProps,
328
- "collapsable",
329
- sourceProps.collapsable,
330
- true)),
331
- collapsableChildren(
332
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
333
- ? sourceProps.collapsableChildren
334
- : convertRawProp(
335
- context,
336
- rawProps,
337
- "collapsableChildren",
338
- sourceProps.collapsableChildren,
339
- true)),
340
- removeClippedSubviews(
341
- ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
342
- ? sourceProps.removeClippedSubviews
343
- : convertRawProp(
344
- context,
345
- rawProps,
346
- "removeClippedSubviews",
347
- sourceProps.removeClippedSubviews,
348
- false)) {}
349
-
350
- #define VIEW_EVENT_CASE(eventType) \
351
- case CONSTEXPR_RAW_PROPS_KEY_HASH("on" #eventType): { \
352
- const auto offset = ViewEvents::Offset::eventType; \
353
- ViewEvents defaultViewEvents{}; \
354
- bool res = defaultViewEvents[offset]; \
355
- if (value.hasValue()) { \
356
- fromRawValue(context, value, res); \
357
- } \
358
- events[offset] = res; \
359
- return; \
360
- }
361
-
362
- void BaseViewProps::setProp(
363
- const PropsParserContext& context,
364
- RawPropsPropNameHash hash,
365
- const char* propName,
366
- const RawValue& value) {
367
- // All Props structs setProp methods must always, unconditionally,
368
- // call all super::setProp methods, since multiple structs may
369
- // reuse the same values.
370
- YogaStylableProps::setProp(context, hash, propName, value);
371
- AccessibilityProps::setProp(context, hash, propName, value);
372
-
373
- static auto defaults = BaseViewProps{};
374
-
375
- switch (hash) {
376
- RAW_SET_PROP_SWITCH_CASE_BASIC(opacity);
377
- RAW_SET_PROP_SWITCH_CASE_BASIC(backgroundColor);
378
- RAW_SET_PROP_SWITCH_CASE(backgroundImage, "experimental_backgroundImage");
379
- RAW_SET_PROP_SWITCH_CASE_BASIC(shadowColor);
380
- RAW_SET_PROP_SWITCH_CASE_BASIC(shadowOffset);
381
- RAW_SET_PROP_SWITCH_CASE_BASIC(shadowOpacity);
382
- RAW_SET_PROP_SWITCH_CASE_BASIC(shadowRadius);
383
- RAW_SET_PROP_SWITCH_CASE_BASIC(transform);
384
- RAW_SET_PROP_SWITCH_CASE_BASIC(backfaceVisibility);
385
- RAW_SET_PROP_SWITCH_CASE_BASIC(shouldRasterize);
386
- RAW_SET_PROP_SWITCH_CASE_BASIC(zIndex);
387
- RAW_SET_PROP_SWITCH_CASE_BASIC(pointerEvents);
388
- RAW_SET_PROP_SWITCH_CASE_BASIC(isolation);
389
- RAW_SET_PROP_SWITCH_CASE_BASIC(hitSlop);
390
- RAW_SET_PROP_SWITCH_CASE_BASIC(onLayout);
391
- RAW_SET_PROP_SWITCH_CASE_BASIC(collapsable);
392
- RAW_SET_PROP_SWITCH_CASE_BASIC(collapsableChildren);
393
- RAW_SET_PROP_SWITCH_CASE_BASIC(removeClippedSubviews);
394
- RAW_SET_PROP_SWITCH_CASE_BASIC(cursor);
395
- RAW_SET_PROP_SWITCH_CASE_BASIC(outlineColor);
396
- RAW_SET_PROP_SWITCH_CASE_BASIC(outlineOffset);
397
- RAW_SET_PROP_SWITCH_CASE_BASIC(outlineStyle);
398
- RAW_SET_PROP_SWITCH_CASE_BASIC(outlineWidth);
399
- RAW_SET_PROP_SWITCH_CASE_BASIC(filter);
400
- RAW_SET_PROP_SWITCH_CASE_BASIC(boxShadow);
401
- RAW_SET_PROP_SWITCH_CASE_BASIC(mixBlendMode);
402
- // events field
403
- VIEW_EVENT_CASE(PointerEnter);
404
- VIEW_EVENT_CASE(PointerEnterCapture);
405
- VIEW_EVENT_CASE(PointerMove);
406
- VIEW_EVENT_CASE(PointerMoveCapture);
407
- VIEW_EVENT_CASE(PointerLeave);
408
- VIEW_EVENT_CASE(PointerLeaveCapture);
409
- VIEW_EVENT_CASE(PointerOver);
410
- VIEW_EVENT_CASE(PointerOverCapture);
411
- VIEW_EVENT_CASE(PointerOut);
412
- VIEW_EVENT_CASE(PointerOutCapture);
413
- // [Windows
414
- VIEW_EVENT_CASE(Click);
415
- VIEW_EVENT_CASE(ClickCapture);
416
- VIEW_EVENT_CASE(PointerDown);
417
- VIEW_EVENT_CASE(PointerDownCapture);
418
- VIEW_EVENT_CASE(PointerUp);
419
- VIEW_EVENT_CASE(PointerUpCapture);
420
- VIEW_EVENT_CASE(GotPointerCapture);
421
- VIEW_EVENT_CASE(LostPointerCapture);
422
- // Windows]
423
- VIEW_EVENT_CASE(MoveShouldSetResponder);
424
- VIEW_EVENT_CASE(MoveShouldSetResponderCapture);
425
- VIEW_EVENT_CASE(StartShouldSetResponder);
426
- VIEW_EVENT_CASE(StartShouldSetResponderCapture);
427
- VIEW_EVENT_CASE(ResponderGrant);
428
- VIEW_EVENT_CASE(ResponderReject);
429
- VIEW_EVENT_CASE(ResponderStart);
430
- VIEW_EVENT_CASE(ResponderEnd);
431
- VIEW_EVENT_CASE(ResponderRelease);
432
- VIEW_EVENT_CASE(ResponderMove);
433
- VIEW_EVENT_CASE(ResponderTerminate);
434
- VIEW_EVENT_CASE(ResponderTerminationRequest);
435
- VIEW_EVENT_CASE(ShouldBlockNativeResponder);
436
- VIEW_EVENT_CASE(TouchStart);
437
- VIEW_EVENT_CASE(TouchMove);
438
- VIEW_EVENT_CASE(TouchEnd);
439
- VIEW_EVENT_CASE(TouchCancel);
440
- // BorderRadii
441
- SET_CASCADED_RECTANGLE_CORNERS(borderRadii, "border", "Radius", value);
442
- SET_CASCADED_RECTANGLE_EDGES(borderColors, "border", "Color", value);
443
- SET_CASCADED_RECTANGLE_EDGES(borderStyles, "border", "Style", value);
444
- }
445
- }
446
-
447
- #pragma mark - Convenience Methods
448
-
449
- static BorderRadii ensureNoOverlap(const BorderRadii& radii, const Size& size) {
450
- // "Corner curves must not overlap: When the sum of any two adjacent border
451
- // radii exceeds the size of the border box, UAs must proportionally reduce
452
- // the used values of all border radii until none of them overlap."
453
- // Source: https://www.w3.org/TR/css-backgrounds-3/#corner-overlap
454
-
455
- float leftEdgeRadii = radii.topLeft.vertical + radii.bottomLeft.vertical;
456
- float topEdgeRadii = radii.topLeft.horizontal + radii.topRight.horizontal;
457
- float rightEdgeRadii = radii.topRight.vertical + radii.bottomRight.vertical;
458
- float bottomEdgeRadii =
459
- radii.bottomLeft.horizontal + radii.bottomRight.horizontal;
460
-
461
- float leftEdgeRadiiScale =
462
- (leftEdgeRadii > 0) ? std::min(size.height / leftEdgeRadii, (Float)1) : 0;
463
- float topEdgeRadiiScale =
464
- (topEdgeRadii > 0) ? std::min(size.width / topEdgeRadii, (Float)1) : 0;
465
- float rightEdgeRadiiScale = (rightEdgeRadii > 0)
466
- ? std::min(size.height / rightEdgeRadii, (Float)1)
467
- : 0;
468
- float bottomEdgeRadiiScale = (bottomEdgeRadii > 0)
469
- ? std::min(size.width / bottomEdgeRadii, (Float)1)
470
- : 0;
471
-
472
- return BorderRadii{
473
- .topLeft =
474
- {static_cast<float>(
475
- radii.topLeft.vertical *
476
- std::min(topEdgeRadiiScale, leftEdgeRadiiScale)),
477
- static_cast<float>(
478
- radii.topLeft.horizontal *
479
- std::min(topEdgeRadiiScale, leftEdgeRadiiScale))},
480
- .topRight =
481
- {static_cast<float>(
482
- radii.topRight.vertical *
483
- std::min(topEdgeRadiiScale, rightEdgeRadiiScale)),
484
- static_cast<float>(
485
- radii.topRight.horizontal *
486
- std::min(topEdgeRadiiScale, rightEdgeRadiiScale))},
487
- .bottomLeft =
488
- {static_cast<float>(
489
- radii.bottomLeft.vertical *
490
- std::min(bottomEdgeRadiiScale, leftEdgeRadiiScale)),
491
- static_cast<float>(
492
- radii.bottomLeft.horizontal *
493
- std::min(bottomEdgeRadiiScale, leftEdgeRadiiScale))},
494
- .bottomRight =
495
- {static_cast<float>(
496
- radii.bottomRight.vertical *
497
- std::min(bottomEdgeRadiiScale, rightEdgeRadiiScale)),
498
- static_cast<float>(
499
- radii.bottomRight.horizontal *
500
- std::min(bottomEdgeRadiiScale, rightEdgeRadiiScale))},
501
- };
502
- }
503
-
504
- static BorderRadii radiiPercentToPoint(
505
- const RectangleCorners<ValueUnit>& radii,
506
- const Size& size) {
507
- return BorderRadii{
508
- .topLeft =
509
- {radii.topLeft.resolve(size.height),
510
- radii.topLeft.resolve(size.width)},
511
- .topRight =
512
- {radii.topRight.resolve(size.height),
513
- radii.topRight.resolve(size.width)},
514
- .bottomLeft =
515
- {radii.bottomLeft.resolve(size.height),
516
- radii.bottomLeft.resolve(size.width)},
517
- .bottomRight =
518
- {radii.bottomRight.resolve(size.height),
519
- radii.bottomRight.resolve(size.width)},
520
- };
521
- }
522
-
523
- CascadedBorderWidths BaseViewProps::getBorderWidths() const {
524
- return CascadedBorderWidths{
525
- .left = optionalFloatFromYogaValue(yogaStyle.border(yoga::Edge::Left)),
526
- .top = optionalFloatFromYogaValue(yogaStyle.border(yoga::Edge::Top)),
527
- .right = optionalFloatFromYogaValue(yogaStyle.border(yoga::Edge::Right)),
528
- .bottom =
529
- optionalFloatFromYogaValue(yogaStyle.border(yoga::Edge::Bottom)),
530
- .start = optionalFloatFromYogaValue(yogaStyle.border(yoga::Edge::Start)),
531
- .end = optionalFloatFromYogaValue(yogaStyle.border(yoga::Edge::End)),
532
- .horizontal =
533
- optionalFloatFromYogaValue(yogaStyle.border(yoga::Edge::Horizontal)),
534
- .vertical =
535
- optionalFloatFromYogaValue(yogaStyle.border(yoga::Edge::Vertical)),
536
- .all = optionalFloatFromYogaValue(yogaStyle.border(yoga::Edge::All)),
537
- };
538
- }
539
-
540
- BorderMetrics BaseViewProps::resolveBorderMetrics(
541
- const LayoutMetrics& layoutMetrics) const {
542
- auto isRTL =
543
- bool{layoutMetrics.layoutDirection == LayoutDirection::RightToLeft};
544
-
545
- auto borderWidths = getBorderWidths();
546
-
547
- BorderRadii radii = radiiPercentToPoint(
548
- borderRadii.resolve(isRTL, ValueUnit{0.0f, UnitType::Point}),
549
- layoutMetrics.frame.size);
550
-
551
- return {
552
- .borderColors = borderColors.resolve(isRTL, {}),
553
- .borderWidths = borderWidths.resolve(isRTL, 0),
554
- .borderRadii = ensureNoOverlap(radii, layoutMetrics.frame.size),
555
- .borderCurves = borderCurves.resolve(isRTL, BorderCurve::Circular),
556
- .borderStyles = borderStyles.resolve(isRTL, BorderStyle::Solid),
557
- };
558
- }
559
-
560
- Transform BaseViewProps::resolveTransform(
561
- const LayoutMetrics& layoutMetrics) const {
562
- const auto& frameSize = layoutMetrics.frame.size;
563
- return resolveTransform(frameSize, transform, transformOrigin);
564
- }
565
-
566
- Transform BaseViewProps::resolveTransform(
567
- const Size& frameSize,
568
- const Transform& transform,
569
- const TransformOrigin& transformOrigin) {
570
- auto transformMatrix = Transform{};
571
-
572
- // transform is matrix
573
- if (transform.operations.size() == 1 &&
574
- transform.operations[0].type == TransformOperationType::Arbitrary) {
575
- transformMatrix = transform;
576
- } else {
577
- for (const auto& operation : transform.operations) {
578
- transformMatrix = transformMatrix *
579
- Transform::FromTransformOperation(operation, frameSize, transform);
580
- }
581
- }
582
-
583
- if (transformOrigin.isSet()) {
584
- std::array<float, 3> translateOffsets = getTranslateForTransformOrigin(
585
- frameSize.width, frameSize.height, transformOrigin);
586
- transformMatrix =
587
- Transform::Translate(
588
- translateOffsets[0], translateOffsets[1], translateOffsets[2]) *
589
- transformMatrix *
590
- Transform::Translate(
591
- -translateOffsets[0], -translateOffsets[1], -translateOffsets[2]);
592
- }
593
-
594
- return transformMatrix;
595
- }
596
-
597
- bool BaseViewProps::getClipsContentToBounds() const {
598
- return yogaStyle.overflow() != yoga::Overflow::Visible;
599
- }
600
-
601
- #pragma mark - DebugStringConvertible
602
-
603
- #if RN_DEBUG_STRING_CONVERTIBLE
604
- SharedDebugStringConvertibleList BaseViewProps::getDebugProps() const {
605
- const auto& defaultBaseViewProps = BaseViewProps();
606
-
607
- return AccessibilityProps::getDebugProps() +
608
- YogaStylableProps::getDebugProps() +
609
- SharedDebugStringConvertibleList{
610
- debugStringConvertibleItem(
611
- "opacity", opacity, defaultBaseViewProps.opacity),
612
- debugStringConvertibleItem(
613
- "backgroundColor",
614
- backgroundColor,
615
- defaultBaseViewProps.backgroundColor),
616
- debugStringConvertibleItem(
617
- "zIndex", zIndex, defaultBaseViewProps.zIndex.value_or(0)),
618
- debugStringConvertibleItem(
619
- "pointerEvents",
620
- pointerEvents,
621
- defaultBaseViewProps.pointerEvents),
622
- debugStringConvertibleItem(
623
- "transform", transform, defaultBaseViewProps.transform),
624
- };
625
- }
626
- #endif
627
-
628
- } // namespace facebook::react