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

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 (148) hide show
  1. package/.flowconfig +4 -1
  2. package/CHANGELOG.json +42 -1
  3. package/CHANGELOG.md +15 -4
  4. package/Libraries/Alert/RCTAlertManager.js.flow +18 -0
  5. package/Libraries/Animated/Animated.js +8 -37
  6. package/Libraries/Animated/Animated.js.flow +15 -0
  7. package/Libraries/Animated/AnimatedExports.js +47 -0
  8. package/Libraries/Animated/AnimatedExports.js.flow +48 -0
  9. package/Libraries/Animated/useAnimatedValue.js +1 -3
  10. package/Libraries/Blob/URLSearchParams.js.flow +23 -0
  11. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
  12. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
  13. package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js.flow +20 -0
  14. package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +8 -8
  15. package/Libraries/Components/Button.js +2 -2
  16. package/Libraries/Components/Button.win32.js +2 -2
  17. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +14 -100
  18. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +64 -4
  19. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +138 -0
  20. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -4
  21. package/Libraries/Components/LayoutConformance/LayoutConformance.js +6 -4
  22. package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +1 -1
  23. package/Libraries/Components/Pressable/Pressable.js +18 -63
  24. package/Libraries/Components/Pressable/Pressable.win32.js +19 -65
  25. package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
  26. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +4 -46
  27. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +10 -4
  28. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +54 -0
  29. package/Libraries/Components/RefreshControl/RefreshControl.js +10 -7
  30. package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +2 -1
  31. package/Libraries/Components/SafeAreaView/SafeAreaView.js +1 -1
  32. package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +1 -1
  33. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +2 -4
  34. package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +2 -4
  35. package/Libraries/Components/ScrollView/ScrollView.js +43 -59
  36. package/Libraries/Components/ScrollView/ScrollViewCommands.js +1 -1
  37. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +2 -4
  38. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +6 -7
  39. package/Libraries/Components/StatusBar/StatusBar.js +33 -22
  40. package/Libraries/Components/Switch/Switch.js +70 -41
  41. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +2 -4
  42. package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +2 -4
  43. package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +2 -4
  44. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
  45. package/Libraries/Components/TextInput/TextInput.flow.js +10 -12
  46. package/Libraries/Components/TextInput/TextInput.js +22 -28
  47. package/Libraries/Components/TextInput/TextInput.win32.js +22 -28
  48. package/Libraries/Components/TextInput/TextInputState.js +2 -18
  49. package/Libraries/Components/TextInput/TextInputState.win32.js +2 -18
  50. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +1 -1
  51. package/Libraries/Components/Touchable/Touchable.js +7 -7
  52. package/Libraries/Components/Touchable/Touchable.win32.js +7 -7
  53. package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
  54. package/Libraries/Components/Touchable/TouchableHighlight.js +35 -14
  55. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +95 -47
  56. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +248 -43
  57. package/Libraries/Components/Touchable/TouchableOpacity.js +52 -10
  58. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +112 -59
  59. package/Libraries/Components/View/View.js +1 -1
  60. package/Libraries/Components/View/View.win32.js +1 -1
  61. package/Libraries/Components/View/ViewNativeComponent.js +2 -4
  62. package/Libraries/Components/View/ViewPropTypes.js +15 -12
  63. package/Libraries/Components/View/ViewPropTypes.win32.js +74 -71
  64. package/Libraries/Core/ReactNativeVersion.js +1 -1
  65. package/Libraries/Core/setUpReactDevTools.js +2 -0
  66. package/Libraries/Debugging/DebuggingOverlayRegistry.js +10 -7
  67. package/Libraries/Image/Image.android.js +1 -1
  68. package/Libraries/Image/Image.js.flow +27 -0
  69. package/Libraries/Image/ImageBackground.js +1 -1
  70. package/Libraries/Image/ImageProps.js +97 -30
  71. package/Libraries/Image/ImageTypes.flow.js +16 -6
  72. package/Libraries/Image/ImageViewNativeComponent.js +3 -5
  73. package/Libraries/Image/TextInlineImageNativeComponent.js +2 -4
  74. package/Libraries/Interaction/InteractionManager.js +9 -1
  75. package/Libraries/Interaction/PanResponder.js +11 -11
  76. package/Libraries/Interaction/TaskQueue.js +2 -2
  77. package/Libraries/Lists/FlatList.js +8 -7
  78. package/Libraries/LogBox/LogBox.js +1 -1
  79. package/Libraries/NativeComponent/BaseViewConfig.js.flow +14 -0
  80. package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
  81. package/Libraries/Network/RCTNetworking.js.flow +44 -0
  82. package/Libraries/Network/XMLHttpRequest_new.js +3 -0
  83. package/Libraries/Network/XMLHttpRequest_old.js +3 -0
  84. package/Libraries/Pressability/HoverState.js +1 -0
  85. package/Libraries/Pressability/HoverState.win32.js +1 -0
  86. package/Libraries/Pressability/Pressability.js +2 -2
  87. package/Libraries/Pressability/Pressability.win32.js +3 -3
  88. package/Libraries/ReactNative/FabricUIManager.js +5 -3
  89. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +7 -5
  90. package/Libraries/ReactNative/RendererImplementation.js +3 -5
  91. package/Libraries/ReactNative/requireNativeComponent.js +1 -1
  92. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +12 -0
  93. package/Libraries/Renderer/shims/ReactNativeTypes.js +39 -91
  94. package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +22 -0
  95. package/Libraries/Text/Text.d.ts +1 -1
  96. package/Libraries/Text/Text.js +3 -1
  97. package/Libraries/Text/Text.win32.js +3 -1
  98. package/Libraries/Text/TextNativeComponent.js +1 -1
  99. package/Libraries/Text/TextNativeComponent.win32.js +1 -1
  100. package/Libraries/Text/TextProps.js +124 -84
  101. package/Libraries/Text/TextProps.win32.js +124 -84
  102. package/Libraries/Types/CoreEventTypes.js +1 -1
  103. package/Libraries/Types/CoreEventTypes.win32.js +1 -1
  104. package/Libraries/Types/ReactDevToolsTypes.js +4 -8
  105. package/Libraries/Utilities/BackHandler.js.flow +25 -0
  106. package/Libraries/Utilities/DevSettings.js +14 -0
  107. package/Libraries/Utilities/Dimensions.js +5 -0
  108. package/Libraries/Utilities/Dimensions.win32.js +5 -0
  109. package/{flow/Position.js → Libraries/Utilities/Platform.js.flow} +3 -6
  110. package/Libraries/Utilities/PlatformTypes.js +97 -7
  111. package/Libraries/Utilities/codegenNativeComponent.js +1 -1
  112. package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +2 -4
  113. package/index.win32.js +3 -4
  114. package/overrides.json +24 -24
  115. package/package.json +15 -15
  116. package/src/private/components/HScrollViewNativeComponents.js +1 -1
  117. package/src/private/components/VScrollViewNativeComponents.js +1 -1
  118. package/src/private/featureflags/ReactNativeFeatureFlags.js +11 -6
  119. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +3 -2
  120. package/src/private/inspector/getInspectorDataForViewAtPoint.js +2 -4
  121. package/src/private/setup/setUpDOM.js +36 -1
  122. package/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js +1 -1
  123. package/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js +1 -1
  124. package/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -1
  125. package/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js +1 -1
  126. package/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js +1 -1
  127. package/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js +1 -1
  128. package/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js +1 -1
  129. package/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js +1 -1
  130. package/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js +1 -1
  131. package/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +1 -1
  132. package/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js +1 -1
  133. package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -1
  134. package/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js +1 -1
  135. package/src/private/types/HostComponent.js +16 -0
  136. package/src/private/types/HostInstance.js +50 -0
  137. package/src/private/webapis/dom/nodes/ReactNativeDocument.js +1 -0
  138. package/src/private/webapis/dom/nodes/ReactNativeElement.js +40 -32
  139. package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +1 -1
  140. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +1 -1
  141. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +1 -1
  142. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +4 -4
  143. package/src/private/webapis/mutationobserver/MutationObserver.js +9 -9
  144. package/src/private/webapis/performance/PerformanceObserver.js +6 -6
  145. package/src/types/globals.d.ts +628 -0
  146. package/src-win/Libraries/Text/Text.d.ts +1 -1
  147. package/types/index.d.ts +2 -53
  148. package/types/modules/globals.d.ts +0 -599
@@ -12,12 +12,7 @@
12
12
  // TextInputs. All calls relating to the keyboard should be funneled
13
13
  // through here.
14
14
 
15
- import type {
16
- HostInstance,
17
- MeasureInWindowOnSuccessCallback,
18
- MeasureLayoutOnSuccessCallback,
19
- MeasureOnSuccessCallback,
20
- } from '../../Renderer/shims/ReactNativeTypes';
15
+ import type {HostInstance} from '../../../src/private/types/HostInstance';
21
16
 
22
17
  import {Commands as AndroidTextInputCommands} from '../../Components/TextInput/AndroidTextInputNativeComponent';
23
18
  import {Commands as iOSTextInputCommands} from '../../Components/TextInput/RCTSingelineTextInputNativeComponent';
@@ -27,18 +22,7 @@ const {findNodeHandle} = require('../../ReactNative/RendererProxy');
27
22
  const Platform = require('../../Utilities/Platform').default;
28
23
 
29
24
  let currentlyFocusedInputRef: ?HostInstance = null;
30
- const inputs = new Set<{
31
- blur(): void,
32
- focus(): void,
33
- measure(callback: MeasureOnSuccessCallback): void,
34
- measureInWindow(callback: MeasureInWindowOnSuccessCallback): void,
35
- measureLayout(
36
- relativeToNativeNode: number | HostInstance,
37
- onSuccess: MeasureLayoutOnSuccessCallback,
38
- onFail?: () => void,
39
- ): void,
40
- setNativeProps(nativeProps: {...}): void,
41
- }>();
25
+ const inputs = new Set<HostInstance>();
42
26
 
43
27
  function currentlyFocusedInput(): ?HostInstance {
44
28
  return currentlyFocusedInputRef;
@@ -3,7 +3,7 @@
3
3
  * @format
4
4
  */
5
5
 
6
- import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
6
+ import type {HostComponent} from '../../../src/private/types/HostComponent';
7
7
 
8
8
  import requireNativeComponent from '../../ReactNative/requireNativeComponent';
9
9
  import codegenNativeCommands from '../../Utilities/codegenNativeCommands';
@@ -370,7 +370,7 @@ const LONG_PRESS_ALLOWED_MOVEMENT = 10;
370
370
  *
371
371
  * @lends Touchable.prototype
372
372
  */
373
- const TouchableMixin = {
373
+ const TouchableMixinImpl = {
374
374
  componentDidMount: function () {
375
375
  if (!Platform.isTV) {
376
376
  return;
@@ -946,12 +946,12 @@ const {
946
946
  touchableHandleFocus,
947
947
  touchableHandleBlur,
948
948
  ...TouchableMixinWithoutDefaultFocusAndBlur
949
- } = TouchableMixin;
950
- TouchableMixin.withoutDefaultFocusAndBlur =
949
+ } = TouchableMixinImpl;
950
+ TouchableMixinImpl.withoutDefaultFocusAndBlur =
951
951
  TouchableMixinWithoutDefaultFocusAndBlur;
952
952
 
953
- const Touchable = {
954
- Mixin: TouchableMixin,
953
+ const TouchableImpl = {
954
+ Mixin: TouchableMixinImpl,
955
955
  /**
956
956
  * Renders a debugging overlay to visualize touch target with hitSlop (might not work on Android).
957
957
  */
@@ -960,7 +960,7 @@ const Touchable = {
960
960
  hitSlop,
961
961
  }: {
962
962
  color: ColorValue,
963
- hitSlop: EdgeInsetsProp,
963
+ hitSlop?: EdgeInsetsProp,
964
964
  ...
965
965
  }): null | React.Node => {
966
966
  if (__DEV__) {
@@ -970,4 +970,4 @@ const Touchable = {
970
970
  },
971
971
  };
972
972
 
973
- export default Touchable;
973
+ export default TouchableImpl;
@@ -375,7 +375,7 @@ const LONG_PRESS_ALLOWED_MOVEMENT = 10;
375
375
  *
376
376
  * @lends Touchable.prototype
377
377
  */
378
- const TouchableMixin = {
378
+ const TouchableMixinImpl = {
379
379
  componentDidMount: function () {
380
380
  if (!Platform.isTV) {
381
381
  return;
@@ -951,12 +951,12 @@ const {
951
951
  touchableHandleFocus,
952
952
  touchableHandleBlur,
953
953
  ...TouchableMixinWithoutDefaultFocusAndBlur
954
- } = TouchableMixin;
955
- TouchableMixin.withoutDefaultFocusAndBlur =
954
+ } = TouchableMixinImpl;
955
+ TouchableMixinImpl.withoutDefaultFocusAndBlur =
956
956
  TouchableMixinWithoutDefaultFocusAndBlur;
957
957
 
958
- const Touchable = {
959
- Mixin: TouchableMixin,
958
+ const TouchableImpl = {
959
+ Mixin: TouchableMixinImpl,
960
960
  /**
961
961
  * Renders a debugging overlay to visualize touch target with hitSlop (might not work on Android).
962
962
  */
@@ -965,7 +965,7 @@ const Touchable = {
965
965
  hitSlop,
966
966
  }: {
967
967
  color: ColorValue,
968
- hitSlop: EdgeInsetsProp,
968
+ hitSlop?: EdgeInsetsProp,
969
969
  ...
970
970
  }): null | React.Node => {
971
971
  if (__DEV__) {
@@ -975,4 +975,4 @@ const Touchable = {
975
975
  },
976
976
  };
977
977
 
978
- export default Touchable;
978
+ export default TouchableImpl;
@@ -214,7 +214,7 @@ class TouchableBounce extends React.Component<Props, State> {
214
214
  }
215
215
  }
216
216
 
217
- export default (React.forwardRef((props, hostRef) => (
217
+ export default (React.forwardRef((props, hostRef: React.RefSetter<mixed>) => (
218
218
  <TouchableBounce {...props} hostRef={hostRef} />
219
219
  )): component(
220
220
  ref: React.RefSetter<mixed>,
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  import type {ColorValue} from '../../StyleSheet/StyleSheet';
12
- import typeof TouchableWithoutFeedback from './TouchableWithoutFeedback';
12
+ import type {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback';
13
13
 
14
14
  import View from '../../Components/View/View';
15
15
  import Pressability, {
@@ -32,21 +32,39 @@ type IOSProps = $ReadOnly<{
32
32
  hasTVPreferredFocus?: ?boolean,
33
33
  }>;
34
34
 
35
- type Props = $ReadOnly<{
36
- ...React.ElementConfig<TouchableWithoutFeedback>,
37
- ...AndroidProps,
38
- ...IOSProps,
39
-
35
+ type TouchableHighlightBaseProps = $ReadOnly<{
36
+ /**
37
+ * Determines what the opacity of the wrapped view should be when touch is active.
38
+ */
40
39
  activeOpacity?: ?number,
40
+ /**
41
+ * The color of the underlay that will show through when the touch is active.
42
+ */
41
43
  underlayColor?: ?ColorValue,
44
+ /**
45
+ * @see https://reactnative.dev/docs/view#style
46
+ */
42
47
  style?: ?ViewStyleProp,
48
+ /**
49
+ * Called immediately after the underlay is shown
50
+ */
43
51
  onShowUnderlay?: ?() => void,
52
+ /**
53
+ * Called immediately after the underlay is hidden
54
+ */
44
55
  onHideUnderlay?: ?() => void,
45
56
  testOnly_pressed?: ?boolean,
46
57
 
47
58
  hostRef: React.RefSetter<React.ElementRef<typeof View>>,
48
59
  }>;
49
60
 
61
+ type TouchableHighlightProps = $ReadOnly<{
62
+ ...TouchableWithoutFeedbackProps,
63
+ ...AndroidProps,
64
+ ...IOSProps,
65
+ ...TouchableHighlightBaseProps,
66
+ }>;
67
+
50
68
  type ExtraStyles = $ReadOnly<{
51
69
  child: ViewStyleProp,
52
70
  underlay: ViewStyleProp,
@@ -153,7 +171,10 @@ type State = $ReadOnly<{
153
171
  * ```
154
172
  *
155
173
  */
156
- class TouchableHighlight extends React.Component<Props, State> {
174
+ class TouchableHighlightImpl extends React.Component<
175
+ TouchableHighlightProps,
176
+ State,
177
+ > {
157
178
  _hideTimeout: ?TimeoutID;
158
179
  _isMounted: boolean = false;
159
180
 
@@ -368,7 +389,7 @@ class TouchableHighlight extends React.Component<Props, State> {
368
389
  this.state.pressability.configure(this._createPressabilityConfig());
369
390
  }
370
391
 
371
- componentDidUpdate(prevProps: Props, prevState: State) {
392
+ componentDidUpdate(prevProps: TouchableHighlightProps, prevState: State) {
372
393
  this.state.pressability.configure(this._createPressabilityConfig());
373
394
  }
374
395
 
@@ -381,13 +402,13 @@ class TouchableHighlight extends React.Component<Props, State> {
381
402
  }
382
403
  }
383
404
 
384
- const Touchable: component(
385
- ref: React.RefSetter<React.ElementRef<typeof View>>,
386
- ...props: $ReadOnly<$Diff<Props, {+hostRef: mixed}>>
405
+ const TouchableHighlight: component(
406
+ ref?: React.RefSetter<React.ElementRef<typeof View>>,
407
+ ...props: $ReadOnly<$Diff<TouchableHighlightProps, {+hostRef: mixed}>>
387
408
  ) = React.forwardRef((props, hostRef) => (
388
- <TouchableHighlight {...props} hostRef={hostRef} />
409
+ <TouchableHighlightImpl {...props} hostRef={hostRef} />
389
410
  ));
390
411
 
391
- Touchable.displayName = 'TouchableHighlight';
412
+ TouchableHighlight.displayName = 'TouchableHighlight';
392
413
 
393
- export default Touchable;
414
+ export default TouchableHighlight;
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  import type {GestureResponderEvent} from '../../Types/CoreEventTypes';
12
- import typeof TouchableWithoutFeedback from './TouchableWithoutFeedback';
12
+ import type {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback';
13
13
 
14
14
  import View from '../../Components/View/View';
15
15
  import Pressability, {
@@ -23,61 +23,82 @@ import {Commands} from '../View/ViewNativeComponent';
23
23
  import invariant from 'invariant';
24
24
  import * as React from 'react';
25
25
 
26
- type Props = $ReadOnly<{
27
- ...React.ElementConfig<TouchableWithoutFeedback>,
28
-
26
+ type TVProps = {
29
27
  /**
30
- * Determines the type of background drawable that's going to be used to
31
- * display feedback. It takes an object with `type` property and extra data
32
- * depending on the `type`. It's recommended to use one of the static
33
- * methods to generate that dictionary.
34
- */
35
- background?: ?(
36
- | $ReadOnly<{
37
- type: 'ThemeAttrAndroid',
38
- attribute:
39
- | 'selectableItemBackground'
40
- | 'selectableItemBackgroundBorderless',
41
- rippleRadius: ?number,
42
- }>
43
- | $ReadOnly<{
44
- type: 'RippleAndroid',
45
- color: ?number,
46
- borderless: boolean,
47
- rippleRadius: ?number,
48
- }>
49
- ),
50
-
51
- /**
52
- * TV preferred focus (see documentation for the View component).
28
+ * *(Apple TV only)* TV preferred focus (see documentation for the View component).
29
+ *
30
+ * @platform ios
53
31
  */
54
32
  hasTVPreferredFocus?: ?boolean,
55
33
 
56
34
  /**
57
- * TV next focus down (see documentation for the View component).
35
+ * Designates the next view to receive focus when the user navigates down. See the Android documentation.
36
+ *
37
+ * @platform android
58
38
  */
59
39
  nextFocusDown?: ?number,
60
40
 
61
41
  /**
62
- * TV next focus forward (see documentation for the View component).
42
+ * Designates the next view to receive focus when the user navigates forward. See the Android documentation.
43
+ *
44
+ * @platform android
63
45
  */
64
46
  nextFocusForward?: ?number,
65
47
 
66
48
  /**
67
- * TV next focus left (see documentation for the View component).
49
+ * Designates the next view to receive focus when the user navigates left. See the Android documentation.
50
+ *
51
+ * @platform android
68
52
  */
69
53
  nextFocusLeft?: ?number,
70
54
 
71
55
  /**
72
- * TV next focus right (see documentation for the View component).
56
+ * Designates the next view to receive focus when the user navigates right. See the Android documentation.
57
+ *
58
+ * @platform android
73
59
  */
74
60
  nextFocusRight?: ?number,
75
61
 
76
62
  /**
77
- * TV next focus up (see documentation for the View component).
63
+ * Designates the next view to receive focus when the user navigates up. See the Android documentation.
64
+ *
65
+ * @platform android
78
66
  */
79
67
  nextFocusUp?: ?number,
68
+ };
80
69
 
70
+ export type TouchableNativeFeedbackProps = $ReadOnly<{
71
+ ...TouchableWithoutFeedbackProps,
72
+ ...TVProps,
73
+ /**
74
+ * Determines the type of background drawable that's going to be used to display feedback.
75
+ * It takes an object with type property and extra data depending on the type.
76
+ * It's recommended to use one of the following static methods to generate that dictionary:
77
+ * 1) TouchableNativeFeedback.SelectableBackground() - will create object that represents android theme's
78
+ * default background for selectable elements (?android:attr/selectableItemBackground)
79
+ * 2) TouchableNativeFeedback.SelectableBackgroundBorderless() - will create object that represent android
80
+ * theme's default background for borderless selectable elements
81
+ * (?android:attr/selectableItemBackgroundBorderless). Available on android API level 21+
82
+ * 3) TouchableNativeFeedback.Ripple(color, borderless) - will create object that represents ripple drawable
83
+ * with specified color (as a string). If property borderless evaluates to true the ripple will render
84
+ * outside of the view bounds (see native actionbar buttons as an example of that behavior). This background
85
+ * type is available on Android API level 21+
86
+ */
87
+ background?: ?(
88
+ | $ReadOnly<{
89
+ type: 'ThemeAttrAndroid',
90
+ attribute:
91
+ | 'selectableItemBackground'
92
+ | 'selectableItemBackgroundBorderless',
93
+ rippleRadius: ?number,
94
+ }>
95
+ | $ReadOnly<{
96
+ type: 'RippleAndroid',
97
+ color: ?number,
98
+ borderless: boolean,
99
+ rippleRadius: ?number,
100
+ }>
101
+ ),
81
102
  /**
82
103
  * Set to true to add the ripple effect to the foreground of the view, instead
83
104
  * of the background. This is useful if one of your child views has a
@@ -95,50 +116,74 @@ type State = $ReadOnly<{
95
116
  pressability: Pressability,
96
117
  }>;
97
118
 
98
- class TouchableNativeFeedback extends React.Component<Props, State> {
119
+ /**
120
+ * A wrapper for making views respond properly to touches (Android only).
121
+ * On Android this component uses native state drawable to display touch feedback.
122
+ * At the moment it only supports having a single View instance as a child node,
123
+ * as it's implemented by replacing that View with another instance of RCTView node with some additional properties set.
124
+ *
125
+ * Background drawable of native feedback touchable can be customized with background property.
126
+ *
127
+ * @see https://reactnative.dev/docs/touchablenativefeedback#content
128
+ */
129
+ class TouchableNativeFeedback extends React.Component<
130
+ TouchableNativeFeedbackProps,
131
+ State,
132
+ > {
99
133
  /**
100
- * Creates a value for the `background` prop that uses the Android theme's
101
- * default background for selectable elements.
134
+ * Creates an object that represents android theme's default background for
135
+ * selectable elements (?android:attr/selectableItemBackground).
136
+ *
137
+ * @param rippleRadius The radius of ripple effect
102
138
  */
103
- static SelectableBackground: (rippleRadius: ?number) => $ReadOnly<{
139
+ static SelectableBackground: (rippleRadius?: ?number) => $ReadOnly<{
104
140
  attribute: 'selectableItemBackground',
105
141
  type: 'ThemeAttrAndroid',
106
142
  rippleRadius: ?number,
107
- }> = (rippleRadius: ?number) => ({
143
+ }> = (rippleRadius?: ?number) => ({
108
144
  type: 'ThemeAttrAndroid',
109
145
  attribute: 'selectableItemBackground',
110
146
  rippleRadius,
111
147
  });
112
148
 
113
149
  /**
114
- * Creates a value for the `background` prop that uses the Android theme's
115
- * default background for borderless selectable elements. Requires API 21+.
150
+ * Creates an object that represent android theme's default background for borderless
151
+ * selectable elements (?android:attr/selectableItemBackgroundBorderless).
152
+ * Available on android API level 21+.
153
+ *
154
+ * @param rippleRadius The radius of ripple effect
116
155
  */
117
- static SelectableBackgroundBorderless: (rippleRadius: ?number) => $ReadOnly<{
156
+ static SelectableBackgroundBorderless: (rippleRadius?: ?number) => $ReadOnly<{
118
157
  attribute: 'selectableItemBackgroundBorderless',
119
158
  type: 'ThemeAttrAndroid',
120
159
  rippleRadius: ?number,
121
- }> = (rippleRadius: ?number) => ({
160
+ }> = (rippleRadius?: ?number) => ({
122
161
  type: 'ThemeAttrAndroid',
123
162
  attribute: 'selectableItemBackgroundBorderless',
124
163
  rippleRadius,
125
164
  });
126
165
 
127
166
  /**
128
- * Creates a value for the `background` prop that uses the Android ripple with
129
- * the supplied color. If `borderless` is true, the ripple will render outside
130
- * of the view bounds. Requires API 21+.
167
+ * Creates an object that represents ripple drawable with specified color (as a
168
+ * string). If property `borderless` evaluates to true the ripple will
169
+ * render outside of the view bounds (see native actionbar buttons as an
170
+ * example of that behavior). This background type is available on Android
171
+ * API level 21+.
172
+ *
173
+ * @param color The ripple color
174
+ * @param borderless If the ripple can render outside it's bounds
175
+ * @param rippleRadius The radius of ripple effect
131
176
  */
132
177
  static Ripple: (
133
178
  color: string,
134
179
  borderless: boolean,
135
- rippleRadius: ?number,
180
+ rippleRadius?: ?number,
136
181
  ) => $ReadOnly<{
137
182
  borderless: boolean,
138
183
  color: ?number,
139
184
  rippleRadius: ?number,
140
185
  type: 'RippleAndroid',
141
- }> = (color: string, borderless: boolean, rippleRadius: ?number) => {
186
+ }> = (color: string, borderless: boolean, rippleRadius?: ?number) => {
142
187
  const processedColor = processColor(color);
143
188
  invariant(
144
189
  processedColor == null || typeof processedColor === 'number',
@@ -336,7 +381,10 @@ class TouchableNativeFeedback extends React.Component<Props, State> {
336
381
  );
337
382
  }
338
383
 
339
- componentDidUpdate(prevProps: Props, prevState: State) {
384
+ componentDidUpdate(
385
+ prevProps: TouchableNativeFeedbackProps,
386
+ prevState: State,
387
+ ) {
340
388
  this.state.pressability.configure(this._createPressabilityConfig());
341
389
  }
342
390