@office-iss/react-native-win32 0.74.4 → 0.75.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 (206) hide show
  1. package/.flowconfig +9 -4
  2. package/CHANGELOG.json +554 -51
  3. package/CHANGELOG.md +165 -30
  4. package/Libraries/Animated/AnimatedImplementation.js +2 -0
  5. package/Libraries/Animated/NativeAnimatedHelper.js +4 -0
  6. package/Libraries/Animated/NativeAnimatedHelper.win32.js +4 -0
  7. package/Libraries/Animated/createAnimatedComponent.js +10 -4
  8. package/Libraries/Animated/useAnimatedProps.js +56 -28
  9. package/Libraries/BatchedBridge/MessageQueue.js +1 -0
  10. package/Libraries/Components/Button.js +10 -5
  11. package/Libraries/Components/Button.win32.js +1 -0
  12. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +11 -2
  13. package/Libraries/Components/Pressable/Pressable.js +13 -6
  14. package/Libraries/Components/Pressable/Pressable.win32.js +13 -6
  15. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +4 -0
  16. package/Libraries/Components/ScrollView/ScrollView.js +109 -29
  17. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +6 -0
  18. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +13 -1
  19. package/Libraries/Components/StatusBar/StatusBar.js +1 -21
  20. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +0 -15
  21. package/Libraries/Components/TextInput/InputAccessoryView.js +10 -1
  22. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +0 -12
  23. package/Libraries/Components/TextInput/TextInput.d.ts +0 -19
  24. package/Libraries/Components/TextInput/TextInput.js +14 -70
  25. package/Libraries/Components/TextInput/TextInput.win32.js +15 -72
  26. package/Libraries/Components/Touchable/Touchable.js +2 -2
  27. package/Libraries/Components/Touchable/TouchableHighlight.d.ts +4 -10
  28. package/Libraries/Components/Touchable/TouchableHighlight.js +3 -1
  29. package/Libraries/Components/Touchable/TouchableOpacity.d.ts +4 -32
  30. package/Libraries/Components/Touchable/TouchableOpacity.js +3 -1
  31. package/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +8 -0
  32. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +117 -111
  33. package/Libraries/Components/View/ReactNativeStyleAttributes.js +6 -0
  34. package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
  35. package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +1 -0
  36. package/Libraries/Components/View/View.js +0 -11
  37. package/Libraries/Components/View/View.win32.js +0 -11
  38. package/Libraries/Components/View/ViewAccessibility.js +4 -4
  39. package/Libraries/Components/View/ViewAccessibility.win32.js +6 -6
  40. package/Libraries/Components/View/ViewPropTypes.d.ts +7 -49
  41. package/Libraries/Components/View/ViewPropTypes.js +7 -0
  42. package/Libraries/Components/View/ViewPropTypes.win32.js +7 -0
  43. package/Libraries/Core/Devtools/loadBundleFromServer.js +3 -3
  44. package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +153 -0
  45. package/Libraries/Core/Devtools/parseErrorStack.js +5 -5
  46. package/Libraries/Core/Devtools/parseHermesStack.js +22 -16
  47. package/Libraries/Core/ErrorHandlers.js +116 -0
  48. package/Libraries/Core/ExceptionsManager.js +2 -2
  49. package/Libraries/Core/ReactNativeVersion.js +3 -3
  50. package/Libraries/Core/setUpDeveloperTools.js +3 -1
  51. package/Libraries/Core/setUpPerformance.js +6 -4
  52. package/Libraries/Core/setUpReactDevTools.js +70 -10
  53. package/Libraries/Core/setUpTimers.js +50 -31
  54. package/Libraries/Debugging/DebuggingOverlayRegistry.js +1 -1
  55. package/Libraries/Image/Image.android.js +23 -13
  56. package/Libraries/Image/Image.d.ts +14 -15
  57. package/Libraries/Image/Image.ios.js +21 -11
  58. package/Libraries/Image/Image.win32.js +5 -3
  59. package/Libraries/Image/ImageProps.js +16 -5
  60. package/Libraries/Image/ImageTypes.flow.js +7 -2
  61. package/Libraries/Image/ImageUtils.js +1 -0
  62. package/Libraries/Image/ImageViewNativeComponent.js +2 -1
  63. package/Libraries/Inspector/ElementBox.js +6 -3
  64. package/Libraries/Inspector/ElementProperties.js +1 -1
  65. package/Libraries/Interaction/TouchHistoryMath.js +4 -4
  66. package/Libraries/IntersectionObserver/IntersectionObserverManager.js +6 -26
  67. package/Libraries/JSInspector/NetworkAgent.js +1 -1
  68. package/Libraries/LogBox/Data/LogBoxData.js +39 -29
  69. package/Libraries/LogBox/Data/LogBoxLog.js +114 -2
  70. package/Libraries/LogBox/Data/parseLogBoxLog.js +168 -53
  71. package/Libraries/LogBox/LogBox.js +29 -12
  72. package/Libraries/LogBox/LogBoxNotificationContainer.js +4 -0
  73. package/Libraries/LogBox/UI/LogBoxInspector.js +8 -70
  74. package/Libraries/LogBox/UI/LogBoxInspectorBody.js +87 -0
  75. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +6 -42
  76. package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +58 -0
  77. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +5 -66
  78. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +8 -52
  79. package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +76 -0
  80. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +8 -5
  81. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +8 -5
  82. package/Libraries/LogBox/UI/LogBoxNotification.js +13 -152
  83. package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +63 -0
  84. package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +67 -0
  85. package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +57 -0
  86. package/Libraries/NativeComponent/BaseViewConfig.android.js +5 -0
  87. package/Libraries/NativeComponent/BaseViewConfig.ios.js +5 -0
  88. package/Libraries/NativeComponent/BaseViewConfig.win32.js +5 -0
  89. package/Libraries/NativeComponent/NativeComponentRegistry.js +12 -5
  90. package/Libraries/NativeComponent/StaticViewConfigValidator.js +3 -0
  91. package/Libraries/Network/XMLHttpRequest.js +5 -1
  92. package/Libraries/NewAppScreen/components/LearnMoreLinks.js +3 -3
  93. package/Libraries/Pressability/Pressability.js +3 -51
  94. package/Libraries/Pressability/Pressability.win32.js +3 -51
  95. package/Libraries/ReactNative/AppContainer-dev.js +3 -2
  96. package/Libraries/ReactNative/AppContainer-prod.js +2 -1
  97. package/Libraries/ReactNative/AppContainer.js +2 -0
  98. package/Libraries/ReactNative/AppRegistry.d.ts +7 -0
  99. package/Libraries/ReactNative/AppRegistry.js +10 -4
  100. package/Libraries/ReactNative/BridgelessUIManager.js +1 -21
  101. package/Libraries/ReactNative/FabricUIManager.js +0 -51
  102. package/Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps.js +1 -0
  103. package/Libraries/ReactNative/RendererImplementation.js +20 -2
  104. package/Libraries/ReactNative/UIManager.d.ts +0 -21
  105. package/Libraries/ReactNative/UIManagerProperties.js +0 -3
  106. package/Libraries/ReactNative/__mocks__/FabricUIManager.js +5 -341
  107. package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -8
  108. package/Libraries/ReactNative/renderApplication.js +3 -0
  109. package/Libraries/Renderer/implementations/ReactFabric-dev.js +15682 -27088
  110. package/Libraries/Renderer/implementations/ReactFabric-prod.js +5082 -4381
  111. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3480 -2571
  112. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +15943 -27543
  113. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5303 -4606
  114. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3450 -2572
  115. package/Libraries/Renderer/shims/ReactFabric.js +2 -2
  116. package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
  117. package/Libraries/Renderer/shims/ReactNative.js +2 -3
  118. package/Libraries/Renderer/shims/ReactNativeTypes.js +24 -3
  119. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +2 -2
  120. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
  121. package/Libraries/Share/Share.d.ts +16 -10
  122. package/Libraries/Share/Share.js +14 -15
  123. package/Libraries/StyleSheet/StyleSheet.d.ts +1 -1
  124. package/Libraries/StyleSheet/StyleSheet.js +3 -10
  125. package/Libraries/StyleSheet/StyleSheet.win32.js +3 -10
  126. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +21 -21
  127. package/Libraries/StyleSheet/StyleSheetTypes.js +24 -18
  128. package/Libraries/StyleSheet/flattenStyle.js +1 -0
  129. package/Libraries/StyleSheet/processFilter.js +132 -0
  130. package/Libraries/StyleSheet/processTransform.js +18 -3
  131. package/Libraries/Text/Text.js +151 -128
  132. package/Libraries/Text/Text.win32.js +163 -138
  133. package/Libraries/Text/TextNativeComponent.js +5 -4
  134. package/Libraries/Text/TextNativeComponent.win32.js +5 -4
  135. package/Libraries/Text/TextProps.js +6 -6
  136. package/Libraries/Text/TextProps.win32.js +6 -6
  137. package/Libraries/TurboModule/TurboModuleRegistry.js +2 -1
  138. package/Libraries/Types/CodegenTypes.js +3 -0
  139. package/Libraries/Utilities/{LoadingView.android.js → DevLoadingView.js} +33 -11
  140. package/Libraries/Utilities/Dimensions.js +1 -0
  141. package/Libraries/Utilities/Dimensions.win32.js +1 -0
  142. package/Libraries/Utilities/HMRClient.js +36 -8
  143. package/Libraries/Utilities/HMRClientProdShim.js +1 -0
  144. package/Libraries/Utilities/Platform.android.js +4 -4
  145. package/Libraries/Utilities/RCTLog.js +1 -0
  146. package/Libraries/Utilities/ReactNativeTestTools.js +12 -24
  147. package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +11 -6
  148. package/Libraries/__tests__/ButtonWin32-test.js +7 -6
  149. package/Libraries/promiseRejectionTrackingOptions.js +1 -0
  150. package/jest/mockComponent.js +7 -0
  151. package/jest/renderer.js +25 -14
  152. package/jest/setup.js +19 -13
  153. package/jest.config.js +2 -1
  154. package/overrides.json +30 -29
  155. package/package.json +27 -25
  156. package/rn-get-polyfills.js +1 -0
  157. package/src/private/core/composeStyles.js +27 -0
  158. package/src/private/featureflags/ReactNativeFeatureFlags.js +93 -33
  159. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +23 -4
  160. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +56 -0
  161. package/src/private/fusebox/setUpFuseboxReactDevToolsDispatcher.js +108 -0
  162. package/src/private/specs/modules/NativeBlobModule.js +4 -2
  163. package/src/private/specs/modules/NativeDevSettings.js +1 -0
  164. package/src/private/specs/modules/NativePushNotificationManagerIOS.js +0 -4
  165. package/src/private/specs/modules/NativeUIManager.js +0 -7
  166. package/src/private/webapis/dom/geometry/DOMRectReadOnly.js +24 -24
  167. package/src/private/webapis/dom/nodes/ReactNativeElement.js +11 -14
  168. package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +2 -3
  169. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +24 -54
  170. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -13
  171. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +468 -0
  172. package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +413 -0
  173. package/src/private/webapis/dom/oldstylecollections/DOMRectList.js +4 -4
  174. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +4 -4
  175. package/src/private/webapis/dom/oldstylecollections/NodeList.js +5 -5
  176. package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +34 -0
  177. package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +21 -0
  178. package/src/private/webapis/performance/EventCounts.js +1 -1
  179. package/src/private/webapis/performance/MemoryInfo.js +9 -9
  180. package/src/private/webapis/performance/Performance.js +10 -56
  181. package/src/private/webapis/performance/PerformanceObserver.js +30 -22
  182. package/src/private/webapis/performance/RawPerformanceEntry.js +2 -7
  183. package/src/private/webapis/performance/ReactNativeStartupTiming.js +18 -18
  184. package/src/private/webapis/performance/UserTiming.js +63 -0
  185. package/src/private/webapis/performance/{NativePerformance.js → specs/NativePerformance.js} +3 -2
  186. package/src/private/webapis/performance/{NativePerformanceObserver.js → specs/NativePerformanceObserver.js} +2 -2
  187. package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformance.js +1 -1
  188. package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformanceObserver.js +3 -4
  189. package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +7 -49
  190. package/types/modules/globals.d.ts +4 -0
  191. package/Libraries/Components/ScrollView/ScrollView.win32.js +0 -1915
  192. package/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js +0 -13
  193. package/Libraries/Utilities/LoadingView.ios.js +0 -50
  194. package/Libraries/Utilities/LoadingView.js +0 -16
  195. package/jest/ReactNativeInternalFeatureFlagsMock.js +0 -13
  196. package/src/private/featureflags/NativeReactNativeFeatureFlags.js +0 -44
  197. package/src/private/featureflags/__tests__/ReactNativeFeatureFlags-test.js +0 -92
  198. package/src/private/specs/modules/NativeAnimationsDebugModule.js +0 -20
  199. package/src/private/webapis/dom/oldstylecollections/__tests__/DOMRectList-test.js +0 -85
  200. package/src/private/webapis/dom/oldstylecollections/__tests__/HTMLCollection-test.js +0 -80
  201. package/src/private/webapis/dom/oldstylecollections/__tests__/NodeList-test.js +0 -161
  202. package/src/private/webapis/performance/__tests__/EventCounts-test.js +0 -116
  203. package/src/private/webapis/performance/__tests__/NativePerformanceMock-test.js +0 -82
  204. package/src/private/webapis/performance/__tests__/NativePerformanceObserverMock-test.js +0 -108
  205. package/src/private/webapis/performance/__tests__/Performance-test.js +0 -117
  206. package/src/private/webapis/performance/__tests__/PerformanceObserver-test.js +0 -208
@@ -50,7 +50,7 @@ export function toNode(node: NodeMock): Node {
50
50
  const roots: Map<RootTag, NodeSet> = new Map();
51
51
  const allocatedTags: Set<number> = new Set();
52
52
 
53
- function ensureHostNode(node: Node): void {
53
+ export function ensureHostNode(node: Node): void {
54
54
  if (node == null || typeof node !== 'object') {
55
55
  throw new Error(
56
56
  `Expected node to be an object. Got ${
@@ -94,7 +94,7 @@ function getAncestorsInChildSet(
94
94
  return null;
95
95
  }
96
96
 
97
- function getAncestorsInCurrentTree(
97
+ export function getAncestorsInCurrentTree(
98
98
  node: Node,
99
99
  ): ?$ReadOnlyArray<[Node, number]> {
100
100
  const childSet = roots.get(fromNode(node).rootTag);
@@ -133,7 +133,7 @@ export function getNodeInChildSet(node: Node, childSet: NodeSet): ?Node {
133
133
  return nodeInCurrentTree;
134
134
  }
135
135
 
136
- function getNodeInCurrentTree(node: Node): ?Node {
136
+ export function getNodeInCurrentTree(node: Node): ?Node {
137
137
  const childSet = roots.get(fromNode(node).rootTag);
138
138
  if (childSet == null) {
139
139
  return null;
@@ -142,25 +142,6 @@ function getNodeInCurrentTree(node: Node): ?Node {
142
142
  return getNodeInChildSet(node, childSet);
143
143
  }
144
144
 
145
- function* dfs(node: ?Node): Iterator<Node> {
146
- if (node == null) {
147
- return;
148
- }
149
-
150
- yield node;
151
-
152
- for (const child of fromNode(node).children) {
153
- yield* dfs(child);
154
- }
155
- }
156
-
157
- function hasDisplayNone(node: Node): boolean {
158
- const props = fromNode(node).props;
159
- // Style is flattened when passed to native, so there's no style object.
160
- // $FlowFixMe[prop-missing]
161
- return props != null && props.display === 'none';
162
- }
163
-
164
145
  interface IFabricUIManagerMock extends FabricUIManager {
165
146
  getRoot(rootTag: RootTag | number): NodeSet;
166
147
  __getInstanceHandleFromNode(node: Node): InternalInstanceHandle;
@@ -313,333 +294,16 @@ const FabricUIManagerMock: IFabricUIManagerMock = {
313
294
  /* y:*/ number,
314
295
  /* width:*/ number,
315
296
  /* height:*/ number,
316
- ] => {
317
- ensureHostNode(node);
318
-
319
- const nodeInCurrentTree = getNodeInCurrentTree(node);
320
- const currentProps =
321
- nodeInCurrentTree != null ? fromNode(nodeInCurrentTree).props : null;
322
- if (currentProps == null) {
323
- return null;
324
- }
325
-
326
- const boundingClientRectForTests: ?{
327
- x: number,
328
- y: number,
329
- width: number,
330
- height: number,
331
- } =
332
- // $FlowExpectedError[prop-missing]
333
- currentProps.__boundingClientRectForTests;
334
-
335
- if (boundingClientRectForTests == null) {
336
- return null;
337
- }
338
-
339
- const {x, y, width, height} = boundingClientRectForTests;
340
- return [x, y, width, height];
341
- },
297
+ ] => {},
342
298
  ),
343
299
 
344
- hasPointerCapture: jest.fn((node: Node, pointerId: number): boolean => false),
345
-
346
- setPointerCapture: jest.fn((node: Node, pointerId: number): void => {}),
347
-
348
- releasePointerCapture: jest.fn((node: Node, pointerId: number): void => {}),
349
-
350
300
  setNativeProps: jest.fn((node: Node, newProps: NodeProps): void => {}),
351
301
 
352
302
  dispatchCommand: jest.fn(
353
303
  (node: Node, commandName: string, args: Array<mixed>): void => {},
354
304
  ),
355
305
 
356
- getParentNode: jest.fn((node: Node): ?InternalInstanceHandle => {
357
- const ancestors = getAncestorsInCurrentTree(node);
358
- if (ancestors == null || ancestors.length - 2 < 0) {
359
- return null;
360
- }
361
-
362
- const [parentOfParent, position] = ancestors[ancestors.length - 2];
363
- const parentInCurrentTree = fromNode(parentOfParent).children[position];
364
- return fromNode(parentInCurrentTree).instanceHandle;
365
- }),
366
-
367
- getChildNodes: jest.fn(
368
- (node: Node): $ReadOnlyArray<InternalInstanceHandle> => {
369
- const nodeInCurrentTree = getNodeInCurrentTree(node);
370
-
371
- if (nodeInCurrentTree == null) {
372
- return [];
373
- }
374
-
375
- return fromNode(nodeInCurrentTree).children.map(
376
- child => fromNode(child).instanceHandle,
377
- );
378
- },
379
- ),
380
-
381
- isConnected: jest.fn((node: Node): boolean => {
382
- return getNodeInCurrentTree(node) != null;
383
- }),
384
-
385
- getTextContent: jest.fn((node: Node): string => {
386
- const nodeInCurrentTree = getNodeInCurrentTree(node);
387
-
388
- let result = '';
389
-
390
- if (nodeInCurrentTree == null) {
391
- return result;
392
- }
393
-
394
- for (const childNode of dfs(nodeInCurrentTree)) {
395
- if (fromNode(childNode).viewName === 'RCTRawText') {
396
- const props = fromNode(childNode).props;
397
- // $FlowExpectedError[prop-missing]
398
- const maybeString: ?string = props.text;
399
- if (typeof maybeString === 'string') {
400
- result += maybeString;
401
- }
402
- }
403
- }
404
- return result;
405
- }),
406
-
407
- compareDocumentPosition: jest.fn((node: Node, otherNode: Node): number => {
408
- /* eslint-disable no-bitwise */
409
- const ReadOnlyNode =
410
- require('../../../src/private/webapis/dom/nodes/ReadOnlyNode').default;
411
-
412
- // Quick check for node vs. itself
413
- if (fromNode(node).reactTag === fromNode(otherNode).reactTag) {
414
- return 0;
415
- }
416
-
417
- if (fromNode(node).rootTag !== fromNode(otherNode).rootTag) {
418
- return ReadOnlyNode.DOCUMENT_POSITION_DISCONNECTED;
419
- }
420
-
421
- const ancestors = getAncestorsInCurrentTree(node);
422
- if (ancestors == null) {
423
- return ReadOnlyNode.DOCUMENT_POSITION_DISCONNECTED;
424
- }
425
-
426
- const otherAncestors = getAncestorsInCurrentTree(otherNode);
427
- if (otherAncestors == null) {
428
- return ReadOnlyNode.DOCUMENT_POSITION_DISCONNECTED;
429
- }
430
-
431
- // Consume all common ancestors
432
- let i = 0;
433
- while (
434
- i < ancestors.length &&
435
- i < otherAncestors.length &&
436
- ancestors[i][1] === otherAncestors[i][1]
437
- ) {
438
- i++;
439
- }
440
-
441
- if (i === ancestors.length) {
442
- return (
443
- ReadOnlyNode.DOCUMENT_POSITION_CONTAINED_BY |
444
- ReadOnlyNode.DOCUMENT_POSITION_FOLLOWING
445
- );
446
- }
447
-
448
- if (i === otherAncestors.length) {
449
- return (
450
- ReadOnlyNode.DOCUMENT_POSITION_CONTAINS |
451
- ReadOnlyNode.DOCUMENT_POSITION_PRECEDING
452
- );
453
- }
454
-
455
- if (ancestors[i][1] > otherAncestors[i][1]) {
456
- return ReadOnlyNode.DOCUMENT_POSITION_PRECEDING;
457
- }
458
-
459
- return ReadOnlyNode.DOCUMENT_POSITION_FOLLOWING;
460
- }),
461
-
462
- getOffset: jest.fn(
463
- (
464
- node: Node,
465
- ): ?[
466
- /* offsetParent: */ InternalInstanceHandle,
467
- /* offsetTop: */ number,
468
- /* offsetLeft: */ number,
469
- ] => {
470
- const ancestors = getAncestorsInCurrentTree(node);
471
- if (ancestors == null) {
472
- return null;
473
- }
474
-
475
- const [parent, position] = ancestors[ancestors.length - 1];
476
- const nodeInCurrentTree = fromNode(parent).children[position];
477
-
478
- const currentProps =
479
- nodeInCurrentTree != null ? fromNode(nodeInCurrentTree).props : null;
480
- if (currentProps == null || hasDisplayNone(nodeInCurrentTree)) {
481
- return null;
482
- }
483
-
484
- const offsetForTests: ?{
485
- top: number,
486
- left: number,
487
- } =
488
- // $FlowExpectedError[prop-missing]
489
- currentProps.__offsetForTests;
490
-
491
- if (offsetForTests == null) {
492
- return null;
493
- }
494
-
495
- let currentIndex = ancestors.length - 1;
496
- while (currentIndex >= 0 && !hasDisplayNone(ancestors[currentIndex][0])) {
497
- currentIndex--;
498
- }
499
-
500
- if (currentIndex >= 0) {
501
- // The node or one of its ancestors have display: none
502
- return null;
503
- }
504
-
505
- return [
506
- fromNode(parent).instanceHandle,
507
- offsetForTests.top,
508
- offsetForTests.left,
509
- ];
510
- },
511
- ),
512
-
513
- getScrollPosition: jest.fn(
514
- (node: Node): ?[/* scrollLeft: */ number, /* scrollTop: */ number] => {
515
- ensureHostNode(node);
516
-
517
- const nodeInCurrentTree = getNodeInCurrentTree(node);
518
- const currentProps =
519
- nodeInCurrentTree != null ? fromNode(nodeInCurrentTree).props : null;
520
- if (currentProps == null) {
521
- return null;
522
- }
523
-
524
- const scrollForTests: ?{
525
- scrollLeft: number,
526
- scrollTop: number,
527
- ...
528
- } =
529
- // $FlowExpectedError[prop-missing]
530
- currentProps.__scrollForTests;
531
-
532
- if (scrollForTests == null) {
533
- return null;
534
- }
535
-
536
- const {scrollLeft, scrollTop} = scrollForTests;
537
- return [scrollLeft, scrollTop];
538
- },
539
- ),
540
-
541
- getScrollSize: jest.fn(
542
- (node: Node): ?[/* scrollLeft: */ number, /* scrollTop: */ number] => {
543
- ensureHostNode(node);
544
-
545
- const nodeInCurrentTree = getNodeInCurrentTree(node);
546
- const currentProps =
547
- nodeInCurrentTree != null ? fromNode(nodeInCurrentTree).props : null;
548
- if (currentProps == null) {
549
- return null;
550
- }
551
-
552
- const scrollForTests: ?{
553
- scrollWidth: number,
554
- scrollHeight: number,
555
- ...
556
- } =
557
- // $FlowExpectedError[prop-missing]
558
- currentProps.__scrollForTests;
559
-
560
- if (scrollForTests == null) {
561
- return null;
562
- }
563
-
564
- const {scrollWidth, scrollHeight} = scrollForTests;
565
- return [scrollWidth, scrollHeight];
566
- },
567
- ),
568
-
569
- getInnerSize: jest.fn(
570
- (node: Node): ?[/* width: */ number, /* height: */ number] => {
571
- ensureHostNode(node);
572
-
573
- const nodeInCurrentTree = getNodeInCurrentTree(node);
574
- const currentProps =
575
- nodeInCurrentTree != null ? fromNode(nodeInCurrentTree).props : null;
576
- if (currentProps == null) {
577
- return null;
578
- }
579
-
580
- const innerSizeForTests: ?{
581
- width: number,
582
- height: number,
583
- ...
584
- } =
585
- // $FlowExpectedError[prop-missing]
586
- currentProps.__innerSizeForTests;
587
-
588
- if (innerSizeForTests == null) {
589
- return null;
590
- }
591
-
592
- const {width, height} = innerSizeForTests;
593
- return [width, height];
594
- },
595
- ),
596
-
597
- getBorderSize: jest.fn(
598
- (
599
- node: Node,
600
- ): ?[
601
- /* topWidth: */ number,
602
- /* rightWidth: */ number,
603
- /* bottomWidth: */ number,
604
- /* leftWidth: */ number,
605
- ] => {
606
- ensureHostNode(node);
607
-
608
- const nodeInCurrentTree = getNodeInCurrentTree(node);
609
- const currentProps =
610
- nodeInCurrentTree != null ? fromNode(nodeInCurrentTree).props : null;
611
- if (currentProps == null) {
612
- return null;
613
- }
614
-
615
- const borderSizeForTests: ?{
616
- topWidth?: number,
617
- rightWidth?: number,
618
- bottomWidth?: number,
619
- leftWidth?: number,
620
- ...
621
- } =
622
- // $FlowExpectedError[prop-missing]
623
- currentProps.__borderSizeForTests;
624
-
625
- if (borderSizeForTests == null) {
626
- return null;
627
- }
628
-
629
- const {
630
- topWidth = 0,
631
- rightWidth = 0,
632
- bottomWidth = 0,
633
- leftWidth = 0,
634
- } = borderSizeForTests;
635
- return [topWidth, rightWidth, bottomWidth, leftWidth];
636
- },
637
- ),
638
-
639
- getTagName: jest.fn((node: Node): string => {
640
- ensureHostNode(node);
641
- return 'RN:' + fromNode(node).viewName;
642
- }),
306
+ compareDocumentPosition: jest.fn((node: Node, otherNode: Node): number => 0),
643
307
 
644
308
  getRoot(containerTag: RootTag | number): NodeSet {
645
309
  const tag = createRootTag(containerTag);
@@ -14,22 +14,20 @@ const ReactNativeStyleAttributes = require('../Components/View/ReactNativeStyleA
14
14
  const resolveAssetSource = require('../Image/resolveAssetSource');
15
15
  const processColor = require('../StyleSheet/processColor').default;
16
16
  const processColorArray = require('../StyleSheet/processColorArray');
17
+ const processFilter = require('../StyleSheet/processFilter').default;
17
18
  const insetsDiffer = require('../Utilities/differ/insetsDiffer');
18
19
  const matricesDiffer = require('../Utilities/differ/matricesDiffer');
19
20
  const pointsDiffer = require('../Utilities/differ/pointsDiffer');
20
21
  const sizesDiffer = require('../Utilities/differ/sizesDiffer');
21
22
  const UIManager = require('./UIManager');
22
- const invariant = require('invariant');
23
23
  const nullthrows = require('nullthrows');
24
24
 
25
25
  function getNativeComponentAttributes(uiViewClassName: string): any {
26
26
  const viewConfig = UIManager.getViewManagerConfig(uiViewClassName);
27
27
 
28
- invariant(
29
- viewConfig != null && viewConfig.NativeProps != null,
30
- 'requireNativeComponent: "%s" was not found in the UIManager.',
31
- uiViewClassName,
32
- );
28
+ if (viewConfig == null) {
29
+ return null;
30
+ }
33
31
 
34
32
  // TODO: This seems like a whole lot of runtime initialization for every
35
33
  // native component that can be either avoided or simplified.
@@ -77,8 +75,8 @@ function getNativeComponentAttributes(uiViewClassName: string): any {
77
75
  ? true
78
76
  : {process}
79
77
  : process == null
80
- ? {diff}
81
- : {diff, process};
78
+ ? {diff}
79
+ : {diff, process};
82
80
  }
83
81
 
84
82
  // Unfortunately, the current setup declares style properties as top-level
@@ -191,6 +189,8 @@ function getProcessorForType(typeName: string): ?(nextProp: any) => any {
191
189
  return processColor;
192
190
  case 'ColorArray':
193
191
  return processColorArray;
192
+ case 'Filter':
193
+ return processFilter;
194
194
  case 'ImageSource':
195
195
  return resolveAssetSource;
196
196
  }
@@ -8,6 +8,7 @@
8
8
  * @flow
9
9
  */
10
10
 
11
+ import type {ViewStyleProp} from '../StyleSheet/StyleSheet';
11
12
  import type {IPerformanceLogger} from '../Utilities/createPerformanceLogger';
12
13
 
13
14
  import GlobalPerformanceLogger from '../Utilities/GlobalPerformanceLogger';
@@ -32,6 +33,7 @@ export default function renderApplication<Props: Object>(
32
33
  initialProps: Props,
33
34
  rootTag: any,
34
35
  WrapperComponent?: ?React.ComponentType<any>,
36
+ rootViewStyle?: ?ViewStyleProp,
35
37
  fabric?: boolean,
36
38
  showArchitectureIndicator?: boolean,
37
39
  scopedPerformanceLogger?: IPerformanceLogger,
@@ -52,6 +54,7 @@ export default function renderApplication<Props: Object>(
52
54
  fabric={fabric}
53
55
  showArchitectureIndicator={showArchitectureIndicator}
54
56
  WrapperComponent={WrapperComponent}
57
+ rootViewStyle={rootViewStyle}
55
58
  initialProps={initialProps ?? Object.freeze({})}
56
59
  internal_excludeLogBox={isLogBox}>
57
60
  <RootComponent {...initialProps} rootTag={rootTag} />