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

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 (112) hide show
  1. package/.flowconfig +1 -2
  2. package/CHANGELOG.json +16 -1
  3. package/CHANGELOG.md +13 -5
  4. package/Libraries/Animated/Animated.js.flow +1 -3
  5. package/Libraries/Animated/AnimatedExports.js.flow +12 -0
  6. package/Libraries/Animated/components/AnimatedScrollView.js +2 -1
  7. package/Libraries/Animated/components/AnimatedSectionList.js +1 -1
  8. package/Libraries/Animated/createAnimatedComponent.js +92 -56
  9. package/Libraries/Animated/nodes/AnimatedProps.js +29 -26
  10. package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
  11. package/Libraries/AppState/AppState.js +1 -1
  12. package/Libraries/Blob/URL.js +1 -1
  13. package/Libraries/Blob/URLSearchParams.js +106 -31
  14. package/Libraries/Blob/URLSearchParams.js.flow +12 -7
  15. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
  16. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
  17. package/Libraries/Components/Keyboard/Keyboard.js +1 -1
  18. package/Libraries/Components/Pressable/Pressable.js +14 -3
  19. package/Libraries/Components/Pressable/Pressable.win32.js +14 -3
  20. package/Libraries/Components/ScrollView/ScrollView.d.ts +1 -1
  21. package/Libraries/Components/ScrollView/ScrollView.js +14 -17
  22. package/Libraries/Components/Switch/Switch.d.ts +3 -0
  23. package/Libraries/Components/Switch/Switch.js +1 -1
  24. package/Libraries/Components/TextInput/TextInput.d.ts +64 -33
  25. package/Libraries/Components/TextInput/TextInput.flow.js +15 -16
  26. package/Libraries/Components/TextInput/TextInput.js +34 -27
  27. package/Libraries/Components/TextInput/TextInput.win32.js +34 -27
  28. package/Libraries/Components/TextInput/TextInputState.js +1 -1
  29. package/Libraries/Components/TextInput/TextInputState.win32.js +1 -1
  30. package/Libraries/Components/Touchable/TouchableBounce.js +2 -1
  31. package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
  32. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -2
  33. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +2 -2
  34. package/Libraries/Components/Touchable/TouchableOpacity.js +2 -1
  35. package/Libraries/Components/View/ViewAccessibility.js +2 -1
  36. package/Libraries/Components/View/ViewAccessibility.win32.js +2 -1
  37. package/Libraries/Components/View/ViewPropTypes.js +49 -3
  38. package/Libraries/Components/View/ViewPropTypes.win32.js +49 -3
  39. package/Libraries/Core/ReactNativeVersion.js +1 -1
  40. package/Libraries/Debugging/DebuggingOverlayRegistry.js +3 -3
  41. package/Libraries/EventEmitter/NativeEventEmitter.js +4 -2
  42. package/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +2 -2
  43. package/Libraries/Image/Image.d.ts +26 -10
  44. package/Libraries/Image/Image.js.flow +3 -3
  45. package/Libraries/Image/ImageBackground.js +2 -0
  46. package/Libraries/Image/ImageProps.js +19 -14
  47. package/Libraries/Interaction/InteractionManager.d.ts +13 -0
  48. package/Libraries/Interaction/InteractionManager.js +1 -1
  49. package/Libraries/Interaction/PanResponder.js +3 -3
  50. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
  51. package/Libraries/Linking/Linking.js +1 -1
  52. package/Libraries/Lists/FlatList.js +7 -10
  53. package/Libraries/Lists/SectionList.js +39 -42
  54. package/Libraries/Lists/SectionListModern.js +22 -31
  55. package/Libraries/Lists/VirtualizedList.js +1 -0
  56. package/Libraries/Lists/VirtualizedSectionList.js +1 -0
  57. package/Libraries/NativeComponent/BaseViewConfig.android.js +1 -0
  58. package/Libraries/NativeComponent/BaseViewConfig.ios.js +1 -0
  59. package/Libraries/NativeComponent/BaseViewConfig.win32.js +1 -0
  60. package/Libraries/Network/RCTNetworking.android.js +1 -1
  61. package/Libraries/Network/RCTNetworking.ios.js +1 -1
  62. package/Libraries/Network/RCTNetworking.js.flow +1 -1
  63. package/Libraries/Network/RCTNetworking.win32.js +1 -1
  64. package/Libraries/NewAppScreen/components/DebugInstructions.js +1 -3
  65. package/Libraries/NewAppScreen/components/Header.js +1 -3
  66. package/Libraries/NewAppScreen/components/HermesBadge.js +1 -3
  67. package/Libraries/NewAppScreen/components/LearnMoreLinks.js +1 -3
  68. package/Libraries/NewAppScreen/components/ReloadInstructions.js +1 -3
  69. package/Libraries/Pressability/Pressability.js +1 -1
  70. package/Libraries/Pressability/Pressability.win32.js +1 -1
  71. package/Libraries/ReactNative/AppContainer-dev.js +2 -2
  72. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +2 -4
  73. package/Libraries/ReactNative/RendererImplementation.js +4 -0
  74. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -1
  75. package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -3
  76. package/Libraries/StyleSheet/StyleSheet.js +25 -2
  77. package/Libraries/StyleSheet/StyleSheet.js.flow +24 -2
  78. package/Libraries/StyleSheet/StyleSheetTypes.js +13 -3
  79. package/Libraries/StyleSheet/flattenStyle.js +7 -3
  80. package/Libraries/StyleSheet/private/_TransformStyle.js +3 -3
  81. package/Libraries/Text/Text.d.ts +2 -5
  82. package/Libraries/Text/TextProps.js +3 -2
  83. package/Libraries/Text/TextProps.win32.js +3 -2
  84. package/Libraries/Types/CoreEventTypes.d.ts +6 -1
  85. package/Libraries/Types/CoreEventTypes.js +1 -1
  86. package/Libraries/Types/CoreEventTypes.win32.js +1 -1
  87. package/Libraries/Utilities/DeviceInfo.js +2 -0
  88. package/Libraries/Utilities/Dimensions.js +1 -1
  89. package/Libraries/Utilities/Dimensions.win32.js +1 -1
  90. package/Libraries/Utilities/PlatformTypes.js +9 -3
  91. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  92. package/Libraries/vendor/core/ErrorUtils.js +2 -0
  93. package/flow/global.js +2 -0
  94. package/index.js +3 -0
  95. package/index.win32.js +3 -0
  96. package/interface.js +0 -4
  97. package/overrides.json +19 -25
  98. package/package.json +13 -13
  99. package/src/private/animated/NativeAnimatedHelper.js +3 -1
  100. package/src/private/animated/NativeAnimatedHelper.win32.js +3 -1
  101. package/src/private/animated/createAnimatedPropsHook.js +1 -0
  102. package/src/private/animated/createAnimatedPropsMemoHook.js +1 -2
  103. package/src/private/featureflags/ReactNativeFeatureFlags.js +18 -18
  104. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +3 -3
  105. package/src/private/inspector/getInspectorDataForViewAtPoint.js +2 -2
  106. package/src/private/types/HostInstance.js +61 -3
  107. package/src/private/webapis/dom/nodes/ReactNativeElement.js +2 -5
  108. package/src-win/Libraries/Text/Text.d.ts +2 -5
  109. package/types/modules/LaunchScreen.d.ts +9 -1
  110. package/Libraries/Utilities/DeviceInfo.win32.js +0 -19
  111. package/flow/jest.js +0 -1289
  112. package/src/private/utilities/ensureInstance.js +0 -21
@@ -397,7 +397,7 @@ const AccessibilityInfo = {
397
397
  addEventListener<K: $Keys<AccessibilityEventDefinitions>>(
398
398
  eventName: K,
399
399
  // $FlowIssue[incompatible-type] - Flow bug with unions and generics (T128099423)
400
- handler: (...$ElementType<AccessibilityEventDefinitions, K>) => void,
400
+ handler: (...AccessibilityEventDefinitions[K]) => void,
401
401
  ): EventSubscription {
402
402
  const deviceEventName = EventNames.get(eventName);
403
403
  return deviceEventName == null
@@ -421,7 +421,7 @@ const AccessibilityInfo = {
421
421
  addEventListener<K: $Keys<AccessibilityEventDefinitions>>(
422
422
  eventName: K,
423
423
  // $FlowIssue[incompatible-type] - Flow bug with unions and generics (T128099423)
424
- handler: (...$ElementType<AccessibilityEventDefinitions, K>) => void,
424
+ handler: (...AccessibilityEventDefinitions[K]) => void,
425
425
  ): EventSubscription {
426
426
  const deviceEventName = EventNames.get(eventName);
427
427
  return deviceEventName == null
@@ -148,7 +148,7 @@ class Keyboard {
148
148
  */
149
149
  addListener<K: $Keys<KeyboardEventDefinitions>>(
150
150
  eventType: K,
151
- listener: (...$ElementType<KeyboardEventDefinitions, K>) => mixed,
151
+ listener: (...KeyboardEventDefinitions[K]) => mixed,
152
152
  context?: mixed,
153
153
  ): EventSubscription {
154
154
  return this._emitter.addListener(eventType, listener);
@@ -26,7 +26,7 @@ import useAndroidRippleForView, {
26
26
  import * as React from 'react';
27
27
  import {useMemo, useRef, useState} from 'react';
28
28
 
29
- type ViewStyleProp = $ElementType<React.ElementConfig<typeof View>, 'style'>;
29
+ type ViewStyleProp = React.ElementConfig<typeof View>['style'];
30
30
 
31
31
  export type PressableStateCallbackType = $ReadOnly<{
32
32
  pressed: boolean,
@@ -43,7 +43,7 @@ type PressableBaseProps = $ReadOnly<{
43
43
  * Either children or a render prop that receives a boolean reflecting whether
44
44
  * the component is currently pressed.
45
45
  */
46
- children: React.Node | ((state: PressableStateCallbackType) => React.Node),
46
+ children?: React.Node | ((state: PressableStateCallbackType) => React.Node),
47
47
 
48
48
  /**
49
49
  * Duration to wait after hover in before calling `onHoverIn`.
@@ -105,6 +105,10 @@ type PressableBaseProps = $ReadOnly<{
105
105
  * Called when a touch is engaged before `onPress`.
106
106
  */
107
107
  onPressIn?: ?(event: GestureResponderEvent) => mixed,
108
+ /**
109
+ * Called when the press location moves.
110
+ */
111
+ onPressMove?: ?(event: GestureResponderEvent) => mixed,
108
112
 
109
113
  /**
110
114
  * Called when a touch is released before `onPress`.
@@ -185,6 +189,7 @@ function Pressable(
185
189
  onLongPress,
186
190
  onPress,
187
191
  onPressIn,
192
+ onPressMove,
188
193
  onPressOut,
189
194
  pressRetentionOffset,
190
195
  style,
@@ -263,7 +268,12 @@ function Pressable(
263
268
  onPressIn(event);
264
269
  }
265
270
  },
266
- onPressMove: android_rippleConfig?.onPressMove,
271
+ onPressMove(event: GestureResponderEvent): void {
272
+ android_rippleConfig?.onPressMove(event);
273
+ if (onPressMove != null) {
274
+ onPressMove(event);
275
+ }
276
+ },
267
277
  onPressOut(event: GestureResponderEvent): void {
268
278
  if (android_rippleConfig != null) {
269
279
  android_rippleConfig.onPressOut(event);
@@ -288,6 +298,7 @@ function Pressable(
288
298
  onLongPress,
289
299
  onPress,
290
300
  onPressIn,
301
+ onPressMove,
291
302
  onPressOut,
292
303
  pressRetentionOffset,
293
304
  setPressed,
@@ -32,7 +32,7 @@ import {useMemo, useRef, useState} from 'react';
32
32
  import type {HandledKeyboardEvent} from '../../Components/View/ViewPropTypes';
33
33
  import View from '../View/View';
34
34
 
35
- type ViewStyleProp = $ElementType<React.ElementConfig<typeof View>, 'style'>;
35
+ type ViewStyleProp = React.ElementConfig<typeof View>['style'];
36
36
 
37
37
  export type PressableStateCallbackType = $ReadOnly<{
38
38
  pressed: boolean,
@@ -49,7 +49,7 @@ type PressableBaseProps = $ReadOnly<{
49
49
  * Either children or a render prop that receives a boolean reflecting whether
50
50
  * the component is currently pressed.
51
51
  */
52
- children: React.Node | ((state: PressableStateCallbackType) => React.Node),
52
+ children?: React.Node | ((state: PressableStateCallbackType) => React.Node),
53
53
 
54
54
  /**
55
55
  * Duration to wait after hover in before calling `onHoverIn`.
@@ -111,6 +111,10 @@ type PressableBaseProps = $ReadOnly<{
111
111
  * Called when a touch is engaged before `onPress`.
112
112
  */
113
113
  onPressIn?: ?(event: GestureResponderEvent) => mixed,
114
+ /**
115
+ * Called when the press location moves.
116
+ */
117
+ onPressMove?: ?(event: GestureResponderEvent) => mixed,
114
118
 
115
119
  /**
116
120
  * Called when a touch is released before `onPress`.
@@ -233,6 +237,7 @@ function Pressable(
233
237
  onLongPress,
234
238
  onPress,
235
239
  onPressIn,
240
+ onPressMove,
236
241
  onPressOut,
237
242
  // [Windows
238
243
  onBlur,
@@ -319,7 +324,12 @@ function Pressable(
319
324
  onPressIn(event);
320
325
  }
321
326
  },
322
- onPressMove: android_rippleConfig?.onPressMove,
327
+ onPressMove(event: GestureResponderEvent): void {
328
+ android_rippleConfig?.onPressMove(event);
329
+ if (onPressMove != null) {
330
+ onPressMove(event);
331
+ }
332
+ },
323
333
  onPressOut(event: GestureResponderEvent): void {
324
334
  if (android_rippleConfig != null) {
325
335
  android_rippleConfig.onPressOut(event);
@@ -350,6 +360,7 @@ function Pressable(
350
360
  onLongPress,
351
361
  onPress,
352
362
  onPressIn,
363
+ onPressMove,
353
364
  onPressOut,
354
365
  // [Windows
355
366
  onBlur,
@@ -405,7 +405,7 @@ export interface ScrollViewPropsIOS {
405
405
 
406
406
  /**
407
407
  * This property specifies how the safe area insets are used to modify the content area of the scroll view.
408
- * The default value of this property must be 'automatic'. But the default value is 'never' until RN@0.51.
408
+ * The default value of this property is "never".
409
409
  */
410
410
  contentInsetAdjustmentBehavior?:
411
411
  | 'automatic'
@@ -134,19 +134,16 @@ export interface ScrollViewScrollToOptions {
134
134
 
135
135
  // Public methods for ScrollView
136
136
  export interface ScrollViewImperativeMethods {
137
- +getScrollResponder: $PropertyType<ScrollView, 'getScrollResponder'>;
138
- +getScrollableNode: $PropertyType<ScrollView, 'getScrollableNode'>;
139
- +getInnerViewNode: $PropertyType<ScrollView, 'getInnerViewNode'>;
140
- +getInnerViewRef: $PropertyType<ScrollView, 'getInnerViewRef'>;
141
- +getNativeScrollRef: $PropertyType<ScrollView, 'getNativeScrollRef'>;
142
- +scrollTo: $PropertyType<ScrollView, 'scrollTo'>;
143
- +scrollToEnd: $PropertyType<ScrollView, 'scrollToEnd'>;
144
- +flashScrollIndicators: $PropertyType<ScrollView, 'flashScrollIndicators'>;
145
- +scrollResponderZoomTo: $PropertyType<ScrollView, 'scrollResponderZoomTo'>;
146
- +scrollResponderScrollNativeHandleToKeyboard: $PropertyType<
147
- ScrollView,
148
- 'scrollResponderScrollNativeHandleToKeyboard',
149
- >;
137
+ +getScrollResponder: ScrollView['getScrollResponder'];
138
+ +getScrollableNode: ScrollView['getScrollableNode'];
139
+ +getInnerViewNode: ScrollView['getInnerViewNode'];
140
+ +getInnerViewRef: ScrollView['getInnerViewRef'];
141
+ +getNativeScrollRef: ScrollView['getNativeScrollRef'];
142
+ +scrollTo: ScrollView['scrollTo'];
143
+ +scrollToEnd: ScrollView['scrollToEnd'];
144
+ +flashScrollIndicators: ScrollView['flashScrollIndicators'];
145
+ +scrollResponderZoomTo: ScrollView['scrollResponderZoomTo'];
146
+ +scrollResponderScrollNativeHandleToKeyboard: ScrollView['scrollResponderScrollNativeHandleToKeyboard'];
150
147
  }
151
148
 
152
149
  export type DecelerationRateType = 'fast' | 'normal' | number;
@@ -303,7 +300,7 @@ export type ScrollViewPropsIOS = $ReadOnly<{
303
300
  /**
304
301
  * This property specifies how the safe area insets are used to modify the
305
302
  * content area of the scroll view. The default value of this property is
306
- * "never". Available on iOS 11 and later.
303
+ * "never".
307
304
  * @platform ios
308
305
  */
309
306
  contentInsetAdjustmentBehavior?: ?(
@@ -829,11 +826,11 @@ class ScrollView extends React.Component<ScrollViewProps, State> {
829
826
  };
830
827
 
831
828
  getScrollableNode: () => ?number = () => {
832
- return findNodeHandle(this.getNativeScrollRef());
829
+ return findNodeHandle<$FlowFixMe>(this.getNativeScrollRef());
833
830
  };
834
831
 
835
832
  getInnerViewNode: () => ?number = () => {
836
- return findNodeHandle(this._innerView.nativeInstance);
833
+ return findNodeHandle<$FlowFixMe>(this._innerView.nativeInstance);
837
834
  };
838
835
 
839
836
  getInnerViewRef: () => InnerViewInstance | null = () => {
@@ -941,7 +938,7 @@ class ScrollView extends React.Component<ScrollViewProps, State> {
941
938
  if (typeof nodeHandle === 'number') {
942
939
  UIManager.measureLayout(
943
940
  nodeHandle,
944
- nullthrows(findNodeHandle(this)),
941
+ nullthrows(findNodeHandle<$FlowFixMe>(this)),
945
942
  // $FlowFixMe[method-unbinding] added when improving typing for this parameters
946
943
  this._textInputFocusError,
947
944
  this._inputMeasureAndScrollToKeyboard,
@@ -38,6 +38,9 @@ export interface SwitchPropsIOS extends ViewProps {
38
38
  tintColor?: ColorValue | undefined;
39
39
  }
40
40
 
41
+ /**
42
+ * @deprecated Use `SwitchChangeEvent` instead.
43
+ */
41
44
  export interface SwitchChangeEventData extends TargetedEvent {
42
45
  value: boolean;
43
46
  }
@@ -46,7 +46,7 @@ export type SwitchPropsIOS = {
46
46
  tintColor?: ?ColorValue,
47
47
  };
48
48
 
49
- export type SwitchChangeEventData = $ReadOnly<{
49
+ type SwitchChangeEventData = $ReadOnly<{
50
50
  target: number,
51
51
  value: boolean,
52
52
  }>;
@@ -455,7 +455,7 @@ export interface TextInputAndroidProps {
455
455
  }
456
456
 
457
457
  /**
458
- * @see TextInputProps.onFocus
458
+ * @deprecated Use `TextInputFocusEvent` instead
459
459
  */
460
460
  export interface TextInputFocusEventData extends TargetedEvent {
461
461
  text: string;
@@ -463,14 +463,25 @@ export interface TextInputFocusEventData extends TargetedEvent {
463
463
  }
464
464
 
465
465
  /**
466
- * @see TextInputProps.onScroll
466
+ * @see TextInputProps.onFocus
467
+ */
468
+ export type TextInputFocusEvent = NativeSyntheticEvent<TextInputFocusEventData>;
469
+
470
+ /**
471
+ * @deprecated Use `TextInputScrollEvent` instead
467
472
  */
468
473
  export interface TextInputScrollEventData {
469
474
  contentOffset: {x: number; y: number};
470
475
  }
471
476
 
472
477
  /**
473
- * @see TextInputProps.onSelectionChange
478
+ * @see TextInputProps.onScroll
479
+ */
480
+ export type TextInputScrollEvent =
481
+ NativeSyntheticEvent<TextInputScrollEventData>;
482
+
483
+ /**
484
+ * @deprecated Use `TextInputSelectionChangeEvent` instead
474
485
  */
475
486
  export interface TextInputSelectionChangeEventData extends TargetedEvent {
476
487
  selection: {
@@ -480,14 +491,26 @@ export interface TextInputSelectionChangeEventData extends TargetedEvent {
480
491
  }
481
492
 
482
493
  /**
483
- * @see TextInputProps.onKeyPress
494
+ * @see TextInputProps.onSelectionChange
495
+ */
496
+ export type TextInputSelectionChangeEvent =
497
+ NativeSyntheticEvent<TextInputSelectionChangeEventData>;
498
+
499
+ /**
500
+ * @deprecated Use `TextInputKeyPressEvent` instead
484
501
  */
485
502
  export interface TextInputKeyPressEventData {
486
503
  key: string;
487
504
  }
488
505
 
489
506
  /**
490
- * @see TextInputProps.onChange
507
+ * @see TextInputProps.onKeyPress
508
+ */
509
+ export type TextInputKeyPressEvent =
510
+ NativeSyntheticEvent<TextInputKeyPressEventData>;
511
+
512
+ /**
513
+ * @deprecated Use `TextInputChangeEvent` instead
491
514
  */
492
515
  export interface TextInputChangeEventData extends TargetedEvent {
493
516
  eventCount: number;
@@ -495,26 +518,50 @@ export interface TextInputChangeEventData extends TargetedEvent {
495
518
  }
496
519
 
497
520
  /**
498
- * @see TextInputProps.onContentSizeChange
521
+ * @see TextInputProps.onChange
522
+ */
523
+ export type TextInputChangeEvent =
524
+ NativeSyntheticEvent<TextInputChangeEventData>;
525
+
526
+ /**
527
+ * @deprecated Use `TextInputContentSizeChangeEvent` instead
499
528
  */
500
529
  export interface TextInputContentSizeChangeEventData {
501
530
  contentSize: {width: number; height: number};
502
531
  }
503
532
 
504
533
  /**
505
- * @see TextInputProps.onEndEditing
534
+ * @see TextInputProps.onContentSizeChange
535
+ */
536
+ export type TextInputContentSizeChangeEvent =
537
+ NativeSyntheticEvent<TextInputContentSizeChangeEventData>;
538
+
539
+ /**
540
+ * @deprecated Use `TextInputEndEditingEvent` instead
506
541
  */
507
542
  export interface TextInputEndEditingEventData {
508
543
  text: string;
509
544
  }
510
545
 
511
546
  /**
512
- * @see TextInputProps.onSubmitEditing
547
+ * @see TextInputProps.onEndEditing
548
+ */
549
+ export type TextInputEndEditingEvent =
550
+ NativeSyntheticEvent<TextInputEndEditingEventData>;
551
+
552
+ /**
553
+ * @deprecated Use `TextInputSubmitEditingEvent` instead
513
554
  */
514
555
  export interface TextInputSubmitEditingEventData {
515
556
  text: string;
516
557
  }
517
558
 
559
+ /**
560
+ * @see TextInputProps.onSubmitEditing
561
+ */
562
+ export type TextInputSubmitEditingEvent =
563
+ NativeSyntheticEvent<TextInputSubmitEditingEventData>;
564
+
518
565
  /**
519
566
  * @see https://reactnative.dev/docs/textinput#props
520
567
  */
@@ -763,16 +810,12 @@ export interface TextInputProps
763
810
  /**
764
811
  * Callback that is called when the text input is blurred
765
812
  */
766
- onBlur?:
767
- | ((e: NativeSyntheticEvent<TextInputFocusEventData>) => void)
768
- | undefined;
813
+ onBlur?: ((e: TextInputFocusEvent) => void) | undefined;
769
814
 
770
815
  /**
771
816
  * Callback that is called when the text input's text changes.
772
817
  */
773
- onChange?:
774
- | ((e: NativeSyntheticEvent<TextInputChangeEventData>) => void)
775
- | undefined;
818
+ onChange?: ((e: TextInputChangeEvent) => void) | undefined;
776
819
 
777
820
  /**
778
821
  * Callback that is called when the text input's text changes.
@@ -788,15 +831,13 @@ export interface TextInputProps
788
831
  * Only called for multiline text inputs.
789
832
  */
790
833
  onContentSizeChange?:
791
- | ((e: NativeSyntheticEvent<TextInputContentSizeChangeEventData>) => void)
834
+ | ((e: TextInputContentSizeChangeEvent) => void)
792
835
  | undefined;
793
836
 
794
837
  /**
795
838
  * Callback that is called when text input ends.
796
839
  */
797
- onEndEditing?:
798
- | ((e: NativeSyntheticEvent<TextInputEndEditingEventData>) => void)
799
- | undefined;
840
+ onEndEditing?: ((e: TextInputEndEditingEvent) => void) | undefined;
800
841
 
801
842
  /**
802
843
  * Called when a single tap gesture is detected.
@@ -818,23 +859,17 @@ export interface TextInputProps
818
859
  /**
819
860
  * Callback that is called when the text input is focused
820
861
  */
821
- onFocus?:
822
- | ((e: NativeSyntheticEvent<TextInputFocusEventData>) => void)
823
- | undefined;
862
+ onFocus?: ((e: TextInputFocusEvent) => void) | undefined;
824
863
 
825
864
  /**
826
865
  * Callback that is called when the text input selection is changed.
827
866
  */
828
- onSelectionChange?:
829
- | ((e: NativeSyntheticEvent<TextInputSelectionChangeEventData>) => void)
830
- | undefined;
867
+ onSelectionChange?: ((e: TextInputSelectionChangeEvent) => void) | undefined;
831
868
 
832
869
  /**
833
870
  * Callback that is called when the text input's submit button is pressed.
834
871
  */
835
- onSubmitEditing?:
836
- | ((e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void)
837
- | undefined;
872
+ onSubmitEditing?: ((e: TextInputSubmitEditingEvent) => void) | undefined;
838
873
 
839
874
  /**
840
875
  * Invoked on content scroll with
@@ -842,9 +877,7 @@ export interface TextInputProps
842
877
  *
843
878
  * May also contain other properties from ScrollEvent but on Android contentSize is not provided for performance reasons.
844
879
  */
845
- onScroll?:
846
- | ((e: NativeSyntheticEvent<TextInputScrollEventData>) => void)
847
- | undefined;
880
+ onScroll?: ((e: TextInputScrollEvent) => void) | undefined;
848
881
 
849
882
  /**
850
883
  * Callback that is called when a key is pressed.
@@ -855,9 +888,7 @@ export interface TextInputProps
855
888
  * Fires before onChange callbacks.
856
889
  * Note: on Android only the inputs from soft keyboard are handled, not the hardware keyboard inputs.
857
890
  */
858
- onKeyPress?:
859
- | ((e: NativeSyntheticEvent<TextInputKeyPressEventData>) => void)
860
- | undefined;
891
+ onKeyPress?: ((e: TextInputKeyPressEvent) => void) | undefined;
861
892
 
862
893
  /**
863
894
  * The string that will be rendered before text input has been entered
@@ -23,14 +23,13 @@ import {
23
23
  } from '../../StyleSheet/StyleSheet';
24
24
  import * as React from 'react';
25
25
 
26
- export type TextInputChangeEventData = $ReadOnly<{
26
+ type TextInputChangeEventData = $ReadOnly<{
27
27
  eventCount: number,
28
28
  target: number,
29
29
  text: string,
30
30
  }>;
31
31
 
32
- export type TextInputChangeEvent =
33
- NativeSyntheticEvent<TextInputChangeEventData>;
32
+ type TextInputChangeEvent = NativeSyntheticEvent<TextInputChangeEventData>;
34
33
 
35
34
  export type TextInputEvent = NativeSyntheticEvent<
36
35
  $ReadOnly<{
@@ -45,7 +44,7 @@ export type TextInputEvent = NativeSyntheticEvent<
45
44
  }>,
46
45
  >;
47
46
 
48
- export type TextInputContentSizeChangeEventData = $ReadOnly<{
47
+ type TextInputContentSizeChangeEventData = $ReadOnly<{
49
48
  target: number,
50
49
  contentSize: $ReadOnly<{
51
50
  width: number,
@@ -56,11 +55,11 @@ export type TextInputContentSizeChangeEventData = $ReadOnly<{
56
55
  export type TextInputContentSizeChangeEvent =
57
56
  NativeSyntheticEvent<TextInputContentSizeChangeEventData>;
58
57
 
59
- export type TargetEvent = $ReadOnly<{
58
+ type TargetEvent = $ReadOnly<{
60
59
  target: number,
61
60
  }>;
62
61
 
63
- export type TextInputFocusEventData = TargetEvent;
62
+ type TextInputFocusEventData = TargetEvent;
64
63
 
65
64
  export type TextInputBlurEvent = NativeSyntheticEvent<TextInputFocusEventData>;
66
65
  export type TextInputFocusEvent = NativeSyntheticEvent<TextInputFocusEventData>;
@@ -70,7 +69,7 @@ type Selection = $ReadOnly<{
70
69
  end: number,
71
70
  }>;
72
71
 
73
- export type TextInputSelectionChangeEventData = $ReadOnly<{
72
+ type TextInputSelectionChangeEventData = $ReadOnly<{
74
73
  ...TargetEvent,
75
74
  selection: Selection,
76
75
  }>;
@@ -78,7 +77,7 @@ export type TextInputSelectionChangeEventData = $ReadOnly<{
78
77
  export type TextInputSelectionChangeEvent =
79
78
  NativeSyntheticEvent<TextInputSelectionChangeEventData>;
80
79
 
81
- export type TextInputKeyPressEventData = $ReadOnly<{
80
+ type TextInputKeyPressEventData = $ReadOnly<{
82
81
  ...TargetEvent,
83
82
  key: string,
84
83
  target?: ?number,
@@ -88,27 +87,27 @@ export type TextInputKeyPressEventData = $ReadOnly<{
88
87
  export type TextInputKeyPressEvent =
89
88
  NativeSyntheticEvent<TextInputKeyPressEventData>;
90
89
 
91
- /**
92
- * @see TextInputProps.onEndEditing
93
- */
94
- export type TextInputEndEditingEventData = $ReadOnly<{
90
+ type TextInputEndEditingEventData = $ReadOnly<{
95
91
  ...TargetEvent,
96
92
  eventCount: number,
97
93
  text: string,
98
94
  }>;
99
95
 
96
+ /**
97
+ * @see TextInputProps.onEndEditing
98
+ */
100
99
  export type TextInputEndEditingEvent =
101
100
  NativeSyntheticEvent<TextInputEndEditingEventData>;
102
101
 
103
- /**
104
- * @see TextInputProps.onSubmitEditing
105
- */
106
- export type TextInputSubmitEditingEventData = $ReadOnly<{
102
+ type TextInputSubmitEditingEventData = $ReadOnly<{
107
103
  ...TargetEvent,
108
104
  eventCount: number,
109
105
  text: string,
110
106
  }>;
111
107
 
108
+ /**
109
+ * @see TextInputProps.onSubmitEditing
110
+ */
112
111
  export type TextInputSubmitEditingEvent =
113
112
  NativeSyntheticEvent<TextInputSubmitEditingEventData>;
114
113
 
@@ -60,7 +60,7 @@ if (Platform.OS === 'android') {
60
60
  /**
61
61
  * @see TextInputProps.onChange
62
62
  */
63
- export type TextInputChangeEventData = $ReadOnly<{
63
+ type TextInputChangeEventData = $ReadOnly<{
64
64
  eventCount: number,
65
65
  target: number,
66
66
  text: string,
@@ -82,10 +82,7 @@ export type TextInputEvent = NativeSyntheticEvent<
82
82
  }>,
83
83
  >;
84
84
 
85
- /**
86
- * @see TextInputProps.onContentSizeChange
87
- */
88
- export type TextInputContentSizeChangeEventData = $ReadOnly<{
85
+ type TextInputContentSizeChangeEventData = $ReadOnly<{
89
86
  target: number,
90
87
  contentSize: $ReadOnly<{
91
88
  width: number,
@@ -93,6 +90,9 @@ export type TextInputContentSizeChangeEventData = $ReadOnly<{
93
90
  }>,
94
91
  }>;
95
92
 
93
+ /**
94
+ * @see TextInputProps.onContentSizeChange
95
+ */
96
96
  export type TextInputContentSizeChangeEvent =
97
97
  NativeSyntheticEvent<TextInputContentSizeChangeEventData>;
98
98
 
@@ -100,71 +100,78 @@ export type TargetEvent = $ReadOnly<{
100
100
  target: number,
101
101
  }>;
102
102
 
103
+ type TextInputFocusEventData = TargetEvent;
104
+
103
105
  /**
104
- * @see TextInputProps.onFocus
106
+ * @see TextInputProps.onBlur
105
107
  */
106
- export type TextInputFocusEventData = TargetEvent;
107
-
108
108
  export type TextInputBlurEvent = NativeSyntheticEvent<TextInputFocusEventData>;
109
- export type TextInputFocusEvent = NativeSyntheticEvent<TextInputFocusEventData>;
110
109
 
111
110
  /**
112
- * @see TextInputProps.onScroll
111
+ * @see TextInputProps.onFocus
113
112
  */
114
- export type TextInputScrollEventData = {
113
+ export type TextInputFocusEvent = NativeSyntheticEvent<TextInputFocusEventData>;
114
+
115
+ type TextInputScrollEventData = {
115
116
  contentOffset: {x: number, y: number},
116
117
  };
117
118
 
119
+ /**
120
+ * @see TextInputProps.onScroll
121
+ */
122
+ export type TextInputScrollEvent =
123
+ NativeSyntheticEvent<TextInputScrollEventData>;
124
+
118
125
  type Selection = $ReadOnly<{
119
126
  start: number,
120
127
  end: number,
121
128
  }>;
122
129
 
123
- /**
124
- * @see TextInputProps.onSelectionChange
125
- */
126
- export type TextInputSelectionChangeEventData = $ReadOnly<{
130
+ type TextInputSelectionChangeEventData = $ReadOnly<{
127
131
  ...TargetEvent,
128
132
  selection: Selection,
129
133
  }>;
130
134
 
135
+ /**
136
+ * @see TextInputProps.onSelectionChange
137
+ */
131
138
  export type TextInputSelectionChangeEvent =
132
139
  NativeSyntheticEvent<TextInputSelectionChangeEventData>;
133
140
 
134
- /**
135
- * @see TextInputProps.onKeyPress
136
- */
137
- export type TextInputKeyPressEventData = $ReadOnly<{
141
+ type TextInputKeyPressEventData = $ReadOnly<{
138
142
  ...TargetEvent,
139
143
  key: string,
140
144
  target?: ?number,
141
145
  eventCount?: ?number,
142
146
  }>;
143
147
 
148
+ /**
149
+ * @see TextInputProps.onKeyPress
150
+ */
144
151
  export type TextInputKeyPressEvent =
145
152
  NativeSyntheticEvent<TextInputKeyPressEventData>;
146
153
 
147
- /**
148
- * @see TextInputProps.onEndEditing
149
- */
150
- export type TextInputEndEditingEventData = $ReadOnly<{
154
+ type TextInputEndEditingEventData = $ReadOnly<{
151
155
  ...TargetEvent,
152
156
  eventCount: number,
153
157
  text: string,
154
158
  }>;
155
159
 
160
+ /**
161
+ * @see TextInputProps.onEndEditing
162
+ */
156
163
  export type TextInputEndEditingEvent =
157
164
  NativeSyntheticEvent<TextInputEndEditingEventData>;
158
165
 
159
- /**
160
- * @see TextInputProps.onSubmitEditing
161
- */
162
- export type TextInputSubmitEditingEventData = $ReadOnly<{
166
+ type TextInputSubmitEditingEventData = $ReadOnly<{
163
167
  ...TargetEvent,
164
168
  eventCount: number,
165
169
  text: string,
166
170
  }>;
167
171
 
172
+ /**
173
+ * @see TextInputProps.onSubmitEditing
174
+ */
168
175
  export type TextInputSubmitEditingEvent =
169
176
  NativeSyntheticEvent<TextInputSubmitEditingEventData>;
170
177