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

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 (128) hide show
  1. package/.flowconfig +1 -1
  2. package/CHANGELOG.json +31 -1
  3. package/CHANGELOG.md +20 -4
  4. package/Libraries/Alert/RCTAlertManager.js +17 -0
  5. package/Libraries/Animated/AnimatedEvent.js +4 -3
  6. package/Libraries/Animated/AnimatedExports.js.flow +2 -0
  7. package/Libraries/Animated/AnimatedImplementation.js +2 -2
  8. package/Libraries/Animated/components/AnimatedScrollView.js +48 -43
  9. package/Libraries/Animated/nodes/AnimatedValue.js +2 -1
  10. package/Libraries/BatchedBridge/MessageQueue.js +2 -2
  11. package/Libraries/Blob/FileReader.js +219 -8
  12. package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js +17 -0
  13. package/Libraries/Components/Button.js +1 -1
  14. package/Libraries/Components/Button.win32.js +1 -1
  15. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -3
  16. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js +15 -0
  17. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +6 -66
  18. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js.flow +18 -0
  19. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidFallback.js +71 -0
  20. package/Libraries/Components/Keyboard/Keyboard.js +4 -2
  21. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +6 -3
  22. package/Libraries/Components/Pressable/Pressable.js +2 -0
  23. package/Libraries/Components/Pressable/Pressable.win32.js +2 -0
  24. package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +12 -2
  25. package/Libraries/Components/RefreshControl/RefreshControl.js +1 -1
  26. package/Libraries/Components/ScrollView/ScrollView.js +128 -116
  27. package/Libraries/Components/StaticRenderer.js +1 -1
  28. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +1 -1
  29. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -4
  30. package/Libraries/Components/TextInput/TextInput.flow.js +35 -43
  31. package/Libraries/Components/TextInput/TextInput.flow.win32.js +1184 -0
  32. package/Libraries/Components/TextInput/TextInput.js +65 -1005
  33. package/Libraries/Components/TextInput/TextInput.win32.js +67 -1037
  34. package/Libraries/Components/ToastAndroid/ToastAndroid.ios.js +13 -0
  35. package/Libraries/Components/ToastAndroid/ToastAndroid.js +4 -32
  36. package/Libraries/Components/ToastAndroid/ToastAndroid.js.flow +109 -0
  37. package/Libraries/Components/ToastAndroid/ToastAndroid.win32.js +4 -32
  38. package/Libraries/Components/ToastAndroid/ToastAndroidFallback.js +45 -0
  39. package/Libraries/Components/Touchable/Touchable.js +5 -5
  40. package/Libraries/Components/Touchable/Touchable.win32.js +5 -5
  41. package/Libraries/Components/Touchable/TouchableBounce.js +12 -6
  42. package/Libraries/Components/Touchable/TouchableHighlight.js +9 -6
  43. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +4 -4
  44. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +4 -4
  45. package/Libraries/Components/Touchable/TouchableOpacity.js +11 -5
  46. package/Libraries/Components/View/ViewAccessibility.js +7 -0
  47. package/Libraries/Components/View/ViewAccessibility.win32.js +7 -0
  48. package/Libraries/Components/View/ViewPropTypes.js +1 -1
  49. package/Libraries/Components/View/ViewPropTypes.win32.js +1 -1
  50. package/Libraries/Core/ReactNativeVersion.js +1 -1
  51. package/Libraries/EventEmitter/NativeEventEmitter.js +4 -1
  52. package/Libraries/Image/Image.js +17 -0
  53. package/Libraries/Image/Image.js.flow +2 -2
  54. package/Libraries/Image/ImageInjection.js +1 -1
  55. package/Libraries/Image/ImageProps.js +5 -4
  56. package/Libraries/Image/ImageTypes.flow.js +1 -1
  57. package/Libraries/Lists/FlatList.js +1 -1
  58. package/Libraries/Lists/SectionList.js +1 -1
  59. package/Libraries/Lists/SectionListModern.js +2 -1
  60. package/Libraries/LogBox/LogBoxNotificationContainer.js +1 -1
  61. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.win32.js +140 -0
  62. package/Libraries/Modal/Modal.js +3 -3
  63. package/Libraries/NativeComponent/BaseViewConfig.js +17 -0
  64. package/Libraries/NativeComponent/PlatformBaseViewConfig.js +2 -2
  65. package/Libraries/Network/RCTNetworking.js +17 -0
  66. package/Libraries/Network/XMLHttpRequest.js +781 -10
  67. package/Libraries/NewAppScreen/components/DebugInstructions.js +1 -1
  68. package/Libraries/NewAppScreen/components/Header.js +1 -1
  69. package/Libraries/NewAppScreen/components/HermesBadge.js +1 -1
  70. package/Libraries/NewAppScreen/components/LearnMoreLinks.js +3 -3
  71. package/Libraries/NewAppScreen/components/ReloadInstructions.js +1 -1
  72. package/Libraries/Performance/Systrace.js +7 -7
  73. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +2 -2
  74. package/Libraries/Settings/Settings.js +13 -19
  75. package/Libraries/Settings/Settings.win32.js +19 -20
  76. package/Libraries/Settings/SettingsFallback.js +33 -0
  77. package/Libraries/StyleSheet/PlatformColorValueTypes.js +15 -0
  78. package/Libraries/StyleSheet/Rect.js +1 -0
  79. package/Libraries/StyleSheet/StyleSheet.js.flow +3 -3
  80. package/Libraries/StyleSheet/StyleSheetTypes.js +28 -30
  81. package/Libraries/StyleSheet/flattenStyle.js +7 -1
  82. package/Libraries/Text/Text.js +3 -3
  83. package/Libraries/Text/Text.win32.js +3 -3
  84. package/Libraries/Text/TextProps.js +1 -1
  85. package/Libraries/Text/TextProps.win32.js +1 -1
  86. package/Libraries/Utilities/Appearance.js +2 -0
  87. package/Libraries/Utilities/BackHandler.js +17 -0
  88. package/Libraries/Utilities/Platform.js +17 -0
  89. package/Libraries/Utilities/PlatformTypes.js +2 -0
  90. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  91. package/Libraries/WebSocket/WebSocket.js +313 -8
  92. package/flow/global.js +0 -2
  93. package/index.win32.js +5 -5
  94. package/overrides.json +29 -17
  95. package/package.json +12 -12
  96. package/src/private/animated/NativeAnimatedHelper.js +1 -1
  97. package/src/private/animated/NativeAnimatedHelper.win32.js +1 -1
  98. package/src/private/animated/createAnimatedPropsHook.js +2 -27
  99. package/src/private/components/{SafeAreaView_INTERNAL_DO_NOT_USE.js → safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js} +6 -6
  100. package/src/private/components/{HScrollViewNativeComponents.js → scrollview/HScrollViewNativeComponents.js} +8 -8
  101. package/src/private/components/scrollview/VScrollViewNativeComponents.js +25 -0
  102. package/src/private/featureflags/ReactNativeFeatureFlags.js +21 -32
  103. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -6
  104. package/src/private/inspector/BorderBox.js +1 -1
  105. package/src/private/inspector/BoxInspector.js +1 -1
  106. package/src/private/inspector/ElementBox.js +1 -1
  107. package/src/private/inspector/ElementProperties.js +1 -1
  108. package/src/private/inspector/Inspector.js +2 -2
  109. package/src/private/inspector/InspectorOverlay.js +1 -1
  110. package/src/private/inspector/InspectorPanel.js +1 -1
  111. package/src/private/inspector/NetworkOverlay.js +1 -1
  112. package/src/private/inspector/PerformanceOverlay.js +1 -1
  113. package/src/private/inspector/StyleInspector.js +1 -1
  114. package/src/private/types/HostComponent.js +1 -1
  115. package/src/private/types/HostInstance.js +10 -2
  116. package/src/private/webapis/performance/Performance.js +1 -3
  117. package/Libraries/Blob/FileReader_new.js +0 -231
  118. package/Libraries/Blob/FileReader_old.js +0 -186
  119. package/Libraries/Events/CustomEvent.js +0 -32
  120. package/Libraries/Events/EventPolyfill.js +0 -239
  121. package/Libraries/Network/XMLHttpRequest_new.js +0 -794
  122. package/Libraries/Network/XMLHttpRequest_old.js +0 -701
  123. package/Libraries/WebSocket/WebSocketEvent.js +0 -30
  124. package/Libraries/WebSocket/WebSocket_new.js +0 -325
  125. package/Libraries/WebSocket/WebSocket_old.js +0 -297
  126. package/Libraries/WebSocket/__mocks__/event-target-shim.js +0 -27
  127. package/src/private/components/VScrollViewNativeComponents.js +0 -25
  128. package/src/types/third_party/event-target-shim.d.ts +0 -392
@@ -5,73 +5,13 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  * @format
8
- * @flow strict-local
8
+ * @flow
9
9
  */
10
10
 
11
- 'use strict';
11
+ // NOTE: This file supports backwards compatibility of subpath (deep) imports
12
+ // from 'react-native' with platform-specific extensions. It can be deleted
13
+ // once we remove the "./*" mapping from package.json "exports".
12
14
 
13
- // import typeof DrawerLayoutAndroid from './DrawerLayoutAndroid.android';
14
- import type {
15
- MeasureInWindowOnSuccessCallback,
16
- MeasureLayoutOnSuccessCallback,
17
- MeasureOnSuccessCallback,
18
- } from '../../../src/private/types/HostInstance';
19
- import type {
20
- DrawerLayoutAndroidMethods,
21
- DrawerLayoutAndroidProps,
22
- DrawerLayoutAndroidState,
23
- } from './DrawerLayoutAndroidTypes';
15
+ import DrawerLayoutAndroid from './DrawerLayoutAndroid';
24
16
 
25
- import UnimplementedView from '../UnimplementedViews/UnimplementedView';
26
- import * as React from 'react';
27
-
28
- export type {
29
- DrawerLayoutAndroidProps,
30
- DrawerSlideEvent,
31
- } from './DrawerLayoutAndroidTypes';
32
-
33
- export default class DrawerLayoutAndroid
34
- extends React.Component<DrawerLayoutAndroidProps, DrawerLayoutAndroidState>
35
- implements DrawerLayoutAndroidMethods
36
- {
37
- render(): React.Node {
38
- return <UnimplementedView {...this.props} />;
39
- }
40
-
41
- openDrawer(): void {
42
- throw new Error('DrawerLayoutAndroid is only available on Android');
43
- }
44
-
45
- closeDrawer(): void {
46
- throw new Error('DrawerLayoutAndroid is only available on Android');
47
- }
48
-
49
- blur(): void {
50
- throw new Error('DrawerLayoutAndroid is only available on Android');
51
- }
52
-
53
- focus(): void {
54
- throw new Error('DrawerLayoutAndroid is only available on Android');
55
- }
56
-
57
- measure(callback: MeasureOnSuccessCallback): void {
58
- throw new Error('DrawerLayoutAndroid is only available on Android');
59
- }
60
-
61
- measureInWindow(callback: MeasureInWindowOnSuccessCallback): void {
62
- throw new Error('DrawerLayoutAndroid is only available on Android');
63
- }
64
-
65
- measureLayout(
66
- relativeToNativeNode: number,
67
- onSuccess: MeasureLayoutOnSuccessCallback,
68
- onFail?: () => void,
69
- ): void {
70
- throw new Error('DrawerLayoutAndroid is only available on Android');
71
- }
72
-
73
- // $FlowFixMe[unclear-type]
74
- setNativeProps(nativeProps: Object): void {
75
- throw new Error('DrawerLayoutAndroid is only available on Android');
76
- }
77
- }
17
+ export default DrawerLayoutAndroid;
@@ -0,0 +1,18 @@
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
+ * @format
8
+ * @flow strict-local
9
+ */
10
+
11
+ import DrawerLayoutAndroid from './DrawerLayoutAndroidFallback';
12
+
13
+ export type {
14
+ DrawerLayoutAndroidProps,
15
+ DrawerSlideEvent,
16
+ } from './DrawerLayoutAndroidTypes';
17
+
18
+ export default DrawerLayoutAndroid;
@@ -0,0 +1,71 @@
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
+ * @format
8
+ * @flow strict-local
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ import type {
14
+ MeasureInWindowOnSuccessCallback,
15
+ MeasureLayoutOnSuccessCallback,
16
+ MeasureOnSuccessCallback,
17
+ } from '../../../src/private/types/HostInstance';
18
+ import type {
19
+ DrawerLayoutAndroidMethods,
20
+ DrawerLayoutAndroidProps,
21
+ DrawerLayoutAndroidState,
22
+ } from './DrawerLayoutAndroidTypes';
23
+
24
+ import UnimplementedView from '../UnimplementedViews/UnimplementedView';
25
+ import * as React from 'react';
26
+
27
+ export default class DrawerLayoutAndroid
28
+ extends React.Component<DrawerLayoutAndroidProps, DrawerLayoutAndroidState>
29
+ implements DrawerLayoutAndroidMethods
30
+ {
31
+ render(): React.Node {
32
+ return <UnimplementedView {...this.props} />;
33
+ }
34
+
35
+ openDrawer(): void {
36
+ throw new Error('DrawerLayoutAndroid is only available on Android');
37
+ }
38
+
39
+ closeDrawer(): void {
40
+ throw new Error('DrawerLayoutAndroid is only available on Android');
41
+ }
42
+
43
+ blur(): void {
44
+ throw new Error('DrawerLayoutAndroid is only available on Android');
45
+ }
46
+
47
+ focus(): void {
48
+ throw new Error('DrawerLayoutAndroid is only available on Android');
49
+ }
50
+
51
+ measure(callback: MeasureOnSuccessCallback): void {
52
+ throw new Error('DrawerLayoutAndroid is only available on Android');
53
+ }
54
+
55
+ measureInWindow(callback: MeasureInWindowOnSuccessCallback): void {
56
+ throw new Error('DrawerLayoutAndroid is only available on Android');
57
+ }
58
+
59
+ measureLayout(
60
+ relativeToNativeNode: number,
61
+ onSuccess: MeasureLayoutOnSuccessCallback,
62
+ onFail?: () => void,
63
+ ): void {
64
+ throw new Error('DrawerLayoutAndroid is only available on Android');
65
+ }
66
+
67
+ // $FlowFixMe[unclear-type]
68
+ setNativeProps(nativeProps: Object): void {
69
+ throw new Error('DrawerLayoutAndroid is only available on Android');
70
+ }
71
+ }
@@ -103,7 +103,7 @@ type KeyboardEventDefinitions = {
103
103
  *```
104
104
  */
105
105
 
106
- class Keyboard {
106
+ class KeyboardImpl {
107
107
  _currentlyShowing: ?KeyboardEvent;
108
108
 
109
109
  _emitter: NativeEventEmitter<KeyboardEventDefinitions> =
@@ -202,4 +202,6 @@ class Keyboard {
202
202
  }
203
203
  }
204
204
 
205
- export default (new Keyboard(): Keyboard);
205
+ const Keyboard: KeyboardImpl = new KeyboardImpl();
206
+
207
+ export default Keyboard;
@@ -51,7 +51,7 @@ export type KeyboardAvoidingViewProps = $ReadOnly<{
51
51
  keyboardVerticalOffset?: number,
52
52
  }>;
53
53
 
54
- type State = {
54
+ type KeyboardAvoidingViewState = {
55
55
  bottom: number,
56
56
  };
57
57
 
@@ -61,7 +61,7 @@ type State = {
61
61
  */
62
62
  class KeyboardAvoidingView extends React.Component<
63
63
  KeyboardAvoidingViewProps,
64
- State,
64
+ KeyboardAvoidingViewState,
65
65
  > {
66
66
  _frame: ?ViewLayout = null;
67
67
  _keyboardEvent: ?KeyboardEvent = null;
@@ -178,7 +178,10 @@ class KeyboardAvoidingView extends React.Component<
178
178
  }
179
179
  };
180
180
 
181
- componentDidUpdate(_: KeyboardAvoidingViewProps, prevState: State): void {
181
+ componentDidUpdate(
182
+ _: KeyboardAvoidingViewProps,
183
+ prevState: KeyboardAvoidingViewState,
184
+ ): void {
182
185
  const enabled = this.props.enabled ?? true;
183
186
  if (enabled && this._bottom !== prevState.bottom) {
184
187
  this.setState({bottom: this._bottom});
@@ -28,6 +28,8 @@ import {useMemo, useRef, useState} from 'react';
28
28
 
29
29
  type ViewStyleProp = React.ElementConfig<typeof View>['style'];
30
30
 
31
+ export type {PressableAndroidRippleConfig};
32
+
31
33
  export type PressableStateCallbackType = $ReadOnly<{
32
34
  pressed: boolean,
33
35
  }>;
@@ -34,6 +34,8 @@ import View from '../View/View';
34
34
 
35
35
  type ViewStyleProp = React.ElementConfig<typeof View>['style'];
36
36
 
37
+ export type {PressableAndroidRippleConfig};
38
+
37
39
  export type PressableStateCallbackType = $ReadOnly<{
38
40
  pressed: boolean,
39
41
  }>;
@@ -13,12 +13,22 @@
13
13
  import typeof ProgressBarAndroidNativeComponentType from './ProgressBarAndroidNativeComponent';
14
14
  import type {ProgressBarAndroidProps} from './ProgressBarAndroidTypes';
15
15
 
16
+ import Platform from '../../Utilities/Platform';
17
+
16
18
  export type {ProgressBarAndroidProps};
17
19
 
18
- export default require('../UnimplementedViews/UnimplementedView')
19
- .default as $FlowFixMe as component(
20
+ let ProgressBarAndroid: component(
20
21
  ref?: React.RefSetter<
21
22
  React.ElementRef<ProgressBarAndroidNativeComponentType>,
22
23
  >,
23
24
  ...props: ProgressBarAndroidProps
24
25
  );
26
+
27
+ if (Platform.OS === 'android') {
28
+ ProgressBarAndroid = require('./ProgressBarAndroid').default;
29
+ } else {
30
+ ProgressBarAndroid = require('../UnimplementedViews/UnimplementedView')
31
+ .default as $FlowFixMe;
32
+ }
33
+
34
+ export default ProgressBarAndroid;
@@ -17,7 +17,7 @@ import AndroidSwipeRefreshLayoutNativeComponent, {
17
17
  import PullToRefreshViewNativeComponent, {
18
18
  Commands as PullToRefreshCommands,
19
19
  } from './PullToRefreshViewNativeComponent';
20
- import React from 'react';
20
+ import * as React from 'react';
21
21
 
22
22
  const Platform = require('../../Utilities/Platform').default;
23
23
 
@@ -20,18 +20,17 @@ import type {
20
20
  } from '../../Types/CoreEventTypes';
21
21
  import type {EventSubscription} from '../../vendor/emitter/EventEmitter';
22
22
  import type {KeyboardEvent, KeyboardMetrics} from '../Keyboard/Keyboard';
23
- import typeof View from '../View/View';
24
23
  import type {ViewProps} from '../View/ViewPropTypes';
25
24
  import type {ScrollViewStickyHeaderProps} from './ScrollViewStickyHeader';
26
25
 
27
26
  import {
28
27
  HScrollContentViewNativeComponent,
29
28
  HScrollViewNativeComponent,
30
- } from '../../../src/private/components/HScrollViewNativeComponents';
29
+ } from '../../../src/private/components/scrollview/HScrollViewNativeComponents';
31
30
  import {
32
31
  VScrollContentViewNativeComponent,
33
32
  VScrollViewNativeComponent,
34
- } from '../../../src/private/components/VScrollViewNativeComponents';
33
+ } from '../../../src/private/components/scrollview/VScrollViewNativeComponents';
35
34
  import AnimatedImplementation from '../../Animated/AnimatedImplementation';
36
35
  import FrameRateLogger from '../../Interaction/FrameRateLogger';
37
36
  import {findNodeHandle} from '../../ReactNative/RendererProxy';
@@ -44,6 +43,7 @@ import dismissKeyboard from '../../Utilities/dismissKeyboard';
44
43
  import Platform from '../../Utilities/Platform';
45
44
  import Keyboard from '../Keyboard/Keyboard';
46
45
  import TextInputState from '../TextInput/TextInputState';
46
+ import View from '../View/View';
47
47
  import processDecelerationRate from './processDecelerationRate';
48
48
  import Commands from './ScrollViewCommands';
49
49
  import ScrollViewContext, {HORIZONTAL, VERTICAL} from './ScrollViewContext';
@@ -134,16 +134,33 @@ export interface ScrollViewScrollToOptions {
134
134
 
135
135
  // Public methods for ScrollView
136
136
  export interface ScrollViewImperativeMethods {
137
- +getScrollResponder: ScrollView['getScrollResponder'];
138
- +getScrollableNode: ScrollView['getScrollableNode'];
139
- +getInnerViewNode: ScrollView['getInnerViewNode'];
140
- +getInnerViewRef: ScrollView['getInnerViewRef'];
141
- +getNativeScrollRef: ScrollView['getNativeScrollRef'];
142
- +scrollTo: ScrollView['scrollTo'];
143
- +scrollToEnd: ScrollView['scrollToEnd'];
144
- +flashScrollIndicators: ScrollView['flashScrollIndicators'];
145
- +scrollResponderZoomTo: ScrollView['scrollResponderZoomTo'];
146
- +scrollResponderScrollNativeHandleToKeyboard: ScrollView['scrollResponderScrollNativeHandleToKeyboard'];
137
+ +getScrollResponder: () => ScrollResponderType;
138
+ +getScrollableNode: () => ?number;
139
+ +getInnerViewNode: () => ?number;
140
+ +getInnerViewRef: () => InnerViewInstance | null;
141
+ +getNativeScrollRef: () => HostInstance | null;
142
+ +scrollTo: (
143
+ options?: ScrollViewScrollToOptions | number,
144
+ deprecatedX?: number,
145
+ deprecatedAnimated?: boolean,
146
+ ) => void;
147
+ +scrollToEnd: (options?: ?ScrollViewScrollToOptions) => void;
148
+ +flashScrollIndicators: () => void;
149
+ +scrollResponderZoomTo: (
150
+ rect: {
151
+ x: number,
152
+ y: number,
153
+ width: number,
154
+ height: number,
155
+ animated?: boolean,
156
+ },
157
+ animated?: boolean, // deprecated, put this inside the rect argument instead
158
+ ) => void;
159
+ +scrollResponderScrollNativeHandleToKeyboard: (
160
+ nodeHandle: number | HostInstance,
161
+ additionalOffset?: number,
162
+ preventNegativeScrollOffset?: boolean,
163
+ ) => void;
147
164
  }
148
165
 
149
166
  export type DecelerationRateType = 'fast' | 'normal' | number;
@@ -153,7 +170,7 @@ export interface PublicScrollViewInstance
153
170
  extends HostInstance,
154
171
  ScrollViewImperativeMethods {}
155
172
 
156
- type InnerViewInstance = React.ElementRef<View>;
173
+ type InnerViewInstance = React.ElementRef<typeof View>;
157
174
 
158
175
  export type ScrollViewPropsIOS = $ReadOnly<{
159
176
  /**
@@ -373,11 +390,7 @@ type StickyHeaderComponentType = component(
373
390
  ...ScrollViewStickyHeaderProps
374
391
  );
375
392
 
376
- export type ScrollViewProps = $ReadOnly<{
377
- ...ViewProps,
378
- ...ScrollViewPropsIOS,
379
- ...ScrollViewPropsAndroid,
380
-
393
+ type ScrollViewBaseProps = $ReadOnly<{
381
394
  /**
382
395
  * These styles will be applied to the scroll view content container which
383
396
  * wraps all of the child views. Example:
@@ -640,7 +653,7 @@ export type ScrollViewProps = $ReadOnly<{
640
653
  */
641
654
  /* $FlowFixMe[unclear-type] - how to handle generic type without existential
642
655
  * operator? */
643
- refreshControl?: ?React.Node,
656
+ refreshControl?: ?React.MixedElement,
644
657
  children?: React.Node,
645
658
  /**
646
659
  * A ref to the inner View element of the ScrollView. This should be used
@@ -655,7 +668,14 @@ export type ScrollViewProps = $ReadOnly<{
655
668
  scrollViewRef?: React.RefSetter<PublicScrollViewInstance>,
656
669
  }>;
657
670
 
658
- type State = {
671
+ export type ScrollViewProps = $ReadOnly<{
672
+ ...ViewProps,
673
+ ...ScrollViewPropsIOS,
674
+ ...ScrollViewPropsAndroid,
675
+ ...ScrollViewBaseProps,
676
+ }>;
677
+
678
+ type ScrollViewState = {
659
679
  layoutHeight: ?number,
660
680
  };
661
681
 
@@ -700,7 +720,7 @@ export type ScrollViewComponentStatics = $ReadOnly<{
700
720
  * multiple columns, infinite scroll loading, or any number of other features it
701
721
  * supports out of the box.
702
722
  */
703
- class ScrollView extends React.Component<ScrollViewProps, State> {
723
+ class ScrollView extends React.Component<ScrollViewProps, ScrollViewState> {
704
724
  static Context: typeof ScrollViewContext = ScrollViewContext;
705
725
 
706
726
  constructor(props: ScrollViewProps) {
@@ -742,7 +762,7 @@ class ScrollView extends React.Component<ScrollViewProps, State> {
742
762
  _subscriptionKeyboardDidShow: ?EventSubscription = null;
743
763
  _subscriptionKeyboardDidHide: ?EventSubscription = null;
744
764
 
745
- state: State = {
765
+ state: ScrollViewState = {
746
766
  layoutHeight: null,
747
767
  };
748
768
 
@@ -820,26 +840,28 @@ class ScrollView extends React.Component<ScrollViewProps, State> {
820
840
  * implement this method so that they can be composed while providing access
821
841
  * to the underlying scroll responder's methods.
822
842
  */
823
- getScrollResponder: () => ScrollResponderType = () => {
824
- // $FlowFixMe[unclear-type]
825
- return ((this: any): ScrollResponderType);
826
- };
843
+ getScrollResponder: ScrollViewImperativeMethods['getScrollResponder'] =
844
+ () => {
845
+ // $FlowFixMe[unclear-type]
846
+ return ((this: any): ScrollResponderType);
847
+ };
827
848
 
828
- getScrollableNode: () => ?number = () => {
849
+ getScrollableNode: ScrollViewImperativeMethods['getScrollableNode'] = () => {
829
850
  return findNodeHandle<$FlowFixMe>(this.getNativeScrollRef());
830
851
  };
831
852
 
832
- getInnerViewNode: () => ?number = () => {
853
+ getInnerViewNode: ScrollViewImperativeMethods['getInnerViewNode'] = () => {
833
854
  return findNodeHandle<$FlowFixMe>(this._innerView.nativeInstance);
834
855
  };
835
856
 
836
- getInnerViewRef: () => InnerViewInstance | null = () => {
857
+ getInnerViewRef: ScrollViewImperativeMethods['getInnerViewRef'] = () => {
837
858
  return this._innerView.nativeInstance;
838
859
  };
839
860
 
840
- getNativeScrollRef: () => HostInstance | null = () => {
841
- return this._scrollView.nativeInstance;
842
- };
861
+ getNativeScrollRef: ScrollViewImperativeMethods['getNativeScrollRef'] =
862
+ () => {
863
+ return this._scrollView.nativeInstance;
864
+ };
843
865
 
844
866
  /**
845
867
  * Scrolls to a given x, y offset, either immediately or with a smooth animation.
@@ -852,11 +874,11 @@ class ScrollView extends React.Component<ScrollViewProps, State> {
852
874
  * the function also accepts separate arguments as an alternative to the options object.
853
875
  * This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED.
854
876
  */
855
- scrollTo: (
856
- options?: ScrollViewScrollToOptions | number,
857
- deprecatedX?: number,
858
- deprecatedAnimated?: boolean,
859
- ) => void = (options, deprecatedX, deprecatedAnimated) => {
877
+ scrollTo: ScrollViewImperativeMethods['scrollTo'] = (
878
+ options,
879
+ deprecatedX,
880
+ deprecatedAnimated,
881
+ ) => {
860
882
  let x, y, animated;
861
883
  if (typeof options === 'number') {
862
884
  console.warn(
@@ -886,7 +908,7 @@ class ScrollView extends React.Component<ScrollViewProps, State> {
886
908
  * `scrollToEnd({animated: false})` for immediate scrolling.
887
909
  * If no options are passed, `animated` defaults to true.
888
910
  */
889
- scrollToEnd: (options?: ?ScrollViewScrollToOptions) => void = options => {
911
+ scrollToEnd: ScrollViewImperativeMethods['scrollToEnd'] = options => {
890
912
  // Default to true
891
913
  const animated = (options && options.animated) !== false;
892
914
  const component = this.getNativeScrollRef();
@@ -901,13 +923,14 @@ class ScrollView extends React.Component<ScrollViewProps, State> {
901
923
  *
902
924
  * @platform ios
903
925
  */
904
- flashScrollIndicators: () => void = () => {
905
- const component = this.getNativeScrollRef();
906
- if (component == null) {
907
- return;
908
- }
909
- Commands.flashScrollIndicators(component);
910
- };
926
+ flashScrollIndicators: ScrollViewImperativeMethods['flashScrollIndicators'] =
927
+ () => {
928
+ const component = this.getNativeScrollRef();
929
+ if (component == null) {
930
+ return;
931
+ }
932
+ Commands.flashScrollIndicators(component);
933
+ };
911
934
 
912
935
  /**
913
936
  * This method should be used as the callback to onFocus in a TextInputs'
@@ -919,39 +942,36 @@ class ScrollView extends React.Component<ScrollViewProps, State> {
919
942
  * @param {bool} preventNegativeScrolling Whether to allow pulling the content
920
943
  * down to make it meet the keyboard's top. Default is false.
921
944
  */
922
- scrollResponderScrollNativeHandleToKeyboard: (
923
- nodeHandle: number | HostInstance,
924
- additionalOffset?: number,
925
- preventNegativeScrollOffset?: boolean,
926
- ) => void = (
927
- nodeHandle: number | HostInstance,
928
- additionalOffset?: number,
929
- preventNegativeScrollOffset?: boolean,
930
- ) => {
931
- this._additionalScrollOffset = additionalOffset || 0;
932
- this._preventNegativeScrollOffset = !!preventNegativeScrollOffset;
933
-
934
- if (this._innerView.nativeInstance == null) {
935
- return;
936
- }
945
+ scrollResponderScrollNativeHandleToKeyboard: ScrollViewImperativeMethods['scrollResponderScrollNativeHandleToKeyboard'] =
946
+ (
947
+ nodeHandle: number | HostInstance,
948
+ additionalOffset?: number,
949
+ preventNegativeScrollOffset?: boolean,
950
+ ) => {
951
+ this._additionalScrollOffset = additionalOffset || 0;
952
+ this._preventNegativeScrollOffset = !!preventNegativeScrollOffset;
953
+
954
+ if (this._innerView.nativeInstance == null) {
955
+ return;
956
+ }
937
957
 
938
- if (typeof nodeHandle === 'number') {
939
- UIManager.measureLayout(
940
- nodeHandle,
941
- nullthrows(findNodeHandle<$FlowFixMe>(this)),
942
- // $FlowFixMe[method-unbinding] added when improving typing for this parameters
943
- this._textInputFocusError,
944
- this._inputMeasureAndScrollToKeyboard,
945
- );
946
- } else {
947
- nodeHandle.measureLayout(
948
- this._innerView.nativeInstance,
949
- this._inputMeasureAndScrollToKeyboard,
950
- // $FlowFixMe[method-unbinding] added when improving typing for this parameters
951
- this._textInputFocusError,
952
- );
953
- }
954
- };
958
+ if (typeof nodeHandle === 'number') {
959
+ UIManager.measureLayout(
960
+ nodeHandle,
961
+ nullthrows(findNodeHandle<$FlowFixMe>(this)),
962
+ // $FlowFixMe[method-unbinding] added when improving typing for this parameters
963
+ this._textInputFocusError,
964
+ this._inputMeasureAndScrollToKeyboard,
965
+ );
966
+ } else {
967
+ nodeHandle.measureLayout(
968
+ this._innerView.nativeInstance,
969
+ this._inputMeasureAndScrollToKeyboard,
970
+ // $FlowFixMe[method-unbinding] added when improving typing for this parameters
971
+ this._textInputFocusError,
972
+ );
973
+ }
974
+ };
955
975
 
956
976
  /**
957
977
  * A helper function to zoom to a specific rect in the scrollview. The argument has the shape
@@ -959,41 +979,33 @@ class ScrollView extends React.Component<ScrollViewProps, State> {
959
979
  *
960
980
  * @platform ios
961
981
  */
962
- scrollResponderZoomTo: (
963
- rect: {
964
- x: number,
965
- y: number,
966
- width: number,
967
- height: number,
968
- animated?: boolean,
969
- },
970
- animated?: boolean, // deprecated, put this inside the rect argument instead
971
- ) => void = (
972
- rect: {
973
- x: number,
974
- y: number,
975
- width: number,
976
- height: number,
977
- animated?: boolean,
978
- },
979
- animated?: boolean, // deprecated, put this inside the rect argument instead
980
- ) => {
981
- invariant(Platform.OS === 'ios', 'zoomToRect is not implemented');
982
- if ('animated' in rect) {
983
- this._animated = rect.animated;
984
- delete rect.animated;
985
- } else if (typeof animated !== 'undefined') {
986
- console.warn(
987
- '`scrollResponderZoomTo` `animated` argument is deprecated. Use `options.animated` instead',
988
- );
989
- }
982
+ scrollResponderZoomTo: ScrollViewImperativeMethods['scrollResponderZoomTo'] =
983
+ (
984
+ rect: {
985
+ x: number,
986
+ y: number,
987
+ width: number,
988
+ height: number,
989
+ animated?: boolean,
990
+ },
991
+ animated?: boolean, // deprecated, put this inside the rect argument instead
992
+ ) => {
993
+ invariant(Platform.OS === 'ios', 'zoomToRect is not implemented');
994
+ if ('animated' in rect) {
995
+ this._animated = rect.animated;
996
+ delete rect.animated;
997
+ } else if (typeof animated !== 'undefined') {
998
+ console.warn(
999
+ '`scrollResponderZoomTo` `animated` argument is deprecated. Use `options.animated` instead',
1000
+ );
1001
+ }
990
1002
 
991
- const component = this.getNativeScrollRef();
992
- if (component == null) {
993
- return;
994
- }
995
- Commands.zoomToRect(component, rect, animated !== false);
996
- };
1003
+ const component = this.getNativeScrollRef();
1004
+ if (component == null) {
1005
+ return;
1006
+ }
1007
+ Commands.zoomToRect(component, rect, animated !== false);
1008
+ };
997
1009
 
998
1010
  _textInputFocusError() {
999
1011
  console.warn('Error measuring text field.');
@@ -1898,7 +1910,7 @@ function createRefForwarder<TNativeInstance, TPublicInstance>(
1898
1910
  // NOTE: This wrapper component is necessary because `ScrollView` is a class
1899
1911
  // component and we need to map `ref` to a differently named prop. This can be
1900
1912
  // removed when `ScrollView` is a functional component.
1901
- const Wrapper: component(
1913
+ const ScrollViewWrapper: component(
1902
1914
  ref?: React.RefSetter<PublicScrollViewInstance>,
1903
1915
  ...props: ScrollViewProps
1904
1916
  ) = React.forwardRef(function Wrapper(
@@ -1911,9 +1923,9 @@ const Wrapper: component(
1911
1923
  <ScrollView {...props} scrollViewRef={ref} />
1912
1924
  );
1913
1925
  });
1914
- Wrapper.displayName = 'ScrollView';
1926
+ ScrollViewWrapper.displayName = 'ScrollView';
1915
1927
  // $FlowExpectedError[prop-missing]
1916
- Wrapper.Context = ScrollViewContext;
1928
+ ScrollViewWrapper.Context = ScrollViewContext;
1917
1929
 
1918
- export default ((Wrapper: $FlowFixMe): typeof Wrapper &
1930
+ export default ((ScrollViewWrapper: $FlowFixMe): typeof ScrollViewWrapper &
1919
1931
  ScrollViewComponentStatics);
@@ -10,7 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- import React from 'react';
13
+ import * as React from 'react';
14
14
 
15
15
  type Props = $ReadOnly<{
16
16
  /**
@@ -70,7 +70,7 @@ export type SubmitBehavior = 'submit' | 'blurAndSubmit' | 'newline';
70
70
  export type NativeProps = $ReadOnly<{
71
71
  // This allows us to inherit everything from ViewProps except for style (see below)
72
72
  // This must be commented for Fabric codegen to work.
73
- ...$Diff<ViewProps, $ReadOnly<{style: ?ViewStyleProp}>>,
73
+ ...Omit<ViewProps, 'style'>,
74
74
 
75
75
  /**
76
76
  * Android props after this