@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
@@ -9,17 +9,11 @@
9
9
  */
10
10
 
11
11
  import type {
12
+ GestureResponderEvent,
12
13
  LayoutChangeEvent,
13
14
  MouseEvent,
14
- GestureResponderEvent,
15
15
  } from '../../Types/CoreEventTypes';
16
- import type {
17
- AccessibilityActionEvent,
18
- AccessibilityActionInfo,
19
- AccessibilityRole,
20
- AccessibilityState,
21
- AccessibilityValue,
22
- } from '../View/ViewAccessibility';
16
+ import type {ViewProps} from '../View/ViewPropTypes';
23
17
 
24
18
  import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
25
19
  import usePressability from '../../Pressability/usePressability';
@@ -27,59 +21,18 @@ import {type RectOrSize} from '../../StyleSheet/Rect';
27
21
  import useMergeRefs from '../../Utilities/useMergeRefs';
28
22
  import View from '../View/View';
29
23
  import useAndroidRippleForView, {
30
- type RippleConfig,
24
+ type PressableAndroidRippleConfig,
31
25
  } from './useAndroidRippleForView';
32
26
  import * as React from 'react';
33
27
  import {useMemo, useRef, useState} from 'react';
34
28
 
35
29
  type ViewStyleProp = $ElementType<React.ElementConfig<typeof View>, 'style'>;
36
30
 
37
- export type StateCallbackType = $ReadOnly<{
31
+ export type PressableStateCallbackType = $ReadOnly<{
38
32
  pressed: boolean,
39
33
  }>;
40
34
 
41
- type Props = $ReadOnly<{
42
- /**
43
- * Accessibility.
44
- */
45
- accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
46
- accessibilityElementsHidden?: ?boolean,
47
- accessibilityHint?: ?Stringish,
48
- accessibilityLanguage?: ?Stringish,
49
- accessibilityIgnoresInvertColors?: ?boolean,
50
- accessibilityLabel?: ?Stringish,
51
- accessibilityLiveRegion?: ?('none' | 'polite' | 'assertive'),
52
- accessibilityRole?: ?AccessibilityRole,
53
- accessibilityState?: ?AccessibilityState,
54
- accessibilityValue?: ?AccessibilityValue,
55
- 'aria-valuemax'?: AccessibilityValue['max'],
56
- 'aria-valuemin'?: AccessibilityValue['min'],
57
- 'aria-valuenow'?: AccessibilityValue['now'],
58
- 'aria-valuetext'?: AccessibilityValue['text'],
59
- accessibilityViewIsModal?: ?boolean,
60
- 'aria-modal'?: ?boolean,
61
- accessible?: ?boolean,
62
-
63
- /**
64
- * alias for accessibilityState
65
- *
66
- * see https://reactnative.dev/docs/accessibility#accessibilitystate
67
- */
68
- 'aria-busy'?: ?boolean,
69
- 'aria-checked'?: ?boolean | 'mixed',
70
- 'aria-disabled'?: ?boolean,
71
- 'aria-expanded'?: ?boolean,
72
- 'aria-selected'?: ?boolean,
73
- /**
74
- * A value indicating whether the accessibility elements contained within
75
- * this accessibility element are hidden.
76
- */
77
- 'aria-hidden'?: ?boolean,
78
- 'aria-live'?: ?('polite' | 'assertive' | 'off'),
79
- focusable?: ?boolean,
80
- importantForAccessibility?: ?('auto' | 'yes' | 'no' | 'no-hide-descendants'),
81
- onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
82
-
35
+ type PressableBaseProps = $ReadOnly<{
83
36
  /**
84
37
  * Whether a press gesture can be interrupted by a parent gesture such as a
85
38
  * scroll event. Defaults to true.
@@ -90,7 +43,7 @@ type Props = $ReadOnly<{
90
43
  * Either children or a render prop that receives a boolean reflecting whether
91
44
  * the component is currently pressed.
92
45
  */
93
- children: React.Node | ((state: StateCallbackType) => React.Node),
46
+ children: React.Node | ((state: PressableStateCallbackType) => React.Node),
94
47
 
95
48
  /**
96
49
  * Duration to wait after hover in before calling `onHoverIn`.
@@ -162,7 +115,9 @@ type Props = $ReadOnly<{
162
115
  * Either view styles or a function that receives a boolean reflecting whether
163
116
  * the component is currently pressed and returns view styles.
164
117
  */
165
- style?: ViewStyleProp | ((state: StateCallbackType) => ViewStyleProp),
118
+ style?:
119
+ | ViewStyleProp
120
+ | ((state: PressableStateCallbackType) => ViewStyleProp),
166
121
 
167
122
  /**
168
123
  * Identifier used to find this view in tests.
@@ -177,7 +132,7 @@ type Props = $ReadOnly<{
177
132
  /**
178
133
  * Enables the Android ripple effect and configures its color.
179
134
  */
180
- android_ripple?: ?RippleConfig,
135
+ android_ripple?: ?PressableAndroidRippleConfig,
181
136
 
182
137
  /**
183
138
  * Used only for documentation or testing (e.g. snapshot testing).
@@ -188,11 +143,11 @@ type Props = $ReadOnly<{
188
143
  * Duration to wait after press down before calling `onPressIn`.
189
144
  */
190
145
  unstable_pressDelay?: ?number,
191
- /**
192
- * Web to Native Accessibility props
193
- * https://github.com/facebook/react-native/issues/34424
194
- */
195
- 'aria-label'?: ?string,
146
+ }>;
147
+
148
+ export type PressableProps = $ReadOnly<{
149
+ ...ViewProps,
150
+ ...PressableBaseProps,
196
151
  }>;
197
152
 
198
153
  type Instance = React.ElementRef<typeof View>;
@@ -202,7 +157,7 @@ type Instance = React.ElementRef<typeof View>;
202
157
  * component is currently pressed or not.
203
158
  */
204
159
  function Pressable(
205
- props: Props,
160
+ props: PressableProps,
206
161
  forwardedRef: React.RefSetter<Instance>,
207
162
  ): React.Node {
208
163
  const {
@@ -364,6 +319,6 @@ const MemoedPressable = React.memo(React.forwardRef(Pressable));
364
319
  MemoedPressable.displayName = 'Pressable';
365
320
 
366
321
  export default (MemoedPressable: component(
367
- ref: React.RefSetter<React.ElementRef<typeof View>>,
368
- ...props: Props
322
+ ref?: React.RefSetter<React.ElementRef<typeof View>>,
323
+ ...props: PressableProps
369
324
  ));
@@ -9,28 +9,23 @@
9
9
  */
10
10
 
11
11
  import type {
12
+ GestureResponderEvent,
12
13
  LayoutChangeEvent,
13
14
  MouseEvent,
14
- GestureResponderEvent,
15
15
  // [Windows
16
16
  BlurEvent,
17
17
  FocusEvent,
18
18
  KeyEvent, // Windows]
19
19
  } from '../../Types/CoreEventTypes';
20
- import type {
21
- AccessibilityActionEvent,
22
- AccessibilityActionInfo,
23
- AccessibilityRole,
24
- AccessibilityState,
25
- AccessibilityValue,
26
- } from '../View/ViewAccessibility';
20
+
21
+ import type {ViewProps} from '../View/ViewPropTypes';
27
22
 
28
23
  import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
29
24
  import usePressability from '../../Pressability/usePressability';
30
25
  import {type RectOrSize} from '../../StyleSheet/Rect';
31
26
  import useMergeRefs from '../../Utilities/useMergeRefs';
32
27
  import useAndroidRippleForView, {
33
- type RippleConfig,
28
+ type PressableAndroidRippleConfig,
34
29
  } from './useAndroidRippleForView';
35
30
  import * as React from 'react';
36
31
  import {useMemo, useRef, useState} from 'react';
@@ -39,54 +34,11 @@ import View from '../View/View';
39
34
 
40
35
  type ViewStyleProp = $ElementType<React.ElementConfig<typeof View>, 'style'>;
41
36
 
42
- export type StateCallbackType = $ReadOnly<{
37
+ export type PressableStateCallbackType = $ReadOnly<{
43
38
  pressed: boolean,
44
39
  }>;
45
40
 
46
- type Props = $ReadOnly<{
47
- /**
48
- * Accessibility.
49
- */
50
- accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
51
- accessibilityElementsHidden?: ?boolean,
52
- accessibilityHint?: ?Stringish,
53
- accessibilityLanguage?: ?Stringish,
54
- accessibilityIgnoresInvertColors?: ?boolean,
55
- accessibilityLabel?: ?Stringish,
56
- accessibilityLiveRegion?: ?('none' | 'polite' | 'assertive'),
57
- accessibilityRole?: ?AccessibilityRole,
58
- accessibilityState?: ?AccessibilityState,
59
- accessibilityValue?: ?AccessibilityValue,
60
- 'aria-valuemax'?: AccessibilityValue['max'],
61
- 'aria-valuemin'?: AccessibilityValue['min'],
62
- 'aria-valuenow'?: AccessibilityValue['now'],
63
- 'aria-valuetext'?: AccessibilityValue['text'],
64
- accessibilityViewIsModal?: ?boolean,
65
- 'aria-modal'?: ?boolean,
66
- accessible?: ?boolean,
67
-
68
- /**
69
- * alias for accessibilityState
70
- *
71
- * see https://reactnative.dev/docs/accessibility#accessibilitystate
72
- */
73
- 'aria-busy'?: ?boolean,
74
- 'aria-checked'?: ?boolean | 'mixed',
75
- 'aria-disabled'?: ?boolean,
76
- 'aria-expanded'?: ?boolean,
77
- 'aria-selected'?: ?boolean,
78
- 'aria-multiselectable'?: ?boolean, // Win32
79
- 'aria-required'?: ?boolean, // Win32
80
- /**
81
- * A value indicating whether the accessibility elements contained within
82
- * this accessibility element are hidden.
83
- */
84
- 'aria-hidden'?: ?boolean,
85
- 'aria-live'?: ?('polite' | 'assertive' | 'off'),
86
- focusable?: ?boolean,
87
- importantForAccessibility?: ?('auto' | 'yes' | 'no' | 'no-hide-descendants'),
88
- onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
89
-
41
+ type PressableBaseProps = $ReadOnly<{
90
42
  /**
91
43
  * Whether a press gesture can be interrupted by a parent gesture such as a
92
44
  * scroll event. Defaults to true.
@@ -97,7 +49,7 @@ type Props = $ReadOnly<{
97
49
  * Either children or a render prop that receives a boolean reflecting whether
98
50
  * the component is currently pressed.
99
51
  */
100
- children: React.Node | ((state: StateCallbackType) => React.Node),
52
+ children: React.Node | ((state: PressableStateCallbackType) => React.Node),
101
53
 
102
54
  /**
103
55
  * Duration to wait after hover in before calling `onHoverIn`.
@@ -209,7 +161,9 @@ type Props = $ReadOnly<{
209
161
  * Either view styles or a function that receives a boolean reflecting whether
210
162
  * the component is currently pressed and returns view styles.
211
163
  */
212
- style?: ViewStyleProp | ((state: StateCallbackType) => ViewStyleProp),
164
+ style?:
165
+ | ViewStyleProp
166
+ | ((state: PressableStateCallbackType) => ViewStyleProp),
213
167
 
214
168
  /**
215
169
  * Identifier used to find this view in tests.
@@ -224,7 +178,7 @@ type Props = $ReadOnly<{
224
178
  /**
225
179
  * Enables the Android ripple effect and configures its color.
226
180
  */
227
- android_ripple?: ?RippleConfig,
181
+ android_ripple?: ?PressableAndroidRippleConfig,
228
182
 
229
183
  /**
230
184
  * Used only for documentation or testing (e.g. snapshot testing).
@@ -235,11 +189,11 @@ type Props = $ReadOnly<{
235
189
  * Duration to wait after press down before calling `onPressIn`.
236
190
  */
237
191
  unstable_pressDelay?: ?number,
238
- /**
239
- * Web to Native Accessibility props
240
- * https://github.com/facebook/react-native/issues/34424
241
- */
242
- 'aria-label'?: ?string,
192
+ }>;
193
+
194
+ export type PressableProps = $ReadOnly<{
195
+ ...ViewProps,
196
+ ...PressableBaseProps,
243
197
  }>;
244
198
 
245
199
  type Instance = React.ElementRef<typeof View>;
@@ -249,7 +203,7 @@ type Instance = React.ElementRef<typeof View>;
249
203
  * component is currently pressed or not.
250
204
  */
251
205
  function Pressable(
252
- props: Props,
206
+ props: PressableProps,
253
207
  forwardedRef: React.RefSetter<Instance>,
254
208
  ): React.Node {
255
209
  const {
@@ -432,6 +386,6 @@ const MemoedPressable = React.memo(React.forwardRef(Pressable));
432
386
  MemoedPressable.displayName = 'Pressable';
433
387
 
434
388
  export default (MemoedPressable: component(
435
- ref: React.RefSetter<React.ElementRef<typeof View>>,
436
- ...props: Props
389
+ ref?: React.RefSetter<React.ElementRef<typeof View>>,
390
+ ...props: PressableProps
437
391
  ));
@@ -26,7 +26,7 @@ type NativeBackgroundProp = $ReadOnly<{
26
26
  rippleRadius: ?number,
27
27
  }>;
28
28
 
29
- export type RippleConfig = {
29
+ export type PressableAndroidRippleConfig = {
30
30
  color?: ColorValue,
31
31
  borderless?: boolean,
32
32
  radius?: number,
@@ -38,7 +38,7 @@ export type RippleConfig = {
38
38
  * supported versions of Android.
39
39
  */
40
40
  export default function useAndroidRippleForView(
41
- rippleConfig: ?RippleConfig,
41
+ rippleConfig: ?PressableAndroidRippleConfig,
42
42
  viewRef: {current: null | React.ElementRef<typeof View>},
43
43
  ): ?$ReadOnly<{
44
44
  onPressIn: (event: GestureResponderEvent) => void,
@@ -8,52 +8,13 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import type {ColorValue} from '../../StyleSheet/StyleSheet';
12
- import type {ViewProps} from '../View/ViewPropTypes';
11
+ import type {ProgressBarAndroidProps} from './ProgressBarAndroidTypes';
13
12
 
14
13
  import ProgressBarAndroidNativeComponent from './ProgressBarAndroidNativeComponent';
15
14
 
16
15
  const React = require('react');
17
16
 
18
- export type ProgressBarAndroidProps = $ReadOnly<{
19
- ...ViewProps,
20
-
21
- /**
22
- * Style of the ProgressBar and whether it shows indeterminate progress (e.g. spinner).
23
- *
24
- * `indeterminate` can only be false if `styleAttr` is Horizontal, and requires a
25
- * `progress` value.
26
- */
27
- ...
28
- | {
29
- styleAttr: 'Horizontal',
30
- indeterminate: false,
31
- progress: number,
32
- }
33
- | {
34
- typeAttr:
35
- | 'Horizontal'
36
- | 'Normal'
37
- | 'Small'
38
- | 'Large'
39
- | 'Inverse'
40
- | 'SmallInverse'
41
- | 'LargeInverse',
42
- indeterminate: true,
43
- },
44
- /**
45
- * Whether to show the ProgressBar (true, the default) or hide it (false).
46
- */
47
- animating?: ?boolean,
48
- /**
49
- * Color of the progress bar.
50
- */
51
- color?: ?ColorValue,
52
- /**
53
- * Used to locate this view in end-to-end tests.
54
- */
55
- testID?: ?string,
56
- }>;
17
+ export type {ProgressBarAndroidProps};
57
18
 
58
19
  /**
59
20
  * React component that wraps the Android-only `ProgressBar`. This component is
@@ -79,7 +40,7 @@ export type ProgressBarAndroidProps = $ReadOnly<{
79
40
  * ```
80
41
  */
81
42
  const ProgressBarAndroidWithForwardedRef: component(
82
- ref: React.RefSetter<
43
+ ref?: React.RefSetter<
83
44
  React.ElementRef<typeof ProgressBarAndroidNativeComponent>,
84
45
  >,
85
46
  ...props: ProgressBarAndroidProps
@@ -106,7 +67,4 @@ const ProgressBarAndroidWithForwardedRef: component(
106
67
  );
107
68
  });
108
69
 
109
- export default /* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an
110
- * error found when Flow v0.89 was deployed. To see the error, delete this
111
- * comment and run Flow. */
112
- (ProgressBarAndroidWithForwardedRef: typeof ProgressBarAndroidNativeComponent);
70
+ export default ProgressBarAndroidWithForwardedRef;
@@ -10,9 +10,15 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import typeof UnimplementedViewType from '../UnimplementedViews/UnimplementedView';
14
13
  import typeof ProgressBarAndroidNativeComponentType from './ProgressBarAndroidNativeComponent';
14
+ import type {ProgressBarAndroidProps} from './ProgressBarAndroidTypes';
15
15
 
16
- export default require('../UnimplementedViews/UnimplementedView').default as
17
- | UnimplementedViewType
18
- | ProgressBarAndroidNativeComponentType;
16
+ export type {ProgressBarAndroidProps};
17
+
18
+ export default require('../UnimplementedViews/UnimplementedView')
19
+ .default as $FlowFixMe as component(
20
+ ref?: React.RefSetter<
21
+ React.ElementRef<ProgressBarAndroidNativeComponentType>,
22
+ >,
23
+ ...props: ProgressBarAndroidProps
24
+ );
@@ -0,0 +1,54 @@
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 {ColorValue} from '../../StyleSheet/StyleSheet';
12
+ import type {ViewProps} from '../View/ViewPropTypes';
13
+
14
+ /**
15
+ * Style of the ProgressBar and whether it shows indeterminate progress (e.g. spinner).
16
+ *
17
+ * `indeterminate` can only be false if `styleAttr` is Horizontal, and requires a
18
+ * `progress` value.
19
+ */
20
+ type ProgressBarAndroidStyleAttrProp =
21
+ | {
22
+ styleAttr: 'Horizontal',
23
+ indeterminate: false,
24
+ progress: number,
25
+ }
26
+ | {
27
+ styleAttr:
28
+ | 'Horizontal'
29
+ | 'Normal'
30
+ | 'Small'
31
+ | 'Large'
32
+ | 'Inverse'
33
+ | 'SmallInverse'
34
+ | 'LargeInverse',
35
+ indeterminate: true,
36
+ };
37
+
38
+ export type ProgressBarAndroidProps = $ReadOnly<{
39
+ ...ViewProps,
40
+ ...ProgressBarAndroidStyleAttrProp,
41
+
42
+ /**
43
+ * Whether to show the ProgressBar (true, the default) or hide it (false).
44
+ */
45
+ animating?: ?boolean,
46
+ /**
47
+ * Color of the progress bar.
48
+ */
49
+ color?: ?ColorValue,
50
+ /**
51
+ * Used to locate this view in end-to-end tests.
52
+ */
53
+ testID?: ?string,
54
+ }>;
@@ -21,7 +21,7 @@ import React from 'react';
21
21
 
22
22
  const Platform = require('../../Utilities/Platform').default;
23
23
 
24
- type IOSProps = $ReadOnly<{
24
+ export type RefreshControlPropsIOS = $ReadOnly<{
25
25
  /**
26
26
  * The color of the refresh indicator.
27
27
  */
@@ -36,7 +36,7 @@ type IOSProps = $ReadOnly<{
36
36
  title?: ?string,
37
37
  }>;
38
38
 
39
- type AndroidProps = $ReadOnly<{
39
+ export type RefreshControlPropsAndroid = $ReadOnly<{
40
40
  /**
41
41
  * Whether the pull to refresh functionality is enabled.
42
42
  */
@@ -55,11 +55,7 @@ type AndroidProps = $ReadOnly<{
55
55
  size?: ?('default' | 'large'),
56
56
  }>;
57
57
 
58
- export type RefreshControlProps = $ReadOnly<{
59
- ...ViewProps,
60
- ...IOSProps,
61
- ...AndroidProps,
62
-
58
+ type RefreshControlBaseProps = $ReadOnly<{
63
59
  /**
64
60
  * Called when the view starts refreshing.
65
61
  */
@@ -76,6 +72,13 @@ export type RefreshControlProps = $ReadOnly<{
76
72
  progressViewOffset?: ?number,
77
73
  }>;
78
74
 
75
+ export type RefreshControlProps = $ReadOnly<{
76
+ ...ViewProps,
77
+ ...RefreshControlPropsIOS,
78
+ ...RefreshControlPropsAndroid,
79
+ ...RefreshControlBaseProps,
80
+ }>;
81
+
79
82
  /**
80
83
  * This component is used inside a ScrollView or ListView to add pull to refresh
81
84
  * functionality. When the ScrollView is at `scrollY: 0`, swiping down
@@ -9,7 +9,8 @@
9
9
  */
10
10
 
11
11
  'use strict';
12
- import type {HostComponent} from '../../../Renderer/shims/ReactNativeTypes';
12
+
13
+ import type {HostComponent} from '../../../../src/private/types/HostComponent';
13
14
 
14
15
  import requireNativeComponent from '../../../ReactNative/requireNativeComponent';
15
16
  import * as React from 'react';
@@ -24,7 +24,7 @@ import * as React from 'react';
24
24
  * sensor housing area on iPhone X).
25
25
  */
26
26
  const exported: component(
27
- ref: React.RefSetter<React.ElementRef<typeof View>>,
27
+ ref?: React.RefSetter<React.ElementRef<typeof View>>,
28
28
  ...props: ViewProps
29
29
  ) = Platform.select({
30
30
  ios: require('./RCTSafeAreaViewNativeComponent').default,
@@ -24,7 +24,7 @@ import * as React from 'react';
24
24
  * sensor housing area on iPhone X).
25
25
  */
26
26
  const exported: component(
27
- ref: React.RefSetter<React.ElementRef<typeof View>>,
27
+ ref?: React.RefSetter<React.ElementRef<typeof View>>,
28
28
  ...props: ViewProps
29
29
  ) = Platform.select({
30
30
  ios: require('./RCTSafeAreaViewNativeComponent').default,
@@ -8,10 +8,8 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import type {
12
- HostComponent,
13
- PartialViewConfig,
14
- } from '../../Renderer/shims/ReactNativeTypes';
11
+ import type {HostComponent} from '../../../src/private/types/HostComponent';
12
+ import type {PartialViewConfig} from '../../Renderer/shims/ReactNativeTypes';
15
13
  import type {ScrollViewNativeProps as Props} from './ScrollViewNativeComponentType';
16
14
 
17
15
  import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry';
@@ -8,10 +8,8 @@
8
8
  * @flow strict-local
9
9
  */
10
10
 
11
- import type {
12
- HostComponent,
13
- PartialViewConfig,
14
- } from '../../Renderer/shims/ReactNativeTypes';
11
+ import type {HostComponent} from '../../../src/private/types/HostComponent';
12
+ import type {PartialViewConfig} from '../../Renderer/shims/ReactNativeTypes';
15
13
  import type {ViewProps as Props} from '../View/ViewPropTypes';
16
14
 
17
15
  import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry';