@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
@@ -8,21 +8,21 @@
8
8
  * @flow strict-local
9
9
  */
10
10
 
11
- import type {HostInstance} from '../../Renderer/shims/ReactNativeTypes';
11
+ import type {HostInstance} from '../../../src/private/types/HostInstance';
12
12
  import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType';
13
13
  import type {PointProp} from '../../StyleSheet/PointPropType';
14
14
  import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
15
15
  import type {ColorValue} from '../../StyleSheet/StyleSheet';
16
16
  import type {
17
- LayoutChangeEvent,
18
17
  GestureResponderEvent,
18
+ LayoutChangeEvent,
19
19
  ScrollEvent,
20
20
  } from '../../Types/CoreEventTypes';
21
21
  import type {EventSubscription} from '../../vendor/emitter/EventEmitter';
22
22
  import type {KeyboardEvent, KeyboardMetrics} from '../Keyboard/Keyboard';
23
23
  import typeof View from '../View/View';
24
24
  import type {ViewProps} from '../View/ViewPropTypes';
25
- import type {Props as ScrollViewStickyHeaderProps} from './ScrollViewStickyHeader';
25
+ import type {ScrollViewStickyHeaderProps} from './ScrollViewStickyHeader';
26
26
 
27
27
  import {
28
28
  HScrollContentViewNativeComponent,
@@ -126,34 +126,39 @@ import * as React from 'react';
126
126
  * this.props.onKeyboardDidHide
127
127
  */
128
128
 
129
+ export interface ScrollViewScrollToOptions {
130
+ x?: number;
131
+ y?: number;
132
+ animated?: boolean;
133
+ }
134
+
129
135
  // Public methods for ScrollView
130
- export type ScrollViewImperativeMethods = $ReadOnly<{
131
- getScrollResponder: $PropertyType<ScrollView, 'getScrollResponder'>,
132
- getScrollableNode: $PropertyType<ScrollView, 'getScrollableNode'>,
133
- getInnerViewNode: $PropertyType<ScrollView, 'getInnerViewNode'>,
134
- getInnerViewRef: $PropertyType<ScrollView, 'getInnerViewRef'>,
135
- getNativeScrollRef: $PropertyType<ScrollView, 'getNativeScrollRef'>,
136
- scrollTo: $PropertyType<ScrollView, 'scrollTo'>,
137
- scrollToEnd: $PropertyType<ScrollView, 'scrollToEnd'>,
138
- flashScrollIndicators: $PropertyType<ScrollView, 'flashScrollIndicators'>,
139
- scrollResponderZoomTo: $PropertyType<ScrollView, 'scrollResponderZoomTo'>,
140
- scrollResponderScrollNativeHandleToKeyboard: $PropertyType<
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<
141
147
  ScrollView,
142
148
  'scrollResponderScrollNativeHandleToKeyboard',
143
- >,
144
- }>;
149
+ >;
150
+ }
145
151
 
146
152
  export type DecelerationRateType = 'fast' | 'normal' | number;
147
153
  export type ScrollResponderType = ScrollViewImperativeMethods;
148
154
 
149
- type PublicScrollViewInstance = $ReadOnly<{
150
- ...HostInstance,
151
- ...ScrollViewImperativeMethods,
152
- }>;
155
+ export interface PublicScrollViewInstance
156
+ extends HostInstance,
157
+ ScrollViewImperativeMethods {}
153
158
 
154
159
  type InnerViewInstance = React.ElementRef<View>;
155
160
 
156
- type IOSProps = $ReadOnly<{
161
+ export type ScrollViewPropsIOS = $ReadOnly<{
157
162
  /**
158
163
  * Controls whether iOS should automatically adjust the content inset
159
164
  * for scroll views that are placed behind a navigation bar or
@@ -309,7 +314,7 @@ type IOSProps = $ReadOnly<{
309
314
  ),
310
315
  }>;
311
316
 
312
- type AndroidProps = $ReadOnly<{
317
+ export type ScrollViewPropsAndroid = $ReadOnly<{
313
318
  /**
314
319
  * Enables nested scrolling for Android API level 21+.
315
320
  * Nested scrolling is supported by default on iOS
@@ -371,10 +376,10 @@ type StickyHeaderComponentType = component(
371
376
  ...ScrollViewStickyHeaderProps
372
377
  );
373
378
 
374
- export type Props = $ReadOnly<{
379
+ export type ScrollViewProps = $ReadOnly<{
375
380
  ...ViewProps,
376
- ...IOSProps,
377
- ...AndroidProps,
381
+ ...ScrollViewPropsIOS,
382
+ ...ScrollViewPropsAndroid,
378
383
 
379
384
  /**
380
385
  * These styles will be applied to the scroll view content container which
@@ -638,7 +643,7 @@ export type Props = $ReadOnly<{
638
643
  */
639
644
  /* $FlowFixMe[unclear-type] - how to handle generic type without existential
640
645
  * operator? */
641
- refreshControl?: ?ExactReactElement_DEPRECATED<any>,
646
+ refreshControl?: ?React.Node,
642
647
  children?: React.Node,
643
648
  /**
644
649
  * A ref to the inner View element of the ScrollView. This should be used
@@ -698,10 +703,10 @@ export type ScrollViewComponentStatics = $ReadOnly<{
698
703
  * multiple columns, infinite scroll loading, or any number of other features it
699
704
  * supports out of the box.
700
705
  */
701
- class ScrollView extends React.Component<Props, State> {
706
+ class ScrollView extends React.Component<ScrollViewProps, State> {
702
707
  static Context: typeof ScrollViewContext = ScrollViewContext;
703
708
 
704
- constructor(props: Props) {
709
+ constructor(props: ScrollViewProps) {
705
710
  super(props);
706
711
 
707
712
  this._scrollAnimatedValue = new AnimatedImplementation.Value(
@@ -779,7 +784,7 @@ class ScrollView extends React.Component<Props, State> {
779
784
  this._updateAnimatedNodeAttachment();
780
785
  }
781
786
 
782
- componentDidUpdate(prevProps: Props) {
787
+ componentDidUpdate(prevProps: ScrollViewProps) {
783
788
  const prevContentInsetTop = prevProps.contentInset
784
789
  ? prevProps.contentInset.top
785
790
  : 0;
@@ -851,28 +856,10 @@ class ScrollView extends React.Component<Props, State> {
851
856
  * This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED.
852
857
  */
853
858
  scrollTo: (
854
- options?:
855
- | {
856
- x?: number,
857
- y?: number,
858
- animated?: boolean,
859
- ...
860
- }
861
- | number,
859
+ options?: ScrollViewScrollToOptions | number,
862
860
  deprecatedX?: number,
863
861
  deprecatedAnimated?: boolean,
864
- ) => void = (
865
- options?:
866
- | {
867
- x?: number,
868
- y?: number,
869
- animated?: boolean,
870
- ...
871
- }
872
- | number,
873
- deprecatedX?: number,
874
- deprecatedAnimated?: boolean,
875
- ) => {
862
+ ) => void = (options, deprecatedX, deprecatedAnimated) => {
876
863
  let x, y, animated;
877
864
  if (typeof options === 'number') {
878
865
  console.warn(
@@ -902,9 +889,7 @@ class ScrollView extends React.Component<Props, State> {
902
889
  * `scrollToEnd({animated: false})` for immediate scrolling.
903
890
  * If no options are passed, `animated` defaults to true.
904
891
  */
905
- scrollToEnd: (options?: ?{animated?: boolean, ...}) => void = (
906
- options?: ?{animated?: boolean, ...},
907
- ) => {
892
+ scrollToEnd: (options?: ?ScrollViewScrollToOptions) => void = options => {
908
893
  // Default to true
909
894
  const animated = (options && options.animated) !== false;
910
895
  const component = this.getNativeScrollRef();
@@ -1502,7 +1487,7 @@ class ScrollView extends React.Component<Props, State> {
1502
1487
  keyboardNeverPersistTaps &&
1503
1488
  this._keyboardIsDismissible() &&
1504
1489
  e.target != null &&
1505
- // $FlowFixMe[incompatible-call]
1490
+ // $FlowFixMe[incompatible-type]
1506
1491
  !TextInputState.isTextInput(e.target)
1507
1492
  ) {
1508
1493
  return true;
@@ -1814,7 +1799,7 @@ class ScrollView extends React.Component<Props, State> {
1814
1799
  this.props.scrollViewRef,
1815
1800
  );
1816
1801
 
1817
- if (refreshControl) {
1802
+ if (refreshControl != null) {
1818
1803
  if (Platform.OS === 'ios') {
1819
1804
  // On iOS the RefreshControl is a child of the ScrollView.
1820
1805
  return (
@@ -1830,9 +1815,8 @@ class ScrollView extends React.Component<Props, State> {
1830
1815
  // AndroidSwipeRefreshLayout and use flex: 1 for the ScrollView.
1831
1816
  // Note: we should split props.style on the inner and outer props
1832
1817
  // however, the ScrollView still needs the baseStyle to be scrollable
1833
- // $FlowFixMe[underconstrained-implicit-instantiation]
1834
- // $FlowFixMe[incompatible-call]
1835
1818
  const {outer, inner} = splitLayoutProps(flattenStyle(props.style));
1819
+ // $FlowFixMe[incompatible-call]
1836
1820
  return React.cloneElement(
1837
1821
  refreshControl,
1838
1822
  {style: StyleSheet.compose(baseStyle, outer)},
@@ -1918,10 +1902,10 @@ function createRefForwarder<TNativeInstance, TPublicInstance>(
1918
1902
  // component and we need to map `ref` to a differently named prop. This can be
1919
1903
  // removed when `ScrollView` is a functional component.
1920
1904
  const Wrapper: component(
1921
- ref: React.RefSetter<PublicScrollViewInstance>,
1922
- ...props: Props
1905
+ ref?: React.RefSetter<PublicScrollViewInstance>,
1906
+ ...props: ScrollViewProps
1923
1907
  ) = React.forwardRef(function Wrapper(
1924
- props: Props,
1908
+ props: ScrollViewProps,
1925
1909
  ref: ?React.RefSetter<PublicScrollViewInstance>,
1926
1910
  ): React.Node {
1927
1911
  return ref == null ? (
@@ -8,7 +8,7 @@
8
8
  * @flow strict-local
9
9
  */
10
10
 
11
- import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
11
+ import type {HostComponent} from '../../../src/private/types/HostComponent';
12
12
  import type {Double} from '../../Types/CodegenTypes';
13
13
 
14
14
  import codegenNativeCommands from '../../Utilities/codegenNativeCommands';
@@ -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';
@@ -18,7 +18,7 @@ import useMergeRefs from '../../Utilities/useMergeRefs';
18
18
  import * as React from 'react';
19
19
  import {useCallback, useEffect, useMemo, useRef, useState} from 'react';
20
20
 
21
- export type Props = $ReadOnly<{
21
+ export type ScrollViewStickyHeaderProps = $ReadOnly<{
22
22
  children?: React.Node,
23
23
  nextHeaderLayoutY: ?number,
24
24
  onLayout: (event: LayoutChangeEvent) => void,
@@ -32,15 +32,13 @@ export type Props = $ReadOnly<{
32
32
  hiddenOnScroll?: ?boolean,
33
33
  }>;
34
34
 
35
- type Instance = {
36
- ...React.ElementRef<typeof Animated.View>,
37
- setNextHeaderY: number => void,
38
- ...
39
- };
35
+ interface Instance extends React.ElementRef<typeof Animated.View> {
36
+ +setNextHeaderY: number => void;
37
+ }
40
38
 
41
39
  const ScrollViewStickyHeaderWithForwardedRef: component(
42
40
  ref: React.RefSetter<Instance>,
43
- ...props: Props
41
+ ...props: ScrollViewStickyHeaderProps
44
42
  ) = React.forwardRef(function ScrollViewStickyHeader(props, forwardedRef) {
45
43
  const {
46
44
  inverted,
@@ -62,6 +60,7 @@ const ScrollViewStickyHeaderWithForwardedRef: component(
62
60
  if (ref == null) {
63
61
  return;
64
62
  }
63
+ // $FlowExpectedError[cannot-write]
65
64
  ref.setNextHeaderY = setNextHeaderLayoutY;
66
65
  setIsFabric(isFabricPublicInstance(ref));
67
66
  }, []);
@@ -55,7 +55,7 @@ export type StatusBarAnimation = $Keys<{
55
55
  ...
56
56
  }>;
57
57
 
58
- type AndroidProps = $ReadOnly<{
58
+ export type StatusBarPropsAndroid = $ReadOnly<{
59
59
  /**
60
60
  * The background color of the status bar.
61
61
  * @platform android
@@ -71,7 +71,7 @@ type AndroidProps = $ReadOnly<{
71
71
  translucent?: ?boolean,
72
72
  }>;
73
73
 
74
- type IOSProps = $ReadOnly<{
74
+ export type StatusBarPropsIOS = $ReadOnly<{
75
75
  /**
76
76
  * If the network activity indicator should be visible.
77
77
  *
@@ -87,9 +87,7 @@ type IOSProps = $ReadOnly<{
87
87
  showHideTransition?: ?('fade' | 'slide' | 'none'),
88
88
  }>;
89
89
 
90
- type Props = $ReadOnly<{
91
- ...AndroidProps,
92
- ...IOSProps,
90
+ type StatusBarBaseProps = $ReadOnly<{
93
91
  /**
94
92
  * If the status bar is hidden.
95
93
  */
@@ -105,22 +103,28 @@ type Props = $ReadOnly<{
105
103
  barStyle?: ?('default' | 'light-content' | 'dark-content'),
106
104
  }>;
107
105
 
106
+ export type StatusBarProps = $ReadOnly<{
107
+ ...StatusBarPropsAndroid,
108
+ ...StatusBarPropsIOS,
109
+ ...StatusBarBaseProps,
110
+ }>;
111
+
108
112
  type StackProps = {
109
113
  backgroundColor: ?{
110
- value: Props['backgroundColor'],
114
+ value: StatusBarProps['backgroundColor'],
111
115
  animated: boolean,
112
116
  },
113
117
  barStyle: ?{
114
- value: Props['barStyle'],
118
+ value: StatusBarProps['barStyle'],
115
119
  animated: boolean,
116
120
  },
117
- translucent: Props['translucent'],
121
+ translucent: StatusBarProps['translucent'],
118
122
  hidden: ?{
119
123
  value: boolean,
120
124
  animated: boolean,
121
- transition: Props['showHideTransition'],
125
+ transition: StatusBarProps['showHideTransition'],
122
126
  },
123
- networkActivityIndicatorVisible: Props['networkActivityIndicatorVisible'],
127
+ networkActivityIndicatorVisible: StatusBarProps['networkActivityIndicatorVisible'],
124
128
  };
125
129
 
126
130
  /**
@@ -147,7 +151,7 @@ function mergePropsStack(
147
151
  * Returns an object to insert in the props stack from the props
148
152
  * and the transition/animation info.
149
153
  */
150
- function createStackEntry(props: Props): StackProps {
154
+ function createStackEntry(props: StatusBarProps): StackProps {
151
155
  const animated = props.animated ?? false;
152
156
  const showHideTransition = props.showHideTransition ?? 'fade';
153
157
  return {
@@ -220,7 +224,7 @@ function createStackEntry(props: Props): StackProps {
220
224
  *
221
225
  * `currentHeight` (Android only) The height of the status bar.
222
226
  */
223
- class StatusBar extends React.Component<Props> {
227
+ class StatusBar extends React.Component<StatusBarProps> {
224
228
  static _propsStack: Array<StackProps> = [];
225
229
 
226
230
  static _defaultProps: any = createStackEntry({
@@ -309,7 +313,7 @@ class StatusBar extends React.Component<Props> {
309
313
  * @param color Background color.
310
314
  * @param animated Animate the style change.
311
315
  */
312
- static setBackgroundColor(color: string, animated?: boolean): void {
316
+ static setBackgroundColor(color: ColorValue, animated?: boolean): void {
313
317
  if (Platform.OS !== 'android') {
314
318
  console.warn('`setBackgroundColor` is only available on Android');
315
319
  return;
@@ -320,7 +324,7 @@ class StatusBar extends React.Component<Props> {
320
324
  const processedColor = processColor(color);
321
325
  if (processedColor == null) {
322
326
  console.warn(
323
- `\`StatusBar.setBackgroundColor\`: Color ${color} parsed to null or undefined`,
327
+ `\`StatusBar.setBackgroundColor\`: Color ${String(color)} parsed to null or undefined`,
324
328
  );
325
329
  return;
326
330
  }
@@ -351,7 +355,7 @@ class StatusBar extends React.Component<Props> {
351
355
  *
352
356
  * @param props Object containing the StatusBar props to use in the stack entry.
353
357
  */
354
- static pushStackEntry(props: any): any {
358
+ static pushStackEntry(props: StatusBarProps): StackProps {
355
359
  const entry = createStackEntry(props);
356
360
  StatusBar._propsStack.push(entry);
357
361
  StatusBar._updatePropsStack();
@@ -363,7 +367,7 @@ class StatusBar extends React.Component<Props> {
363
367
  *
364
368
  * @param entry Entry returned from `pushStackEntry`.
365
369
  */
366
- static popStackEntry(entry: any) {
370
+ static popStackEntry(entry: StackProps) {
367
371
  const index = StatusBar._propsStack.indexOf(entry);
368
372
  if (index !== -1) {
369
373
  StatusBar._propsStack.splice(index, 1);
@@ -377,7 +381,10 @@ class StatusBar extends React.Component<Props> {
377
381
  * @param entry Entry returned from `pushStackEntry` to replace.
378
382
  * @param props Object containing the StatusBar props to use in the replacement stack entry.
379
383
  */
380
- static replaceStackEntry(entry: any, props: any): any {
384
+ static replaceStackEntry(
385
+ entry: StackProps,
386
+ props: StatusBarProps,
387
+ ): StackProps {
381
388
  const newEntry = createStackEntry(props);
382
389
  const index = StatusBar._propsStack.indexOf(entry);
383
390
  if (index !== -1) {
@@ -400,14 +407,18 @@ class StatusBar extends React.Component<Props> {
400
407
  componentWillUnmount() {
401
408
  // When a StatusBar is unmounted, remove itself from the stack and update
402
409
  // the native bar with the next props.
403
- StatusBar.popStackEntry(this._stackEntry);
410
+ if (this._stackEntry != null) {
411
+ StatusBar.popStackEntry(this._stackEntry);
412
+ }
404
413
  }
405
414
 
406
415
  componentDidUpdate() {
407
- this._stackEntry = StatusBar.replaceStackEntry(
408
- this._stackEntry,
409
- this.props,
410
- );
416
+ if (this._stackEntry != null) {
417
+ this._stackEntry = StatusBar.replaceStackEntry(
418
+ this._stackEntry,
419
+ this.props,
420
+ );
421
+ }
411
422
  }
412
423
 
413
424
  /**
@@ -23,16 +23,37 @@ import SwitchNativeComponent, {
23
23
  } from './SwitchNativeComponent';
24
24
  import * as React from 'react';
25
25
 
26
- type SwitchChangeEvent = NativeSyntheticEvent<
27
- $ReadOnly<{
28
- value: boolean,
29
- target: number,
30
- }>,
31
- >;
26
+ export type SwitchPropsIOS = {
27
+ /**
28
+ * Background color when the switch is turned on.
29
+ *
30
+ * @deprecated use trackColor instead
31
+ */
32
+ onTintColor?: ?ColorValue,
32
33
 
33
- export type Props = $ReadOnly<{
34
- ...ViewProps,
34
+ /**
35
+ * Color of the foreground switch grip.
36
+ *
37
+ * @deprecated use thumbColor instead
38
+ */
39
+ thumbTintColor?: ?ColorValue,
35
40
 
41
+ /**
42
+ * Background color when the switch is turned off.
43
+ *
44
+ * @deprecated use trackColor instead
45
+ */
46
+ tintColor?: ?ColorValue,
47
+ };
48
+
49
+ export type SwitchChangeEventData = $ReadOnly<{
50
+ target: number,
51
+ value: boolean,
52
+ }>;
53
+
54
+ export type SwitchChangeEvent = NativeSyntheticEvent<SwitchChangeEventData>;
55
+
56
+ type SwitchPropsBase = {
36
57
  /**
37
58
  If true the user won't be able to toggle the switch.
38
59
 
@@ -41,53 +62,64 @@ export type Props = $ReadOnly<{
41
62
  disabled?: ?boolean,
42
63
 
43
64
  /**
44
- The value of the switch. If true the switch will be turned on.
65
+ The value of the switch. If true the switch will be turned on.
45
66
 
46
- @default false
47
- */
67
+ @default false
68
+ */
48
69
  value?: ?boolean,
49
70
 
50
71
  /**
51
- Color of the foreground switch grip. If this is set on iOS, the switch grip will lose its drop shadow.
52
- */
72
+ Color of the foreground switch grip. If this is set on iOS, the switch grip will lose its drop shadow.
73
+ */
53
74
  thumbColor?: ?ColorValue,
54
75
 
55
76
  /**
56
- Custom colors for the switch track.
77
+ Custom colors for the switch track.
57
78
 
58
- _iOS_: When the switch value is false, the track shrinks into the border. If you want to change the
59
- color of the background exposed by the shrunken track, use
60
- [`ios_backgroundColor`](https://reactnative.dev/docs/switch#ios_backgroundColor).
61
- */
79
+ _iOS_: When the switch value is false, the track shrinks into the border. If you want to change the
80
+ color of the background exposed by the shrunken track, use
81
+ [`ios_backgroundColor`](https://reactnative.dev/docs/switch#ios_backgroundColor).
82
+ */
62
83
  trackColor?: ?$ReadOnly<{
63
84
  false?: ?ColorValue,
64
85
  true?: ?ColorValue,
65
86
  }>,
66
87
 
67
88
  /**
68
- On iOS, custom color for the background. This background color can be
69
- seen either when the switch value is false or when the switch is
70
- disabled (and the switch is translucent).
71
- */
89
+ On iOS, custom color for the background. This background color can be
90
+ seen either when the switch value is false or when the switch is
91
+ disabled (and the switch is translucent).
92
+ */
72
93
  ios_backgroundColor?: ?ColorValue,
73
94
 
74
95
  /**
75
- Invoked when the user tries to change the value of the switch. Receives
76
- the change event as an argument. If you want to only receive the new
77
- value, use `onValueChange` instead.
78
- */
96
+ Invoked when the user tries to change the value of the switch. Receives
97
+ the change event as an argument. If you want to only receive the new
98
+ value, use `onValueChange` instead.
99
+ */
79
100
  onChange?: ?(event: SwitchChangeEvent) => Promise<void> | void,
80
101
 
81
102
  /**
82
- Invoked when the user tries to change the value of the switch. Receives
83
- the new value as an argument. If you want to instead receive an event,
84
- use `onChange`.
85
- */
103
+ Invoked when the user tries to change the value of the switch. Receives
104
+ the new value as an argument. If you want to instead receive an event,
105
+ use `onChange`.
106
+ */
86
107
  onValueChange?: ?(value: boolean) => Promise<void> | void,
108
+ };
109
+
110
+ export type SwitchProps = $ReadOnly<{
111
+ ...ViewProps,
112
+ ...SwitchPropsIOS,
113
+ ...SwitchPropsBase,
87
114
  }>;
115
+
88
116
  const returnsFalse = () => false;
89
117
  const returnsTrue = () => true;
90
118
 
119
+ type SwitchRef = React.ElementRef<
120
+ typeof SwitchNativeComponent | typeof AndroidSwitchNativeComponent,
121
+ >;
122
+
91
123
  /**
92
124
  Renders a boolean input.
93
125
 
@@ -129,14 +161,9 @@ const returnsTrue = () => true;
129
161
  export default App;
130
162
  ```
131
163
  */
132
-
133
- type SwitchRef = React.ElementRef<
134
- typeof SwitchNativeComponent | typeof AndroidSwitchNativeComponent,
135
- >;
136
-
137
- const SwitchWithForwardedRef: component(
138
- ref: React.RefSetter<SwitchRef>,
139
- ...props: Props
164
+ const Switch: component(
165
+ ref?: React.RefSetter<SwitchRef>,
166
+ ...props: SwitchProps
140
167
  ) = React.forwardRef(function Switch(props, forwardedRef): React.Node {
141
168
  const {
142
169
  disabled,
@@ -177,6 +204,7 @@ const SwitchWithForwardedRef: component(
177
204
  native.value != null && native.value !== jsValue;
178
205
  if (
179
206
  shouldUpdateNativeSwitch &&
207
+ // $FlowIssue[method-unbinding]
180
208
  nativeSwitchRef.current?.setNativeProps != null
181
209
  ) {
182
210
  if (Platform.OS === 'android') {
@@ -188,7 +216,8 @@ const SwitchWithForwardedRef: component(
188
216
  }, [value, native]);
189
217
 
190
218
  if (Platform.OS === 'android') {
191
- const {accessibilityState} = restProps;
219
+ const {onTintColor, tintColor, ...androidProps} = restProps;
220
+ const {accessibilityState} = androidProps;
192
221
  const _disabled =
193
222
  disabled != null ? disabled : accessibilityState?.disabled;
194
223
 
@@ -210,7 +239,7 @@ const SwitchWithForwardedRef: component(
210
239
 
211
240
  return (
212
241
  <AndroidSwitchNativeComponent
213
- {...restProps}
242
+ {...androidProps}
214
243
  {...platformProps}
215
244
  accessibilityRole={props.accessibilityRole ?? 'switch'}
216
245
  onChange={handleChange}
@@ -254,4 +283,4 @@ const SwitchWithForwardedRef: component(
254
283
  }
255
284
  });
256
285
 
257
- export default SwitchWithForwardedRef;
286
+ export default Switch;
@@ -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 {
16
14
  ColorValue,
17
15
  TextStyleProp,
@@ -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 {TextInputNativeCommands} from './TextInputNativeCommands';
16
14
 
17
15
  import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry';
@@ -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 {TextInputNativeCommands} from './TextInputNativeCommands';
16
14
 
17
15
  import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry';
@@ -142,6 +142,7 @@ const RCTTextInputViewConfig = {
142
142
  placeholder: true,
143
143
  autoCorrect: true,
144
144
  multiline: true,
145
+ numberOfLines: true,
145
146
  textContentType: true,
146
147
  maxLength: true,
147
148
  autoCapitalize: true,
@@ -1,8 +1,9 @@
1
+ import React from 'react';
1
2
  export declare const title = "TextInput";
2
3
  export declare const displayName = "TextInput";
3
4
  export declare const description = "TextInput Examples and Tests";
4
5
  export declare const examples: {
5
6
  title: string;
6
7
  description: string;
7
- render(): JSX.Element;
8
+ render(): React.JSX.Element;
8
9
  }[];