@office-iss/react-native-win32 0.0.0-canary.291 → 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.
- package/.flowconfig +1 -1
- package/CHANGELOG.json +16 -1
- package/CHANGELOG.md +12 -4
- package/Libraries/Alert/RCTAlertManager.js +17 -0
- package/Libraries/Animated/AnimatedEvent.js +4 -3
- package/Libraries/Animated/AnimatedExports.js.flow +2 -0
- package/Libraries/Animated/AnimatedImplementation.js +2 -2
- package/Libraries/Animated/components/AnimatedScrollView.js +48 -43
- package/Libraries/Animated/nodes/AnimatedValue.js +2 -1
- package/Libraries/BatchedBridge/MessageQueue.js +2 -2
- package/Libraries/Blob/FileReader.js +219 -8
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js +17 -0
- package/Libraries/Components/Button.js +1 -1
- package/Libraries/Components/Button.win32.js +1 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -3
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js +15 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +6 -66
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js.flow +18 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidFallback.js +71 -0
- package/Libraries/Components/Keyboard/Keyboard.js +4 -2
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +6 -3
- package/Libraries/Components/Pressable/Pressable.js +2 -0
- package/Libraries/Components/Pressable/Pressable.win32.js +2 -0
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +12 -2
- package/Libraries/Components/RefreshControl/RefreshControl.js +1 -1
- package/Libraries/Components/ScrollView/ScrollView.js +128 -116
- package/Libraries/Components/StaticRenderer.js +1 -1
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +1 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -4
- package/Libraries/Components/TextInput/TextInput.flow.js +35 -43
- package/Libraries/Components/TextInput/TextInput.flow.win32.js +1184 -0
- package/Libraries/Components/TextInput/TextInput.js +65 -1005
- package/Libraries/Components/TextInput/TextInput.win32.js +67 -1037
- package/Libraries/Components/ToastAndroid/ToastAndroid.ios.js +13 -0
- package/Libraries/Components/ToastAndroid/ToastAndroid.js +4 -32
- package/Libraries/Components/ToastAndroid/ToastAndroid.js.flow +109 -0
- package/Libraries/Components/ToastAndroid/ToastAndroid.win32.js +4 -32
- package/Libraries/Components/ToastAndroid/ToastAndroidFallback.js +45 -0
- package/Libraries/Components/Touchable/Touchable.js +5 -5
- package/Libraries/Components/Touchable/Touchable.win32.js +5 -5
- package/Libraries/Components/Touchable/TouchableBounce.js +12 -6
- package/Libraries/Components/Touchable/TouchableHighlight.js +9 -6
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +4 -4
- package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +4 -4
- package/Libraries/Components/Touchable/TouchableOpacity.js +11 -5
- package/Libraries/Components/View/ViewAccessibility.js +7 -0
- package/Libraries/Components/View/ViewAccessibility.win32.js +7 -0
- package/Libraries/Components/View/ViewPropTypes.js +1 -1
- package/Libraries/Components/View/ViewPropTypes.win32.js +1 -1
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/EventEmitter/NativeEventEmitter.js +4 -1
- package/Libraries/Image/Image.js +17 -0
- package/Libraries/Image/Image.js.flow +2 -2
- package/Libraries/Image/ImageInjection.js +1 -1
- package/Libraries/Image/ImageProps.js +5 -4
- package/Libraries/Image/ImageTypes.flow.js +1 -1
- package/Libraries/Lists/FlatList.js +1 -1
- package/Libraries/Lists/SectionList.js +1 -1
- package/Libraries/Lists/SectionListModern.js +2 -1
- package/Libraries/LogBox/LogBoxNotificationContainer.js +1 -1
- package/Libraries/Modal/Modal.js +3 -3
- package/Libraries/NativeComponent/BaseViewConfig.js +17 -0
- package/Libraries/NativeComponent/PlatformBaseViewConfig.js +2 -2
- package/Libraries/Network/RCTNetworking.js +17 -0
- package/Libraries/Network/XMLHttpRequest.js +781 -10
- package/Libraries/NewAppScreen/components/DebugInstructions.js +1 -1
- package/Libraries/NewAppScreen/components/Header.js +1 -1
- package/Libraries/NewAppScreen/components/HermesBadge.js +1 -1
- package/Libraries/NewAppScreen/components/LearnMoreLinks.js +3 -3
- package/Libraries/NewAppScreen/components/ReloadInstructions.js +1 -1
- package/Libraries/Performance/Systrace.js +7 -7
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +2 -2
- package/Libraries/Settings/Settings.js +13 -19
- package/Libraries/Settings/Settings.win32.js +19 -20
- package/Libraries/Settings/SettingsFallback.js +33 -0
- package/Libraries/StyleSheet/PlatformColorValueTypes.js +15 -0
- package/Libraries/StyleSheet/Rect.js +1 -0
- package/Libraries/StyleSheet/StyleSheet.js.flow +3 -3
- package/Libraries/StyleSheet/StyleSheetTypes.js +28 -30
- package/Libraries/StyleSheet/flattenStyle.js +7 -1
- package/Libraries/Text/Text.js +3 -3
- package/Libraries/Text/Text.win32.js +3 -3
- package/Libraries/Text/TextProps.js +1 -1
- package/Libraries/Text/TextProps.win32.js +1 -1
- package/Libraries/Utilities/Appearance.js +2 -0
- package/Libraries/Utilities/BackHandler.js +17 -0
- package/Libraries/Utilities/Platform.js +17 -0
- package/Libraries/Utilities/PlatformTypes.js +2 -0
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
- package/Libraries/WebSocket/WebSocket.js +313 -8
- package/flow/global.js +0 -2
- package/index.win32.js +5 -5
- package/overrides.json +23 -17
- package/package.json +12 -12
- package/src/private/animated/NativeAnimatedHelper.js +1 -1
- package/src/private/animated/NativeAnimatedHelper.win32.js +1 -1
- package/src/private/animated/createAnimatedPropsHook.js +2 -27
- package/src/private/components/{SafeAreaView_INTERNAL_DO_NOT_USE.js → safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js} +6 -6
- package/src/private/components/{HScrollViewNativeComponents.js → scrollview/HScrollViewNativeComponents.js} +8 -8
- package/src/private/components/scrollview/VScrollViewNativeComponents.js +25 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +21 -32
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -6
- package/src/private/inspector/BorderBox.js +1 -1
- package/src/private/inspector/BoxInspector.js +1 -1
- package/src/private/inspector/ElementBox.js +1 -1
- package/src/private/inspector/ElementProperties.js +1 -1
- package/src/private/inspector/Inspector.js +2 -2
- package/src/private/inspector/InspectorOverlay.js +1 -1
- package/src/private/inspector/InspectorPanel.js +1 -1
- package/src/private/inspector/NetworkOverlay.js +1 -1
- package/src/private/inspector/PerformanceOverlay.js +1 -1
- package/src/private/inspector/StyleInspector.js +1 -1
- package/src/private/types/HostComponent.js +1 -1
- package/src/private/types/HostInstance.js +10 -2
- package/src/private/webapis/performance/Performance.js +1 -3
- package/Libraries/Blob/FileReader_new.js +0 -231
- package/Libraries/Blob/FileReader_old.js +0 -186
- package/Libraries/Events/CustomEvent.js +0 -32
- package/Libraries/Events/EventPolyfill.js +0 -239
- package/Libraries/Network/XMLHttpRequest_new.js +0 -794
- package/Libraries/Network/XMLHttpRequest_old.js +0 -701
- package/Libraries/WebSocket/WebSocketEvent.js +0 -30
- package/Libraries/WebSocket/WebSocket_new.js +0 -325
- package/Libraries/WebSocket/WebSocket_old.js +0 -297
- package/Libraries/WebSocket/__mocks__/event-target-shim.js +0 -27
- package/src/private/components/VScrollViewNativeComponents.js +0 -25
- package/src/types/third_party/event-target-shim.d.ts +0 -392
|
@@ -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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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(
|
|
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});
|
|
@@ -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
|
-
|
|
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:
|
|
138
|
-
+getScrollableNode:
|
|
139
|
-
+getInnerViewNode:
|
|
140
|
-
+getInnerViewRef:
|
|
141
|
-
+getNativeScrollRef:
|
|
142
|
-
+scrollTo:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
|
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,
|
|
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:
|
|
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:
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
843
|
+
getScrollResponder: ScrollViewImperativeMethods['getScrollResponder'] =
|
|
844
|
+
() => {
|
|
845
|
+
// $FlowFixMe[unclear-type]
|
|
846
|
+
return ((this: any): ScrollResponderType);
|
|
847
|
+
};
|
|
827
848
|
|
|
828
|
-
getScrollableNode:
|
|
849
|
+
getScrollableNode: ScrollViewImperativeMethods['getScrollableNode'] = () => {
|
|
829
850
|
return findNodeHandle<$FlowFixMe>(this.getNativeScrollRef());
|
|
830
851
|
};
|
|
831
852
|
|
|
832
|
-
getInnerViewNode:
|
|
853
|
+
getInnerViewNode: ScrollViewImperativeMethods['getInnerViewNode'] = () => {
|
|
833
854
|
return findNodeHandle<$FlowFixMe>(this._innerView.nativeInstance);
|
|
834
855
|
};
|
|
835
856
|
|
|
836
|
-
getInnerViewRef:
|
|
857
|
+
getInnerViewRef: ScrollViewImperativeMethods['getInnerViewRef'] = () => {
|
|
837
858
|
return this._innerView.nativeInstance;
|
|
838
859
|
};
|
|
839
860
|
|
|
840
|
-
getNativeScrollRef:
|
|
841
|
-
|
|
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
|
|
857
|
-
deprecatedX
|
|
858
|
-
deprecatedAnimated
|
|
859
|
-
) =>
|
|
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:
|
|
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:
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
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
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
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
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
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
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
animated
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
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
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
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
|
|
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
|
-
|
|
1926
|
+
ScrollViewWrapper.displayName = 'ScrollView';
|
|
1915
1927
|
// $FlowExpectedError[prop-missing]
|
|
1916
|
-
|
|
1928
|
+
ScrollViewWrapper.Context = ScrollViewContext;
|
|
1917
1929
|
|
|
1918
|
-
export default ((
|
|
1930
|
+
export default ((ScrollViewWrapper: $FlowFixMe): typeof ScrollViewWrapper &
|
|
1919
1931
|
ScrollViewComponentStatics);
|
|
@@ -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
|
-
|
|
73
|
+
...Omit<ViewProps, 'style'>,
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* Android props after this
|
|
@@ -12,10 +12,7 @@ import type {PartialViewConfig} from '../../Renderer/shims/ReactNativeTypes';
|
|
|
12
12
|
|
|
13
13
|
import {ConditionallyIgnoredEventHandlers} from '../../NativeComponent/ViewConfigIgnore';
|
|
14
14
|
|
|
15
|
-
type PartialViewConfigWithoutName =
|
|
16
|
-
PartialViewConfig,
|
|
17
|
-
{uiViewClassName: string},
|
|
18
|
-
>;
|
|
15
|
+
type PartialViewConfigWithoutName = Omit<PartialViewConfig, 'uiViewClassName'>;
|
|
19
16
|
|
|
20
17
|
const RCTTextInputViewConfig = {
|
|
21
18
|
bubblingEventTypes: {
|