@office-iss/react-native-win32 0.0.0-canary.287 → 0.0.0-canary.289

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 (192) hide show
  1. package/.flowconfig +6 -2
  2. package/CHANGELOG.json +63 -1
  3. package/CHANGELOG.md +24 -4
  4. package/Libraries/Alert/Alert.d.ts +4 -1
  5. package/Libraries/Alert/Alert.js +3 -0
  6. package/Libraries/{Modal/ModalInjection.js → Alert/RCTAlertManager.js.flow} +7 -4
  7. package/Libraries/Animated/Animated.js +8 -37
  8. package/Libraries/Animated/Animated.js.flow +15 -0
  9. package/Libraries/Animated/AnimatedExports.js +47 -0
  10. package/Libraries/Animated/AnimatedExports.js.flow +48 -0
  11. package/Libraries/Animated/Easing.js +13 -15
  12. package/Libraries/Animated/createAnimatedComponent.js +24 -12
  13. package/Libraries/Animated/nodes/AnimatedNode.js +2 -1
  14. package/Libraries/Animated/nodes/AnimatedProps.js +18 -1
  15. package/Libraries/Animated/nodes/AnimatedValue.js +6 -2
  16. package/Libraries/Animated/useAnimatedValue.js +1 -3
  17. package/Libraries/Blob/URL.js +23 -10
  18. package/Libraries/Blob/URLSearchParams.js.flow +23 -0
  19. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
  20. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
  21. package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js.flow +20 -0
  22. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +8 -8
  23. package/Libraries/Components/Button.js +2 -2
  24. package/Libraries/Components/Button.win32.js +2 -2
  25. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +14 -100
  26. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +64 -4
  27. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +138 -0
  28. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -4
  29. package/Libraries/Components/LayoutConformance/LayoutConformance.js +6 -4
  30. package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +1 -1
  31. package/Libraries/Components/Pressable/Pressable.js +18 -63
  32. package/Libraries/Components/Pressable/Pressable.win32.js +19 -65
  33. package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
  34. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +4 -46
  35. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +10 -4
  36. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +54 -0
  37. package/Libraries/Components/RefreshControl/RefreshControl.js +10 -7
  38. package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +2 -1
  39. package/Libraries/Components/SafeAreaView/SafeAreaView.js +1 -1
  40. package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +1 -1
  41. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +2 -4
  42. package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +2 -4
  43. package/Libraries/Components/ScrollView/ScrollView.js +43 -59
  44. package/Libraries/Components/ScrollView/ScrollViewCommands.js +1 -1
  45. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +2 -4
  46. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +6 -7
  47. package/Libraries/Components/StatusBar/StatusBar.js +33 -22
  48. package/Libraries/Components/Switch/Switch.js +70 -41
  49. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +2 -4
  50. package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +2 -4
  51. package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +2 -4
  52. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
  53. package/Libraries/Components/TextInput/Tests/TextInputTest.d.ts +2 -1
  54. package/Libraries/Components/TextInput/Tests/TextInputTest.js.map +1 -1
  55. package/Libraries/Components/TextInput/TextInput.d.ts +6 -0
  56. package/Libraries/Components/TextInput/TextInput.flow.js +45 -14
  57. package/Libraries/Components/TextInput/TextInput.js +121 -136
  58. package/Libraries/Components/TextInput/TextInput.win32.js +122 -137
  59. package/Libraries/Components/TextInput/TextInputState.js +2 -18
  60. package/Libraries/Components/TextInput/TextInputState.win32.js +2 -18
  61. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +1 -1
  62. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.d.ts +2 -1
  63. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
  64. package/Libraries/Components/Touchable/Touchable.js +7 -7
  65. package/Libraries/Components/Touchable/Touchable.win32.js +7 -7
  66. package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
  67. package/Libraries/Components/Touchable/TouchableHighlight.js +35 -14
  68. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +95 -47
  69. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +248 -43
  70. package/Libraries/Components/Touchable/TouchableOpacity.js +52 -10
  71. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +112 -59
  72. package/Libraries/Components/View/View.js +1 -1
  73. package/Libraries/Components/View/View.win32.js +1 -1
  74. package/Libraries/Components/View/ViewNativeComponent.js +2 -4
  75. package/Libraries/Components/View/ViewPropTypes.js +15 -12
  76. package/Libraries/Components/View/ViewPropTypes.win32.js +74 -71
  77. package/Libraries/Core/ReactNativeVersion.js +2 -2
  78. package/Libraries/Core/setUpReactDevTools.js +2 -0
  79. package/Libraries/Debugging/DebuggingOverlayRegistry.js +10 -7
  80. package/Libraries/Image/Image.android.js +1 -1
  81. package/Libraries/Image/Image.js.flow +27 -0
  82. package/Libraries/Image/ImageBackground.js +1 -1
  83. package/Libraries/Image/ImageProps.js +97 -30
  84. package/Libraries/Image/ImageTypes.flow.js +16 -6
  85. package/Libraries/Image/ImageViewNativeComponent.js +3 -5
  86. package/Libraries/Image/Tests/ImageWin32Test.d.ts +2 -1
  87. package/Libraries/Image/Tests/ImageWin32Test.js.map +1 -1
  88. package/Libraries/Image/TextInlineImageNativeComponent.js +2 -4
  89. package/Libraries/Interaction/InteractionManager.js +9 -1
  90. package/Libraries/Interaction/PanResponder.js +11 -11
  91. package/Libraries/Interaction/TaskQueue.js +3 -2
  92. package/Libraries/Lists/FlatList.js +8 -7
  93. package/Libraries/LogBox/LogBox.js +1 -1
  94. package/Libraries/Modal/Modal.js +30 -4
  95. package/Libraries/NativeComponent/BaseViewConfig.js.flow +14 -0
  96. package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
  97. package/Libraries/Network/RCTNetworking.js.flow +44 -0
  98. package/Libraries/Network/XMLHttpRequest_new.js +3 -0
  99. package/Libraries/Network/XMLHttpRequest_old.js +3 -0
  100. package/Libraries/Pressability/HoverState.js +1 -0
  101. package/Libraries/Pressability/HoverState.win32.js +1 -0
  102. package/Libraries/Pressability/Pressability.js +2 -2
  103. package/Libraries/Pressability/Pressability.win32.js +3 -3
  104. package/Libraries/ReactNative/AppRegistry.flow.js +49 -0
  105. package/Libraries/ReactNative/AppRegistry.js +2 -322
  106. package/Libraries/ReactNative/AppRegistry.js.flow +23 -0
  107. package/Libraries/ReactNative/AppRegistryImpl.js +316 -0
  108. package/Libraries/ReactNative/FabricUIManager.js +5 -3
  109. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +7 -5
  110. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -4
  111. package/Libraries/ReactNative/RendererImplementation.js +3 -5
  112. package/Libraries/ReactNative/requireNativeComponent.js +1 -1
  113. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +12 -0
  114. package/Libraries/Renderer/shims/ReactNativeTypes.js +39 -91
  115. package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +22 -0
  116. package/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +6 -0
  117. package/Libraries/StyleSheet/StyleSheet.js +5 -197
  118. package/Libraries/StyleSheet/StyleSheet.js.flow +166 -0
  119. package/Libraries/StyleSheet/{StyleSheet.win32.js → StyleSheetExports.js} +2 -151
  120. package/Libraries/StyleSheet/StyleSheetExports.js.flow +110 -0
  121. package/Libraries/StyleSheet/StyleSheetTypes.js +42 -18
  122. package/Libraries/Text/Text.d.ts +1 -1
  123. package/Libraries/Text/Text.js +3 -1
  124. package/Libraries/Text/Text.win32.js +3 -1
  125. package/Libraries/Text/TextNativeComponent.js +1 -1
  126. package/Libraries/Text/TextNativeComponent.win32.js +1 -1
  127. package/Libraries/Text/TextProps.js +124 -84
  128. package/Libraries/Text/TextProps.win32.js +124 -84
  129. package/Libraries/Types/CodegenTypesNamespace.d.ts +45 -0
  130. package/Libraries/Types/CodegenTypesNamespace.js +14 -0
  131. package/Libraries/Types/CoreEventTypes.js +1 -1
  132. package/Libraries/Types/CoreEventTypes.win32.js +1 -1
  133. package/Libraries/Types/ReactDevToolsTypes.js +4 -8
  134. package/Libraries/Utilities/BackHandler.js.flow +25 -0
  135. package/Libraries/Utilities/DevSettings.js +14 -0
  136. package/Libraries/Utilities/Dimensions.js +5 -0
  137. package/Libraries/Utilities/Dimensions.win32.js +5 -0
  138. package/{flow/Position.js → Libraries/Utilities/Platform.js.flow} +3 -6
  139. package/Libraries/Utilities/PlatformTypes.js +97 -7
  140. package/Libraries/Utilities/codegenNativeCommands.d.ts +18 -0
  141. package/Libraries/Utilities/codegenNativeComponent.d.ts +26 -0
  142. package/Libraries/Utilities/codegenNativeComponent.js +1 -1
  143. package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +2 -4
  144. package/Libraries/vendor/emitter/EventEmitter.js +6 -2
  145. package/flow/global.js +1 -0
  146. package/flow/jest.js +4 -2
  147. package/index.js +47 -43
  148. package/index.win32.js +63 -59
  149. package/overrides.json +27 -35
  150. package/package.json +18 -18
  151. package/src/private/animated/NativeAnimatedHelper.js +18 -7
  152. package/src/private/animated/NativeAnimatedHelper.win32.js +18 -7
  153. package/src/private/animated/createAnimatedPropsHook.js +34 -15
  154. package/src/private/components/HScrollViewNativeComponents.js +1 -1
  155. package/src/private/components/VScrollViewNativeComponents.js +1 -1
  156. package/src/private/featureflags/ReactNativeFeatureFlags.js +24 -36
  157. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +9 -1
  158. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +4 -4
  159. package/src/private/inspector/getInspectorDataForViewAtPoint.js +2 -4
  160. package/src/private/setup/setUpDOM.js +36 -1
  161. package/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js +1 -1
  162. package/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js +1 -1
  163. package/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -1
  164. package/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js +1 -1
  165. package/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js +1 -1
  166. package/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js +1 -1
  167. package/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js +1 -1
  168. package/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js +1 -1
  169. package/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js +1 -1
  170. package/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +1 -1
  171. package/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js +1 -1
  172. package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -1
  173. package/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js +1 -1
  174. package/src/private/types/HostComponent.js +16 -0
  175. package/src/private/types/HostInstance.js +50 -0
  176. package/src/private/webapis/dom/nodes/ReactNativeDocument.js +1 -0
  177. package/src/private/webapis/dom/nodes/ReactNativeElement.js +40 -32
  178. package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +1 -1
  179. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +1 -1
  180. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +6 -19
  181. package/src/private/webapis/dom/nodes/internals/NodeInternals.js +6 -0
  182. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +4 -4
  183. package/src/private/webapis/mutationobserver/MutationObserver.js +9 -9
  184. package/src/private/webapis/performance/PerformanceObserver.js +6 -6
  185. package/src/types/globals.d.ts +628 -0
  186. package/src/types/third_party/event-target-shim.d.ts +392 -0
  187. package/src-win/Libraries/Components/TextInput/Tests/TextInputTest.tsx +7 -7
  188. package/src-win/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +3 -3
  189. package/src-win/Libraries/Image/Tests/ImageWin32Test.tsx +1 -1
  190. package/src-win/Libraries/Text/Text.d.ts +1 -1
  191. package/types/index.d.ts +5 -52
  192. package/types/modules/globals.d.ts +0 -599
@@ -322,7 +322,7 @@ export type ViewPropsAndroid = $ReadOnly<{
322
322
  *
323
323
  * @platform android
324
324
  */
325
- focusable?: boolean,
325
+ focusable?: ?boolean,
326
326
 
327
327
  /**
328
328
  * Indicates whether this `View` should be focusable with a non-touch input device, eg. receive focus with a hardware keyboard.
@@ -356,17 +356,7 @@ export type ViewPropsIOS = $ReadOnly<{
356
356
  shouldRasterizeIOS?: ?boolean,
357
357
  }>;
358
358
 
359
- export type ViewProps = $ReadOnly<{
360
- ...DirectEventProps,
361
- ...GestureResponderHandlers,
362
- ...MouseEventProps,
363
- ...PointerEventProps,
364
- ...FocusEventProps,
365
- ...TouchEventProps,
366
- ...ViewPropsAndroid,
367
- ...ViewPropsIOS,
368
- ...AccessibilityProps,
369
-
359
+ type ViewBaseProps = $ReadOnly<{
370
360
  children?: Node,
371
361
  style?: ?ViewStyleProp,
372
362
 
@@ -454,3 +444,16 @@ export type ViewProps = $ReadOnly<{
454
444
  */
455
445
  removeClippedSubviews?: ?boolean,
456
446
  }>;
447
+
448
+ export type ViewProps = $ReadOnly<{
449
+ ...DirectEventProps,
450
+ ...GestureResponderHandlers,
451
+ ...MouseEventProps,
452
+ ...PointerEventProps,
453
+ ...FocusEventProps,
454
+ ...TouchEventProps,
455
+ ...ViewPropsAndroid,
456
+ ...ViewPropsIOS,
457
+ ...AccessibilityProps,
458
+ ...ViewBaseProps,
459
+ }>;
@@ -323,7 +323,7 @@ export type ViewPropsAndroid = $ReadOnly<{
323
323
  *
324
324
  * @platform android
325
325
  */
326
- focusable?: boolean,
326
+ focusable?: ?boolean,
327
327
 
328
328
  /**
329
329
  * Indicates whether this `View` should be focusable with a non-touch input device, eg. receive focus with a hardware keyboard.
@@ -357,76 +357,7 @@ export type ViewPropsIOS = $ReadOnly<{
357
357
  shouldRasterizeIOS?: ?boolean,
358
358
  }>;
359
359
 
360
- // [Windows
361
-
362
- export type HandledKeyboardEvent = $ReadOnly<{|
363
- altKey?: ?boolean,
364
- ctrlKey?: ?boolean,
365
- metaKey?: ?boolean,
366
- shiftKey?: ?boolean,
367
- code: string,
368
- handledEventPhase?: number,
369
- |}>;
370
-
371
- type ViewPropsWindows = $ReadOnly<{|
372
- /**
373
- * Key up event
374
- *
375
- * @platform windows
376
- */
377
- onKeyUp?: ?(e: KeyEvent) => void,
378
- onKeyUpCapture?: ?(e: KeyEvent) => void,
379
- keyUpEvents?: ?$ReadOnlyArray<HandledKeyboardEvent>,
380
-
381
- onKeyDown?: ?(e: KeyEvent) => void,
382
- onKeyDownCapture?: ?(e: KeyEvent) => void,
383
- keyDownEvents?: ?$ReadOnlyArray<HandledKeyboardEvent>,
384
- /**
385
- * Specifies the Tooltip for the view
386
- * @platform windows
387
- */
388
- tooltip?: ?string,
389
-
390
- tabIndex?: ?number,
391
-
392
- accessibilitySetSize?: ?number,
393
- accessibilityControls?: ?Stringish,
394
- accessibilityDescribedBy?: ?Stringish,
395
- accessibilityDescription?: ?Stringish,
396
- accessibilityLevel?: ?number,
397
- accessibilityPositionInSet?: ?number,
398
- 'aria-posinset'?: ?number,
399
- 'aria-setsize'?: ?number,
400
- 'aria-description'?: ?Stringish,
401
- 'aria-level'?: ?number,
402
- 'aria-controls'?: ?Stringish,
403
- 'aria-describedby'?: ?Stringish,
404
- 'aria-multiselectable'?: ?boolean,
405
- 'aria-required'?: ?boolean,
406
-
407
- /**
408
- * Specifies if the control should show System focus visuals
409
- */
410
- enableFocusRing?: ?boolean,
411
-
412
- onFocus?: ?(event: FocusEvent) => mixed,
413
- onBlur?: ?(event: FocusEvent) => mixed,
414
- onMouseLeave?: ?(event: MouseEvent) => mixed,
415
- onMouseEnter?: ?(event: MouseEvent) => mixed,
416
- |}>;
417
- // Windows]
418
-
419
- export type ViewProps = $ReadOnly<{
420
- ...DirectEventProps,
421
- ...GestureResponderHandlers,
422
- ...MouseEventProps,
423
- ...PointerEventProps,
424
- ...FocusEventProps,
425
- ...TouchEventProps,
426
- ...ViewPropsAndroid,
427
- ...ViewPropsIOS,
428
- ...AccessibilityProps,
429
- ...ViewPropsWindows, // [Windows]
360
+ type ViewBaseProps = $ReadOnly<{
430
361
  children?: Node,
431
362
  style?: ?ViewStyleProp,
432
363
 
@@ -537,3 +468,75 @@ export type ViewProps = $ReadOnly<{
537
468
  */
538
469
  accessibilityControls?: ?string,
539
470
  }>;
471
+
472
+ // [Windows
473
+ export type HandledKeyboardEvent = $ReadOnly<{|
474
+ altKey?: ?boolean,
475
+ ctrlKey?: ?boolean,
476
+ metaKey?: ?boolean,
477
+ shiftKey?: ?boolean,
478
+ code: string,
479
+ handledEventPhase?: number,
480
+ |}>;
481
+
482
+ type ViewPropsWindows = $ReadOnly<{|
483
+ /**
484
+ * Key up event
485
+ *
486
+ * @platform windows
487
+ */
488
+ onKeyUp?: ?(e: KeyEvent) => void,
489
+ onKeyUpCapture?: ?(e: KeyEvent) => void,
490
+ keyUpEvents?: ?$ReadOnlyArray<HandledKeyboardEvent>,
491
+
492
+ onKeyDown?: ?(e: KeyEvent) => void,
493
+ onKeyDownCapture?: ?(e: KeyEvent) => void,
494
+ keyDownEvents?: ?$ReadOnlyArray<HandledKeyboardEvent>,
495
+ /**
496
+ * Specifies the Tooltip for the view
497
+ * @platform windows
498
+ */
499
+ tooltip?: ?string,
500
+
501
+ tabIndex?: ?number,
502
+
503
+ accessibilitySetSize?: ?number,
504
+ accessibilityControls?: ?Stringish,
505
+ accessibilityDescribedBy?: ?Stringish,
506
+ accessibilityDescription?: ?Stringish,
507
+ accessibilityLevel?: ?number,
508
+ accessibilityPositionInSet?: ?number,
509
+ 'aria-posinset'?: ?number,
510
+ 'aria-setsize'?: ?number,
511
+ 'aria-description'?: ?Stringish,
512
+ 'aria-level'?: ?number,
513
+ 'aria-controls'?: ?Stringish,
514
+ 'aria-describedby'?: ?Stringish,
515
+ 'aria-multiselectable'?: ?boolean,
516
+ 'aria-required'?: ?boolean,
517
+
518
+ /**
519
+ * Specifies if the control should show System focus visuals
520
+ */
521
+ enableFocusRing?: ?boolean,
522
+
523
+ onFocus?: ?(event: FocusEvent) => mixed,
524
+ onBlur?: ?(event: FocusEvent) => mixed,
525
+ onMouseLeave?: ?(event: MouseEvent) => mixed,
526
+ onMouseEnter?: ?(event: MouseEvent) => mixed,
527
+ |}>;
528
+ // Windows]
529
+
530
+ export type ViewProps = $ReadOnly<{
531
+ ...DirectEventProps,
532
+ ...GestureResponderHandlers,
533
+ ...MouseEventProps,
534
+ ...PointerEventProps,
535
+ ...FocusEventProps,
536
+ ...TouchEventProps,
537
+ ...ViewPropsAndroid,
538
+ ...ViewPropsIOS,
539
+ ...AccessibilityProps,
540
+ ...ViewBaseProps,
541
+ ...ViewPropsWindows, // [Windows]
542
+ }>;
@@ -15,7 +15,7 @@ export const version: $ReadOnly<{
15
15
  prerelease: string | null,
16
16
  }> = {
17
17
  major: 0,
18
- minor: 79,
18
+ minor: 80,
19
19
  patch: 0,
20
- prerelease: 'nightly-20250220-41b597c73',
20
+ prerelease: 'nightly-20250317-fc7385c1e',
21
21
  };
@@ -152,6 +152,8 @@ if (__DEV__) {
152
152
  // Read the optional global variable for backward compatibility.
153
153
  // It was added in https://github.com/facebook/react-native/commit/bf2b435322e89d0aeee8792b1c6e04656c2719a0.
154
154
  const port =
155
+ // $FlowFixMe[prop-missing]
156
+ // $FlowFixMe[incompatible-use]
155
157
  window.__REACT_DEVTOOLS_PORT__ != null
156
158
  ? window.__REACT_DEVTOOLS_PORT__
157
159
  : 8097;
@@ -9,13 +9,13 @@
9
9
  * @oncall react_native
10
10
  */
11
11
 
12
+ import type {HostInstance} from '../../src/private/types/HostInstance';
12
13
  import type ReactNativeElement from '../../src/private/webapis/dom/nodes/ReactNativeElement';
13
14
  import type ReadOnlyElement from '../../src/private/webapis/dom/nodes/ReadOnlyElement';
14
15
  import type {
15
16
  AppContainerRootViewRef,
16
17
  DebuggingOverlayRef,
17
18
  } from '../ReactNative/AppContainer-dev';
18
- import type {NativeMethods} from '../Renderer/shims/ReactNativeTypes';
19
19
  import type {
20
20
  InstanceFromReactDevTools,
21
21
  ReactDevToolsAgent,
@@ -51,7 +51,7 @@ type ModernNodeUpdate = {
51
51
 
52
52
  type LegacyNodeUpdate = {
53
53
  id: number,
54
- instance: NativeMethods,
54
+ instance: HostInstance,
55
55
  color: string,
56
56
  };
57
57
 
@@ -95,9 +95,11 @@ class DebuggingOverlayRegistry {
95
95
 
96
96
  #getPublicInstanceFromInstance = (
97
97
  instanceHandle: InstanceFromReactDevTools,
98
- ): NativeMethods | null => {
98
+ ): HostInstance | null => {
99
99
  // `canonical.publicInstance` => Fabric
100
+ // $FlowExpectedError[prop-missing]
100
101
  if (instanceHandle.canonical?.publicInstance != null) {
102
+ // $FlowExpectedError[incompatible-return]
101
103
  return instanceHandle.canonical?.publicInstance;
102
104
  }
103
105
 
@@ -108,6 +110,7 @@ class DebuggingOverlayRegistry {
108
110
  }
109
111
 
110
112
  // `instanceHandle` => Legacy renderer
113
+ // $FlowExpectedError[method-unbinding]
111
114
  if (instanceHandle.measure != null) {
112
115
  // $FlowFixMe[incompatible-return]
113
116
  return instanceHandle;
@@ -134,7 +137,7 @@ class DebuggingOverlayRegistry {
134
137
  }
135
138
 
136
139
  #findLowestParentFromRegistryForInstanceLegacy(
137
- instance: NativeMethods,
140
+ instance: HostInstance,
138
141
  ): ?DebuggingOverlayRegistrySubscriberProtocol {
139
142
  const candidates: Array<DebuggingOverlayRegistrySubscriberProtocol> = [];
140
143
 
@@ -374,7 +377,7 @@ class DebuggingOverlayRegistry {
374
377
  require('../../src/private/webapis/dom/nodes/ReactNativeElement').default;
375
378
 
376
379
  const reactNativeElements: Array<ReactNativeElement> = [];
377
- const legacyPublicInstances: Array<NativeMethods> = [];
380
+ const legacyPublicInstances: Array<HostInstance> = [];
378
381
 
379
382
  for (const node of nodes) {
380
383
  const publicInstance = this.#getPublicInstanceFromInstance(node);
@@ -442,10 +445,10 @@ class DebuggingOverlayRegistry {
442
445
  }
443
446
 
444
447
  // TODO: remove once DOM Node APIs are opt-in by default and Paper is no longer supported.
445
- #onHighlightElementsLegacy(elements: Array<NativeMethods>): void {
448
+ #onHighlightElementsLegacy(elements: Array<HostInstance>): void {
446
449
  const parentToElementsMap = new Map<
447
450
  DebuggingOverlayRegistrySubscriberProtocol,
448
- Array<NativeMethods>,
451
+ Array<HostInstance>,
449
452
  >();
450
453
 
451
454
  for (const element of elements) {
@@ -138,7 +138,7 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
138
138
  props.loadingIndicatorSource,
139
139
  );
140
140
 
141
- if (props.children) {
141
+ if (props.children != null) {
142
142
  throw new Error(
143
143
  'The <Image> component cannot contain children. If you want to render content on top of the image, consider using the <ImageBackground> component or absolute positioning.',
144
144
  );
@@ -0,0 +1,27 @@
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
+ */
10
+
11
+ import type {Image} from './ImageTypes.flow';
12
+
13
+ export type {
14
+ ImageProgressEventDataIOS,
15
+ ImagePropsIOS,
16
+ ImagePropsAndroid,
17
+ ImageSourcePropType,
18
+ ImageLoadEventData,
19
+ ImageErrorEventData,
20
+ ImagePropsBase,
21
+ ImageProps,
22
+ ImageBackgroundProps,
23
+ } from './ImageProps';
24
+
25
+ export type {ImageResolvedAssetSource, ImageSize} from './ImageTypes.flow';
26
+
27
+ declare export default Image;
@@ -8,7 +8,7 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import type {HostInstance} from '../Renderer/shims/ReactNativeTypes';
11
+ import type {HostInstance} from '../../src/private/types/HostInstance';
12
12
  import type {ImageBackgroundProps} from './ImageProps';
13
13
 
14
14
  import View from '../Components/View/View';
@@ -23,20 +23,36 @@ import type {
23
23
  } from '../Types/CoreEventTypes';
24
24
  import typeof Image from './Image';
25
25
  import type {ImageResizeMode} from './ImageResizeMode';
26
- import type {ImageSource} from './ImageSource';
26
+ import type {ImageSource, ImageURISource} from './ImageSource';
27
27
  import type {ElementRef, Node, RefSetter} from 'react';
28
28
 
29
+ export type ImageSourcePropType = ImageSource;
30
+
31
+ /**
32
+ * @see ImagePropsIOS.onProgress
33
+ */
34
+ export type ImageProgressEventDataIOS = {
35
+ loaded: number,
36
+ total: number,
37
+ };
38
+
39
+ export type ImageErrorEventData = {
40
+ error: string,
41
+ };
42
+
43
+ export type ImageLoadEventData = {
44
+ source: {
45
+ height: number,
46
+ width: number,
47
+ uri: string,
48
+ },
49
+ };
50
+
29
51
  export type ImageLoadEvent = NativeSyntheticEvent<
30
- $ReadOnly<{
31
- source: $ReadOnly<{
32
- width: number,
33
- height: number,
34
- uri: string,
35
- }>,
36
- }>,
52
+ $ReadOnly<ImageLoadEventData>,
37
53
  >;
38
54
 
39
- type IOSImageProps = $ReadOnly<{
55
+ export type ImagePropsIOS = $ReadOnly<{
40
56
  /**
41
57
  * A static image to display while loading the image source.
42
58
  *
@@ -55,19 +71,42 @@ type IOSImageProps = $ReadOnly<{
55
71
  * See https://reactnative.dev/docs/image#onprogress
56
72
  */
57
73
  onProgress?: ?(
58
- event: NativeSyntheticEvent<$ReadOnly<{loaded: number, total: number}>>,
74
+ event: NativeSyntheticEvent<$ReadOnly<ImageProgressEventDataIOS>>,
59
75
  ) => void,
60
76
  }>;
61
77
 
62
- type AndroidImageProps = $ReadOnly<{
63
- loadingIndicatorSource?: ?(number | $ReadOnly<{uri: string}>),
78
+ export type ImagePropsAndroid = $ReadOnly<{
79
+ /**
80
+ * similarly to `source`, this property represents the resource used to render
81
+ * the loading indicator for the image, displayed until image is ready to be
82
+ * displayed, typically after when it got downloaded from network.
83
+ */
84
+ loadingIndicatorSource?: ?(number | $ReadOnly<ImageURISource>),
64
85
  progressiveRenderingEnabled?: ?boolean,
65
86
  fadeDuration?: ?number,
66
87
 
67
88
  /**
68
- * The mechanism that should be used to resize the image when the image's
69
- * dimensions differ from the image view's dimensions. Defaults to `'auto'`.
70
- * See https://reactnative.dev/docs/image#resizemethod-android
89
+ * The mechanism that should be used to resize the image when the image's dimensions
90
+ * differ from the image view's dimensions. Defaults to `auto`.
91
+ *
92
+ * - `auto`: Use heuristics to pick between `resize` and `scale`.
93
+ *
94
+ * - `resize`: A software operation which changes the encoded image in memory before it
95
+ * gets decoded. This should be used instead of `scale` when the image is much larger
96
+ * than the view.
97
+ *
98
+ * - `scale`: The image gets drawn downscaled or upscaled. Compared to `resize`, `scale` is
99
+ * faster (usually hardware accelerated) and produces higher quality images. This
100
+ * should be used if the image is smaller than the view. It should also be used if the
101
+ * image is slightly bigger than the view.
102
+ *
103
+ * - `none`: No sampling is performed and the image is displayed in its full resolution. This
104
+ * should only be used in rare circumstances because it is considered unsafe as Android will
105
+ * throw a runtime exception when trying to render images that consume too much memory.
106
+ *
107
+ * More details about `resize` and `scale` can be found at http://frescolib.org/docs/resizing-rotating.html.
108
+ *
109
+ * @platform android
71
110
  */
72
111
  resizeMethod?: ?('auto' | 'resize' | 'scale' | 'none'),
73
112
 
@@ -81,11 +120,8 @@ type AndroidImageProps = $ReadOnly<{
81
120
  resizeMultiplier?: ?number,
82
121
  }>;
83
122
 
84
- export type ImageProps = $ReadOnly<{
123
+ export type ImagePropsBase = $ReadOnly<{
85
124
  ...$Diff<ViewProps, $ReadOnly<{style: ?ViewStyleProp}>>,
86
- ...IOSImageProps,
87
- ...AndroidImageProps,
88
-
89
125
  /**
90
126
  * When true, indicates the image is an accessibility element.
91
127
  *
@@ -166,16 +202,15 @@ export type ImageProps = $ReadOnly<{
166
202
  * See https://reactnative.dev/docs/image#onerror
167
203
  */
168
204
  onError?: ?(
169
- event: NativeSyntheticEvent<
170
- $ReadOnly<{
171
- error: string,
172
- }>,
173
- >,
205
+ event: NativeSyntheticEvent<$ReadOnly<ImageErrorEventData>>,
174
206
  ) => void,
175
207
 
176
208
  /**
209
+ * onLayout function
210
+ *
177
211
  * Invoked on mount and layout changes with
178
- * `{nativeEvent: {layout: {x, y, width, height}}}`.
212
+ *
213
+ * {nativeEvent: { layout: {x, y, width, height} }}.
179
214
  *
180
215
  * See https://reactnative.dev/docs/image#onlayout
181
216
  */
@@ -206,15 +241,16 @@ export type ImageProps = $ReadOnly<{
206
241
  /**
207
242
  * The image source (either a remote URL or a local file resource).
208
243
  *
244
+ * This prop can also contain several remote URLs, specified together with their width and height and potentially with scale/other URI arguments.
245
+ * The native side will then choose the best uri to display based on the measured size of the image container.
246
+ * A cache property can be added to control how networked request interacts with the local cache.
247
+ *
248
+ * The currently supported formats are png, jpg, jpeg, bmp, gif, webp (Android only), psd (iOS only).
249
+ *
209
250
  * See https://reactnative.dev/docs/image#source
210
251
  */
211
252
  source?: ?ImageSource,
212
253
 
213
- /**
214
- * See https://reactnative.dev/docs/image#style
215
- */
216
- style?: ?ImageStyleProp,
217
-
218
254
  /**
219
255
  * A string indicating which referrer to use when fetching the resource.
220
256
  * Similar to referrerpolicy from HTML.
@@ -236,6 +272,26 @@ export type ImageProps = $ReadOnly<{
236
272
  * Determines how to resize the image when the frame doesn't match the raw
237
273
  * image dimensions.
238
274
  *
275
+ * 'cover': Scale the image uniformly (maintain the image's aspect ratio)
276
+ * so that both dimensions (width and height) of the image will be equal
277
+ * to or larger than the corresponding dimension of the view (minus padding).
278
+ *
279
+ * 'contain': Scale the image uniformly (maintain the image's aspect ratio)
280
+ * so that both dimensions (width and height) of the image will be equal to
281
+ * or less than the corresponding dimension of the view (minus padding).
282
+ *
283
+ * 'stretch': Scale width and height independently, This may change the
284
+ * aspect ratio of the src.
285
+ *
286
+ * 'repeat': Repeat the image to cover the frame of the view.
287
+ * The image will keep it's size and aspect ratio. (iOS only)
288
+ *
289
+ * 'center': Scale the image down so that it is completely visible,
290
+ * if bigger than the area of the view.
291
+ * The image will not be scaled up.
292
+ *
293
+ * 'none': Do not resize the image. The image will be displayed at its intrinsic size.
294
+ *
239
295
  * See https://reactnative.dev/docs/image#resizemode
240
296
  */
241
297
  resizeMode?: ?ImageResizeMode,
@@ -272,6 +328,17 @@ export type ImageProps = $ReadOnly<{
272
328
  children?: empty,
273
329
  }>;
274
330
 
331
+ export type ImageProps = $ReadOnly<{
332
+ ...ImagePropsIOS,
333
+ ...ImagePropsAndroid,
334
+ ...ImagePropsBase,
335
+
336
+ /**
337
+ * See https://reactnative.dev/docs/image#style
338
+ */
339
+ style?: ?ImageStyleProp,
340
+ }>;
341
+
275
342
  export type ImageBackgroundProps = $ReadOnly<{
276
343
  ...ImageProps,
277
344
  children?: Node,
@@ -17,8 +17,15 @@ import typeof TextInlineImageNativeComponent from './TextInlineImageNativeCompon
17
17
 
18
18
  import * as React from 'react';
19
19
 
20
+ export type ImageSize = {
21
+ width: number,
22
+ height: number,
23
+ };
24
+
25
+ export type ImageResolvedAssetSource = ResolvedAssetSource;
26
+
20
27
  type ImageComponentStaticsIOS = $ReadOnly<{
21
- getSize(uri: string): Promise<{width: number, height: number}>,
28
+ getSize(uri: string): Promise<ImageSize>,
22
29
  getSize(
23
30
  uri: string,
24
31
  success: (width: number, height: number) => void,
@@ -28,7 +35,7 @@ type ImageComponentStaticsIOS = $ReadOnly<{
28
35
  getSizeWithHeaders(
29
36
  uri: string,
30
37
  headers: {[string]: string, ...},
31
- ): Promise<{width: number, height: number}>,
38
+ ): Promise<ImageSize>,
32
39
  getSizeWithHeaders(
33
40
  uri: string,
34
41
  headers: {[string]: string, ...},
@@ -46,9 +53,12 @@ type ImageComponentStaticsIOS = $ReadOnly<{
46
53
 
47
54
  queryCache(
48
55
  urls: Array<string>,
49
- ): Promise<{[string]: 'memory' | 'disk' | 'disk/memory', ...}>,
56
+ ): Promise<{[url: string]: 'memory' | 'disk' | 'disk/memory', ...}>,
50
57
 
51
- resolveAssetSource(source: ImageSource): ?ResolvedAssetSource,
58
+ /**
59
+ * @see https://reactnative.dev/docs/image#resolveassetsource
60
+ */
61
+ resolveAssetSource(source: ImageSource): ?ImageResolvedAssetSource,
52
62
  }>;
53
63
 
54
64
  type ImageComponentStaticsAndroid = $ReadOnly<{
@@ -57,7 +67,7 @@ type ImageComponentStaticsAndroid = $ReadOnly<{
57
67
  }>;
58
68
 
59
69
  export type AbstractImageAndroid = component(
60
- ref: React.RefSetter<
70
+ ref?: React.RefSetter<
61
71
  | React.ElementRef<TextInlineImageNativeComponent>
62
72
  | React.ElementRef<ImageViewNativeComponent>,
63
73
  >,
@@ -67,7 +77,7 @@ export type AbstractImageAndroid = component(
67
77
  export type ImageAndroid = AbstractImageAndroid & ImageComponentStaticsAndroid;
68
78
 
69
79
  export type AbstractImageIOS = component(
70
- ref: React.RefSetter<React.ElementRef<ImageViewNativeComponent>>,
80
+ ref?: React.RefSetter<React.ElementRef<ImageViewNativeComponent>>,
71
81
  ...props: ImagePropsType
72
82
  );
73
83
 
@@ -8,12 +8,10 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ import type {HostComponent} from '../../src/private/types/HostComponent';
12
+ import type {HostInstance} from '../../src/private/types/HostInstance';
11
13
  import type {ViewProps} from '../Components/View/ViewPropTypes';
12
- import type {
13
- HostComponent,
14
- HostInstance,
15
- PartialViewConfig,
16
- } from '../Renderer/shims/ReactNativeTypes';
14
+ import type {PartialViewConfig} from '../Renderer/shims/ReactNativeTypes';
17
15
  import type {
18
16
  ColorValue,
19
17
  DangerouslyImpreciseStyle,
@@ -1,8 +1,9 @@
1
+ import React from 'react';
1
2
  export declare const title = "ImageWin32Test";
2
3
  export declare const displayName = "Image Win32 test";
3
4
  export declare const description = "Image Win32 test";
4
5
  export declare const examples: {
5
6
  title: string;
6
7
  description: string;
7
- render(): JSX.Element;
8
+ render(): React.JSX.Element;
8
9
  }[];
@@ -1 +1 @@
1
- {"version":3,"file":"ImageWin32Test.js","sourceRoot":"","sources":["../../../src-win/Libraries/Image/Tests/ImageWin32Test.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,+CAAqC;AAErC,MAAM,SAAS,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC,QAAA,KAAK,GAAG,gBAAgB,CAAC;AACzB,QAAA,WAAW,GAAG,kBAAkB,CAAC;AACjC,QAAA,WAAW,GAAG,kBAAkB,CAAC;AACjC,QAAA,QAAQ,GAAG;IACpB;QACE,KAAK,EAAE,0BAA0B;QACjC,WAAW,EAAE,YAAY;QACzB,MAAM;YACJ,OAAO,CACL,8BAAC,oBAAK,IACJ,KAAK,EAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,EACnC,MAAM,EAAG,SAAS,GAClB,CACH,CAAC;QACJ,CAAC;KACF;CACF,CAAC","sourcesContent":["import React from 'react'\nimport { Image } from 'react-native';\n\nconst testImage = require('./img/dpitest.png');\n\nexport const title = 'ImageWin32Test';\nexport const displayName = 'Image Win32 test';\nexport const description = 'Image Win32 test';\nexport const examples = [\n {\n title: 'Win32 Image control test',\n description: 'Test Image',\n render(): JSX.Element {\n return (\n <Image\n style={ { width: 100, height: 100 } }\n source={ testImage }\n />\n );\n },\n },\n ];\n"]}
1
+ {"version":3,"file":"ImageWin32Test.js","sourceRoot":"","sources":["../../../src-win/Libraries/Image/Tests/ImageWin32Test.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,+CAAqC;AAErC,MAAM,SAAS,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC,QAAA,KAAK,GAAG,gBAAgB,CAAC;AACzB,QAAA,WAAW,GAAG,kBAAkB,CAAC;AACjC,QAAA,WAAW,GAAG,kBAAkB,CAAC;AACjC,QAAA,QAAQ,GAAG;IACpB;QACE,KAAK,EAAE,0BAA0B;QACjC,WAAW,EAAE,YAAY;QACzB,MAAM;YACJ,OAAO,CACL,8BAAC,oBAAK,IACJ,KAAK,EAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,EACnC,MAAM,EAAG,SAAS,GAClB,CACH,CAAC;QACJ,CAAC;KACF;CACF,CAAC","sourcesContent":["import React from 'react'\nimport { Image } from 'react-native';\n\nconst testImage = require('./img/dpitest.png');\n\nexport const title = 'ImageWin32Test';\nexport const displayName = 'Image Win32 test';\nexport const description = 'Image Win32 test';\nexport const examples = [\n {\n title: 'Win32 Image control test',\n description: 'Test Image',\n render() {\n return (\n <Image\n style={ { width: 100, height: 100 } }\n source={ testImage }\n />\n );\n },\n },\n ];\n"]}
@@ -10,11 +10,9 @@
10
10
 
11
11
  'use strict';
12
12
 
13
+ import type {HostComponent} from '../../src/private/types/HostComponent';
13
14
  import type {ViewProps} from '../Components/View/ViewPropTypes';
14
- import type {
15
- HostComponent,
16
- PartialViewConfig,
17
- } from '../Renderer/shims/ReactNativeTypes';
15
+ import type {PartialViewConfig} from '../Renderer/shims/ReactNativeTypes';
18
16
  import type {ColorValue} from '../StyleSheet/StyleSheet';
19
17
  import type {ImageResizeMode} from './ImageResizeMode';
20
18
 
@@ -12,12 +12,15 @@ import type {Task} from './TaskQueue';
12
12
 
13
13
  import * as ReactNativeFeatureFlags from '../../src/private/featureflags/ReactNativeFeatureFlags';
14
14
  import EventEmitter from '../vendor/emitter/EventEmitter';
15
+ import type {EventSubscription} from '../vendor/emitter/EventEmitter';
15
16
 
16
17
  const BatchedBridge = require('../BatchedBridge/BatchedBridge').default;
17
18
  const infoLog = require('../Utilities/infoLog').default;
18
19
  const TaskQueue = require('./TaskQueue').default;
19
20
  const invariant = require('invariant');
20
21
 
22
+ export type {Task, SimpleTask, PromiseTask} from './TaskQueue';
23
+
21
24
  export type Handle = number;
22
25
 
23
26
  const _emitter = new EventEmitter<{
@@ -140,7 +143,12 @@ const InteractionManagerImpl = {
140
143
 
141
144
  // $FlowFixMe[unclear-type] unclear type of _emitter
142
145
  // $FlowFixMe[method-unbinding] added when improving typing for this parameters
143
- addListener: _emitter.addListener.bind(_emitter) as Function,
146
+ addListener: _emitter.addListener.bind(_emitter) as (
147
+ eventType: string,
148
+ // $FlowFixMe[unclear-type] unclear type of arguments
149
+ listener: (...args: any) => mixed,
150
+ context: mixed,
151
+ ) => EventSubscription,
144
152
 
145
153
  /**
146
154
  * A positive number will use setTimeout to schedule any tasks after the