react-native-windows 0.77.0 → 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.
Files changed (233) 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/DevMenu.cpp +6 -6
  148. package/Microsoft.ReactNative/Views/DevMenu.h +1 -1
  149. package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +2 -2
  150. package/Microsoft.ReactNative/Views/ViewPanel.cpp +1 -1
  151. package/Microsoft.ReactNative/Views/ViewViewManager.cpp +2 -2
  152. package/Microsoft.ReactNative/XamlUIService.cpp +13 -7
  153. package/Microsoft.ReactNative/XamlUIService.h +4 -1
  154. package/Microsoft.ReactNative/XamlUIService.idl +2 -0
  155. package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +6 -2
  156. package/Microsoft.ReactNative.Cxx/ReactContext.h +1 -1
  157. package/Microsoft.ReactNative.Cxx/XamlUtils.h +12 -0
  158. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  159. package/PropertySheets/React.Cpp.props +3 -0
  160. package/PropertySheets/WebView2.props +1 -1
  161. package/PropertySheets/WinUI.props +5 -4
  162. package/ReactCommon/ReactCommon.vcxproj +5 -1
  163. package/ReactCommon/ReactCommon.vcxproj.filters +1 -1
  164. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +3 -3
  165. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +3 -3
  166. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +91 -0
  167. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +1 -12
  168. package/{Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h → ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/textinput/TextInputState.h} +37 -35
  169. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +1 -0
  170. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +4 -0
  171. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/ImageRequestParams.h +30 -0
  172. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/runtimescheduler/SchedulerPriorityUtils.h +4 -3
  173. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/primitives.h +179 -0
  174. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +43 -57
  175. package/Shared/HermesRuntimeHolder.cpp +2 -2
  176. package/Shared/Shared.vcxitems +8 -14
  177. package/Shared/Shared.vcxitems.filters +4 -16
  178. package/Shared/Threading/BatchingQueueThread.cpp +3 -3
  179. package/codegen/NativeCPUTimeSpec.g.h +41 -0
  180. package/codegen/NativeFantomSpec.g.h +78 -0
  181. package/codegen/NativePerformanceSpec.g.h +31 -43
  182. package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +84 -84
  183. package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +212 -0
  184. package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +295 -0
  185. package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +200 -0
  186. package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +224 -0
  187. package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +250 -0
  188. package/codegen/react/components/rnwcore/AndroidSwitch.g.h +267 -0
  189. package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +234 -0
  190. package/codegen/react/components/rnwcore/InputAccessory.g.h +200 -0
  191. package/codegen/react/components/rnwcore/ModalHostView.g.h +283 -0
  192. package/codegen/react/components/rnwcore/PullToRefreshView.g.h +246 -0
  193. package/codegen/react/components/rnwcore/SafeAreaView.g.h +197 -0
  194. package/codegen/react/components/rnwcore/Switch.g.h +263 -0
  195. package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +200 -0
  196. package/codegen/rnwcoreJSI-generated.cpp +90 -57
  197. package/codegen/rnwcoreJSI.h +241 -104
  198. package/index.js +5 -0
  199. package/index.windows.js +5 -0
  200. package/just-task.js +1 -1
  201. package/package.json +25 -26
  202. package/src/private/animated/NativeAnimatedValidation.js +1 -1
  203. package/src/private/featureflags/ReactNativeFeatureFlags.js +33 -27
  204. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -5
  205. package/src/private/renderer/errorhandling/ErrorHandlers.js +12 -55
  206. package/src/private/specs/modules/{NativeJSCSamplingProfiler.js → NativeCPUTime.js} +7 -2
  207. package/src/private/specs/modules/NativeFantom.js +37 -0
  208. package/src/private/utilities/ensureInstance.js +21 -0
  209. package/src/private/webapis/dom/nodes/ReactNativeElement.js +49 -6
  210. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +17 -9
  211. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +11 -11
  212. package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +1 -1
  213. package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -1
  214. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
  215. package/src/private/webapis/performance/Performance.js +0 -12
  216. package/src/private/webapis/performance/specs/NativePerformance.js +0 -11
  217. package/types/index.d.ts +1 -0
  218. package/Libraries/HeapCapture/HeapCapture.js +0 -29
  219. package/Libraries/HeapCapture/NativeJSCHeapCapture.js +0 -13
  220. package/Libraries/Performance/NativeJSCSamplingProfiler.js +0 -13
  221. package/Libraries/Performance/SamplingProfiler.js +0 -39
  222. package/Libraries/ReactNative/__mocks__/FabricUIManager.js +0 -334
  223. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +0 -39
  224. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +0 -18
  225. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h +0 -39
  226. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +0 -34
  227. package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.cpp +0 -53
  228. package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.h +0 -26
  229. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/LayoutableShadowNode.cpp +0 -363
  230. package/codegen/NativeJSCSamplingProfilerSpec.g.h +0 -35
  231. package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +0 -413
  232. package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +0 -181
  233. package/src/private/webapis/mutationobserver/specs/__mocks__/NativeMutationObserver.js +0 -327
@@ -17,6 +17,7 @@ export type NativeIntersectionObserverEntry = {
17
17
  targetInstanceHandle: mixed,
18
18
  targetRect: $ReadOnlyArray<number>, // It's actually a tuple with x, y, width and height
19
19
  rootRect: $ReadOnlyArray<number>, // It's actually a tuple with x, y, width and height
20
+ // TODO(T209328432) - Remove optionality of intersectionRect when native changes are released
20
21
  intersectionRect: ?$ReadOnlyArray<number>, // It's actually a tuple with x, y, width and height
21
22
  isIntersectingAboveThresholds: boolean,
22
23
  time: number,
@@ -115,9 +115,6 @@ export default class Performance {
115
115
  markName,
116
116
  markOptions?.startTime,
117
117
  );
118
- } else if (NativePerformance?.mark) {
119
- computedStartTime = markOptions?.startTime ?? performance.now();
120
- NativePerformance?.mark?.(markName, computedStartTime);
121
118
  } else {
122
119
  warnNoNativePerformance();
123
120
  computedStartTime = performance.now();
@@ -203,15 +200,6 @@ export default class Performance {
203
200
  startMarkName,
204
201
  endMarkName,
205
202
  );
206
- } else if (NativePerformance?.measure) {
207
- NativePerformance.measure(
208
- measureName,
209
- startTime,
210
- endTime,
211
- duration,
212
- startMarkName,
213
- endMarkName,
214
- );
215
203
  } else {
216
204
  warnNoNativePerformance();
217
205
  }
@@ -45,17 +45,6 @@ export type PerformanceObserverInit = {
45
45
 
46
46
  export interface Spec extends TurboModule {
47
47
  +now?: () => number;
48
- // TODO: remove when `markWithResult` is fully rolled out.
49
- +mark?: (name: string, startTime: number) => void;
50
- // TODO: remove when `measureWithResult` is fully rolled out.
51
- +measure?: (
52
- name: string,
53
- startTime: number,
54
- endTime: number,
55
- duration?: number,
56
- startMark?: string,
57
- endMark?: string,
58
- ) => void;
59
48
  +markWithResult?: (
60
49
  name: string,
61
50
  startTime?: number,
package/types/index.d.ts CHANGED
@@ -84,6 +84,7 @@ export * from '../Libraries/Components/Clipboard/Clipboard';
84
84
  export * from '../Libraries/Components/DrawerAndroid/DrawerLayoutAndroid';
85
85
  export * from '../Libraries/Components/Keyboard/Keyboard';
86
86
  export * from '../Libraries/Components/Keyboard/KeyboardAvoidingView';
87
+ export * from '../Libraries/Components/LayoutConformance/LayoutConformance';
87
88
  export * from '../Libraries/Components/Pressable/Pressable';
88
89
  export * from '../Libraries/Components/ProgressBarAndroid/ProgressBarAndroid';
89
90
  export * from '../Libraries/Components/RefreshControl/RefreshControl';
@@ -1,29 +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
- * @format
8
- * @flow strict
9
- */
10
-
11
- import NativeJSCHeapCapture from './NativeJSCHeapCapture';
12
-
13
- const HeapCapture = {
14
- captureHeap: function (path: string) {
15
- let error = null;
16
- try {
17
- global.nativeCaptureHeap(path);
18
- console.log('HeapCapture.captureHeap succeeded: ' + path);
19
- } catch (e) {
20
- console.log('HeapCapture.captureHeap error: ' + e.toString());
21
- error = e.toString();
22
- }
23
- if (NativeJSCHeapCapture) {
24
- NativeJSCHeapCapture.captureComplete(path, error);
25
- }
26
- },
27
- };
28
-
29
- module.exports = HeapCapture;
@@ -1,13 +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
- * @flow strict
8
- * @format
9
- */
10
-
11
- export * from '../../src/private/specs/modules/NativeJSCHeapCapture';
12
- import NativeJSCHeapCapture from '../../src/private/specs/modules/NativeJSCHeapCapture';
13
- export default NativeJSCHeapCapture;
@@ -1,13 +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
- * @flow strict
8
- * @format
9
- */
10
-
11
- export * from '../../src/private/specs/modules/NativeJSCSamplingProfiler';
12
- import NativeJSCSamplingProfiler from '../../src/private/specs/modules/NativeJSCSamplingProfiler';
13
- export default NativeJSCSamplingProfiler;
@@ -1,39 +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
- * @format
8
- * @flow strict
9
- */
10
-
11
- 'use strict';
12
-
13
- const SamplingProfiler = {
14
- poke: function (token: number): void {
15
- let error = null;
16
- let result = null;
17
- try {
18
- result = global.pokeSamplingProfiler();
19
- if (result === null) {
20
- console.log('The JSC Sampling Profiler has started');
21
- } else {
22
- console.log('The JSC Sampling Profiler has stopped');
23
- }
24
- } catch (e) {
25
- console.log(
26
- 'Error occurred when restarting Sampling Profiler: ' + e.toString(),
27
- );
28
- error = e.toString();
29
- }
30
-
31
- const NativeJSCSamplingProfiler =
32
- require('./NativeJSCSamplingProfiler').default;
33
- if (NativeJSCSamplingProfiler) {
34
- NativeJSCSamplingProfiler.operationComplete(token, result, error);
35
- }
36
- },
37
- };
38
-
39
- module.exports = SamplingProfiler;
@@ -1,334 +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
- * @flow strict-local
8
- * @format
9
- * @oncall react_native
10
- */
11
-
12
- import type {
13
- InternalInstanceHandle,
14
- LayoutAnimationConfig,
15
- MeasureInWindowOnSuccessCallback,
16
- MeasureLayoutOnSuccessCallback,
17
- MeasureOnSuccessCallback,
18
- Node,
19
- } from '../../Renderer/shims/ReactNativeTypes';
20
- import type {RootTag} from '../../Types/RootTagTypes';
21
- import type {
22
- NodeProps,
23
- NodeSet,
24
- Spec as FabricUIManager,
25
- } from '../FabricUIManager';
26
-
27
- import {createRootTag} from '../RootTag.js';
28
-
29
- export type NodeMock = {
30
- children: NodeSet,
31
- instanceHandle: InternalInstanceHandle,
32
- props: NodeProps,
33
- reactTag: number,
34
- rootTag: RootTag,
35
- viewName: string,
36
- };
37
-
38
- export function fromNode(node: Node): NodeMock {
39
- // $FlowExpectedError[incompatible-return]
40
- return node;
41
- }
42
-
43
- export function toNode(node: NodeMock): Node {
44
- // $FlowExpectedError[incompatible-return]
45
- return node;
46
- }
47
-
48
- // Mock of the Native Hooks
49
-
50
- const roots: Map<RootTag, NodeSet> = new Map();
51
- const allocatedTags: Set<number> = new Set();
52
-
53
- export function ensureHostNode(node: Node): void {
54
- if (node == null || typeof node !== 'object') {
55
- throw new Error(
56
- `Expected node to be an object. Got ${
57
- node === null ? 'null' : typeof node
58
- } value`,
59
- );
60
- }
61
-
62
- if (typeof node.viewName !== 'string') {
63
- throw new Error(
64
- `Expected node to be a host node. Got object with ${
65
- node.viewName === null ? 'null' : typeof node.viewName
66
- } viewName`,
67
- );
68
- }
69
- }
70
-
71
- function getAncestorsInChildSet(
72
- node: Node,
73
- childSet: NodeSet,
74
- ): ?$ReadOnlyArray<[Node, number]> {
75
- const rootNode = toNode({
76
- reactTag: 0,
77
- rootTag: fromNode(node).rootTag,
78
- viewName: 'RootNode',
79
- // $FlowExpectedError
80
- instanceHandle: null,
81
- props: {},
82
- children: childSet,
83
- });
84
-
85
- let position = 0;
86
- for (const child of childSet) {
87
- const ancestors = getAncestors(child, node);
88
- if (ancestors) {
89
- return [[rootNode, position]].concat(ancestors);
90
- }
91
- position++;
92
- }
93
-
94
- return null;
95
- }
96
-
97
- export function getAncestorsInCurrentTree(
98
- node: Node,
99
- ): ?$ReadOnlyArray<[Node, number]> {
100
- const childSet = roots.get(fromNode(node).rootTag);
101
- if (childSet == null) {
102
- return null;
103
- }
104
-
105
- return getAncestorsInChildSet(node, childSet);
106
- }
107
-
108
- function getAncestors(root: Node, node: Node): ?$ReadOnlyArray<[Node, number]> {
109
- if (fromNode(root).reactTag === fromNode(node).reactTag) {
110
- return [];
111
- }
112
-
113
- let position = 0;
114
- for (const child of fromNode(root).children) {
115
- const ancestors = getAncestors(child, node);
116
- if (ancestors != null) {
117
- return [[root, position]].concat(ancestors);
118
- }
119
- position++;
120
- }
121
-
122
- return null;
123
- }
124
-
125
- export function getNodeInChildSet(node: Node, childSet: NodeSet): ?Node {
126
- const ancestors = getAncestorsInChildSet(node, childSet);
127
- if (ancestors == null) {
128
- return null;
129
- }
130
-
131
- const [parent, position] = ancestors[ancestors.length - 1];
132
- const nodeInCurrentTree = fromNode(parent).children[position];
133
- return nodeInCurrentTree;
134
- }
135
-
136
- export function getNodeInCurrentTree(node: Node): ?Node {
137
- const childSet = roots.get(fromNode(node).rootTag);
138
- if (childSet == null) {
139
- return null;
140
- }
141
-
142
- return getNodeInChildSet(node, childSet);
143
- }
144
-
145
- interface IFabricUIManagerMock extends FabricUIManager {
146
- getRoot(rootTag: RootTag | number): NodeSet;
147
- __getInstanceHandleFromNode(node: Node): InternalInstanceHandle;
148
- __addCommitHook(commitHook: UIManagerCommitHook): void;
149
- __removeCommitHook(commitHook: UIManagerCommitHook): void;
150
- }
151
-
152
- export interface UIManagerCommitHook {
153
- shadowTreeWillCommit: (
154
- rootTag: RootTag,
155
- oldChildSet: ?NodeSet,
156
- newChildSet: NodeSet,
157
- ) => void;
158
- }
159
-
160
- const commitHooks: Set<UIManagerCommitHook> = new Set();
161
-
162
- const FabricUIManagerMock: IFabricUIManagerMock = {
163
- createNode: jest.fn(
164
- (
165
- reactTag: number,
166
- viewName: string,
167
- rootTag: RootTag,
168
- props: NodeProps,
169
- instanceHandle: InternalInstanceHandle,
170
- ): Node => {
171
- if (allocatedTags.has(reactTag)) {
172
- throw new Error(`Created two native views with tag ${reactTag}`);
173
- }
174
-
175
- allocatedTags.add(reactTag);
176
- return toNode({
177
- reactTag,
178
- rootTag,
179
- viewName,
180
- instanceHandle,
181
- props: props,
182
- children: [],
183
- });
184
- },
185
- ),
186
-
187
- cloneNode: jest.fn((node: Node): Node => {
188
- return toNode({...fromNode(node)});
189
- }),
190
-
191
- cloneNodeWithNewChildren: jest.fn((node: Node): Node => {
192
- return toNode({...fromNode(node), children: []});
193
- }),
194
-
195
- cloneNodeWithNewProps: jest.fn((node: Node, newProps: NodeProps): Node => {
196
- return toNode({
197
- ...fromNode(node),
198
- props: {
199
- ...fromNode(node).props,
200
- ...newProps,
201
- },
202
- });
203
- }),
204
-
205
- cloneNodeWithNewChildrenAndProps: jest.fn(
206
- (node: Node, newProps: NodeProps): Node => {
207
- return toNode({
208
- ...fromNode(node),
209
- children: [],
210
- props: {
211
- ...fromNode(node).props,
212
- ...newProps,
213
- },
214
- });
215
- },
216
- ),
217
-
218
- createChildSet: jest.fn((rootTag: RootTag): NodeSet => {
219
- return [];
220
- }),
221
-
222
- appendChild: jest.fn((parentNode: Node, child: Node): Node => {
223
- // Although the signature returns a Node, React expects this to be mutating.
224
- fromNode(parentNode).children.push(child);
225
- return parentNode;
226
- }),
227
-
228
- appendChildToSet: jest.fn((childSet: NodeSet, child: Node): void => {
229
- childSet.push(child);
230
- }),
231
-
232
- completeRoot: jest.fn((rootTag: RootTag, childSet: NodeSet): void => {
233
- commitHooks.forEach(hook =>
234
- hook.shadowTreeWillCommit(rootTag, roots.get(rootTag), childSet),
235
- );
236
- roots.set(rootTag, childSet);
237
- }),
238
-
239
- measure: jest.fn((node: Node, callback: MeasureOnSuccessCallback): void => {
240
- ensureHostNode(node);
241
-
242
- callback(10, 10, 100, 100, 0, 0);
243
- }),
244
-
245
- measureInWindow: jest.fn(
246
- (node: Node, callback: MeasureInWindowOnSuccessCallback): void => {
247
- ensureHostNode(node);
248
-
249
- callback(10, 10, 100, 100);
250
- },
251
- ),
252
-
253
- measureLayout: jest.fn(
254
- (
255
- node: Node,
256
- relativeNode: Node,
257
- onFail: () => void,
258
- onSuccess: MeasureLayoutOnSuccessCallback,
259
- ): void => {
260
- ensureHostNode(node);
261
- ensureHostNode(relativeNode);
262
-
263
- onSuccess(1, 1, 100, 100);
264
- },
265
- ),
266
-
267
- configureNextLayoutAnimation: jest.fn(
268
- (
269
- config: LayoutAnimationConfig,
270
- callback: () => void, // check what is returned here
271
- errorCallback: () => void,
272
- ): void => {},
273
- ),
274
-
275
- sendAccessibilityEvent: jest.fn((node: Node, eventType: string): void => {}),
276
-
277
- findShadowNodeByTag_DEPRECATED: jest.fn((reactTag: number): ?Node => {}),
278
-
279
- findNodeAtPoint: jest.fn(
280
- (
281
- node: Node,
282
- locationX: number,
283
- locationY: number,
284
- callback: (instanceHandle: ?InternalInstanceHandle) => void,
285
- ): void => {},
286
- ),
287
-
288
- getBoundingClientRect: jest.fn(
289
- (
290
- node: Node,
291
- includeTransform: boolean,
292
- ): ?[
293
- /* x:*/ number,
294
- /* y:*/ number,
295
- /* width:*/ number,
296
- /* height:*/ number,
297
- ] => {},
298
- ),
299
-
300
- setNativeProps: jest.fn((node: Node, newProps: NodeProps): void => {}),
301
-
302
- dispatchCommand: jest.fn(
303
- (node: Node, commandName: string, args: Array<mixed>): void => {},
304
- ),
305
-
306
- compareDocumentPosition: jest.fn((node: Node, otherNode: Node): number => 0),
307
-
308
- getRoot(containerTag: RootTag | number): NodeSet {
309
- const tag = createRootTag(containerTag);
310
- const root = roots.get(tag);
311
- if (!root) {
312
- throw new Error('No root found for containerTag ' + Number(tag));
313
- }
314
- return root;
315
- },
316
-
317
- __getInstanceHandleFromNode(node: Node): InternalInstanceHandle {
318
- return fromNode(node).instanceHandle;
319
- },
320
-
321
- __addCommitHook(commitHook: UIManagerCommitHook): void {
322
- commitHooks.add(commitHook);
323
- },
324
-
325
- __removeCommitHook(commitHook: UIManagerCommitHook): void {
326
- commitHooks.delete(commitHook);
327
- },
328
- };
329
-
330
- global.nativeFabricUIManager = FabricUIManagerMock;
331
-
332
- export function getFabricUIManager(): ?IFabricUIManagerMock {
333
- return FabricUIManagerMock;
334
- }
@@ -1,39 +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
- #pragma once
9
-
10
- #include <glog/logging.h>
11
- #include <react/renderer/core/ConcreteComponentDescriptor.h>
12
- // [Windows
13
- #include "WindowsModalHostViewShadowNode.h"
14
- // ]
15
-
16
- namespace facebook::react {
17
-
18
- /*
19
- * Descriptor for <WindowsModalHostView> component.
20
- */
21
-
22
- class WindowsModalHostViewComponentDescriptor final
23
- : public ConcreteComponentDescriptor<WindowsModalHostViewShadowNode> {
24
- public:
25
- using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
26
-
27
- void adopt(ShadowNode &shadowNode) const override {
28
- auto &layoutableShadowNode = static_cast<YogaLayoutableShadowNode &>(shadowNode);
29
- auto &stateData =
30
- static_cast<const WindowsModalHostViewShadowNode::ConcreteState &>(*shadowNode.getState()).getData();
31
-
32
- layoutableShadowNode.setSize(Size{stateData.screenSize.width, stateData.screenSize.height});
33
- layoutableShadowNode.setPositionType(YGPositionTypeAbsolute);
34
-
35
- ConcreteComponentDescriptor::adopt(shadowNode);
36
- }
37
- };
38
-
39
- } // namespace facebook::react
@@ -1,18 +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
- // [Windows
9
- #include "WindowsModalHostViewShadowNode.h"
10
- // ]
11
-
12
- #include <react/renderer/core/LayoutContext.h>
13
-
14
- namespace facebook::react {
15
-
16
- extern const char WindowsModalHostViewComponentName[] = "ModalHostView";
17
-
18
- } // namespace facebook::react
@@ -1,39 +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
- #pragma once
9
-
10
- #include <react/renderer/components/modal/ModalHostViewState.h>
11
- // [Windows
12
- #include <react/components/rnwcore/EventEmitters.h>
13
- #include <react/components/rnwcore/Props.h>
14
- // ]
15
- #include <react/renderer/components/view/ConcreteViewShadowNode.h>
16
-
17
- namespace facebook::react {
18
-
19
- extern const char WindowsModalHostViewComponentName[];
20
-
21
- /*
22
- * `ShadowNode` for <WindowsModalHostView> component.
23
- */
24
- class WindowsModalHostViewShadowNode final : public ConcreteViewShadowNode<
25
- WindowsModalHostViewComponentName,
26
- ModalHostViewProps,
27
- ModalHostViewEventEmitter,
28
- ModalHostViewState> {
29
- public:
30
- using ConcreteViewShadowNode::ConcreteViewShadowNode;
31
-
32
- static ShadowNodeTraits BaseTraits() {
33
- auto traits = ConcreteViewShadowNode::BaseTraits();
34
- traits.set(ShadowNodeTraits::Trait::RootNodeKind);
35
- return traits;
36
- }
37
- };
38
-
39
- } // namespace facebook::react
@@ -1,34 +0,0 @@
1
-
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
-
5
- #include "WindowsTextInputState.h"
6
-
7
- #include <react/renderer/components/text/conversions.h>
8
- #include <react/renderer/debug/debugStringConvertibleUtils.h>
9
- #include <react/renderer/mapbuffer/MapBuffer.h>
10
- #include <react/renderer/mapbuffer/MapBufferBuilder.h>
11
-
12
- #include <utility>
13
-
14
- namespace facebook::react {
15
-
16
- WindowsTextInputState::WindowsTextInputState(
17
- int64_t mostRecentEventCount,
18
- AttributedString attributedString,
19
- AttributedString reactTreeAttributedString,
20
- ParagraphAttributes paragraphAttributes,
21
- double defaultThemePaddingStart,
22
- double defaultThemePaddingEnd,
23
- double defaultThemePaddingTop,
24
- double defaultThemePaddingBottom)
25
- : mostRecentEventCount(mostRecentEventCount),
26
- attributedString(std::move(attributedString)),
27
- reactTreeAttributedString(std::move(reactTreeAttributedString)),
28
- paragraphAttributes(std::move(paragraphAttributes)),
29
- defaultThemePaddingStart(defaultThemePaddingStart),
30
- defaultThemePaddingEnd(defaultThemePaddingEnd),
31
- defaultThemePaddingTop(defaultThemePaddingTop),
32
- defaultThemePaddingBottom(defaultThemePaddingBottom) {}
33
-
34
- } // namespace facebook::react
@@ -1,53 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
-
4
- #include "pch.h"
5
-
6
- #include "ReactNativeConfigProperties.h"
7
- #include "unicode.h"
8
-
9
- namespace Microsoft::ReactNative {
10
-
11
- ReactNativeConfigProperties::ReactNativeConfigProperties(
12
- winrt::Microsoft::ReactNative::ReactPropertyBag const &properties)
13
- : m_properties(properties) {}
14
-
15
- ReactNativeConfigProperties::~ReactNativeConfigProperties() {}
16
-
17
- bool ReactNativeConfigProperties::getBool(const std::string &param) const {
18
- auto value = m_properties.Handle().Get(winrt::Microsoft::ReactNative::ReactPropertyBagHelper::GetName(
19
- winrt::Microsoft::ReactNative::ReactPropertyBagHelper::GetNamespace(winrt::hstring(L"ReactNativeConfig")),
20
- winrt::hstring(Common::Unicode::Utf8ToUtf16(param))));
21
-
22
- return winrt::unbox_value_or<bool>(value, false);
23
- }
24
-
25
- std::string ReactNativeConfigProperties::getString(const std::string &param) const {
26
- auto value = m_properties.Handle().Get(winrt::Microsoft::ReactNative::ReactPropertyBagHelper::GetName(
27
- winrt::Microsoft::ReactNative::ReactPropertyBagHelper::GetNamespace(winrt::hstring(L"ReactNativeConfig")),
28
- winrt::hstring(Common::Unicode::Utf8ToUtf16(param))));
29
-
30
- winrt::Windows::Foundation::IReference<winrt::hstring> result;
31
- if (value.try_as<winrt::Windows::Foundation::IReference<winrt::hstring>>(result)) {
32
- return Common::Unicode::Utf16ToUtf8(result.GetString());
33
- }
34
- return {};
35
- }
36
-
37
- int64_t ReactNativeConfigProperties::getInt64(const std::string &param) const {
38
- auto value = m_properties.Handle().Get(winrt::Microsoft::ReactNative::ReactPropertyBagHelper::GetName(
39
- winrt::Microsoft::ReactNative::ReactPropertyBagHelper::GetNamespace(winrt::hstring(L"ReactNativeConfig")),
40
- winrt::hstring(Common::Unicode::Utf8ToUtf16(param))));
41
-
42
- return winrt::unbox_value_or<int64_t>(value, 0);
43
- }
44
-
45
- double ReactNativeConfigProperties::getDouble(const std::string &param) const {
46
- auto value = m_properties.Handle().Get(winrt::Microsoft::ReactNative::ReactPropertyBagHelper::GetName(
47
- winrt::Microsoft::ReactNative::ReactPropertyBagHelper::GetNamespace(winrt::hstring(L"ReactNativeConfig")),
48
- winrt::hstring(Common::Unicode::Utf8ToUtf16(param))));
49
-
50
- return winrt::unbox_value_or<double>(value, 0);
51
- }
52
-
53
- } // namespace Microsoft::ReactNative