@office-iss/react-native-win32 0.0.0-canary.286 → 0.0.0-canary.288
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.flowconfig +4 -1
- package/CHANGELOG.json +57 -1
- package/CHANGELOG.md +23 -4
- package/Libraries/Alert/RCTAlertManager.js.flow +18 -0
- package/Libraries/Animated/Animated.js +8 -37
- package/Libraries/Animated/Animated.js.flow +15 -0
- package/Libraries/Animated/AnimatedExports.js +47 -0
- package/Libraries/Animated/AnimatedExports.js.flow +48 -0
- package/Libraries/Animated/useAnimatedValue.js +1 -3
- package/Libraries/Blob/URLSearchParams.js.flow +23 -0
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js.flow +20 -0
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +8 -8
- package/Libraries/Components/Button.js +2 -2
- package/Libraries/Components/Button.win32.js +2 -2
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +14 -100
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +64 -4
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +138 -0
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -4
- package/Libraries/Components/LayoutConformance/LayoutConformance.js +6 -4
- package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +1 -1
- package/Libraries/Components/Pressable/Pressable.js +18 -63
- package/Libraries/Components/Pressable/Pressable.win32.js +19 -65
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +4 -46
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +10 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +54 -0
- package/Libraries/Components/RefreshControl/RefreshControl.js +10 -7
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +2 -1
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +1 -1
- package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +1 -1
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +2 -4
- package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +2 -4
- package/Libraries/Components/ScrollView/ScrollView.js +43 -59
- package/Libraries/Components/ScrollView/ScrollViewCommands.js +1 -1
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +2 -4
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +6 -7
- package/Libraries/Components/StatusBar/StatusBar.js +33 -22
- package/Libraries/Components/Switch/Switch.js +70 -41
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +2 -4
- package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +2 -4
- package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +2 -4
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
- package/Libraries/Components/TextInput/TextInput.flow.js +10 -12
- package/Libraries/Components/TextInput/TextInput.js +22 -28
- package/Libraries/Components/TextInput/TextInput.win32.js +22 -28
- package/Libraries/Components/TextInput/TextInputState.js +2 -18
- package/Libraries/Components/TextInput/TextInputState.win32.js +2 -18
- package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +1 -1
- package/Libraries/Components/Touchable/Touchable.js +7 -7
- package/Libraries/Components/Touchable/Touchable.win32.js +7 -7
- package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
- package/Libraries/Components/Touchable/TouchableHighlight.js +35 -14
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +95 -47
- package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +248 -43
- package/Libraries/Components/Touchable/TouchableOpacity.js +52 -10
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +112 -59
- package/Libraries/Components/View/View.js +1 -1
- package/Libraries/Components/View/View.win32.js +1 -1
- package/Libraries/Components/View/ViewNativeComponent.js +2 -4
- package/Libraries/Components/View/ViewPropTypes.js +15 -12
- package/Libraries/Components/View/ViewPropTypes.win32.js +74 -71
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/setUpReactDevTools.js +2 -0
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +10 -7
- package/Libraries/Image/Image.android.js +1 -1
- package/Libraries/Image/Image.js.flow +27 -0
- package/Libraries/Image/ImageBackground.js +1 -1
- package/Libraries/Image/ImageProps.js +97 -30
- package/Libraries/Image/ImageTypes.flow.js +16 -6
- package/Libraries/Image/ImageViewNativeComponent.js +3 -5
- package/Libraries/Image/TextInlineImageNativeComponent.js +2 -4
- package/Libraries/Interaction/InteractionManager.js +9 -1
- package/Libraries/Interaction/PanResponder.js +11 -11
- package/Libraries/Interaction/TaskQueue.js +2 -2
- package/Libraries/Lists/FlatList.js +8 -7
- package/Libraries/LogBox/LogBox.js +1 -1
- package/Libraries/NativeComponent/BaseViewConfig.js.flow +14 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
- package/Libraries/Network/RCTNetworking.js.flow +44 -0
- package/Libraries/Network/XMLHttpRequest_new.js +3 -0
- package/Libraries/Network/XMLHttpRequest_old.js +3 -0
- package/Libraries/Pressability/HoverState.js +1 -0
- package/Libraries/Pressability/HoverState.win32.js +1 -0
- package/Libraries/Pressability/Pressability.js +2 -2
- package/Libraries/Pressability/Pressability.win32.js +3 -3
- package/Libraries/ReactNative/FabricUIManager.js +5 -3
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +7 -5
- package/Libraries/ReactNative/RendererImplementation.js +3 -5
- package/Libraries/ReactNative/requireNativeComponent.js +1 -1
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +12 -0
- package/Libraries/Renderer/shims/ReactNativeTypes.js +39 -91
- package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +22 -0
- package/Libraries/Text/Text.d.ts +1 -1
- package/Libraries/Text/Text.js +3 -1
- package/Libraries/Text/Text.win32.js +3 -1
- package/Libraries/Text/TextNativeComponent.js +1 -1
- package/Libraries/Text/TextNativeComponent.win32.js +1 -1
- package/Libraries/Text/TextProps.js +124 -84
- package/Libraries/Text/TextProps.win32.js +124 -84
- package/Libraries/Types/CoreEventTypes.js +1 -1
- package/Libraries/Types/CoreEventTypes.win32.js +1 -1
- package/Libraries/Types/ReactDevToolsTypes.js +4 -8
- package/Libraries/Utilities/BackHandler.js.flow +25 -0
- package/Libraries/Utilities/DevSettings.js +14 -0
- package/Libraries/Utilities/Dimensions.js +5 -0
- package/Libraries/Utilities/Dimensions.win32.js +5 -0
- package/{flow/Position.js → Libraries/Utilities/Platform.js.flow} +3 -6
- package/Libraries/Utilities/PlatformTypes.js +97 -7
- package/Libraries/Utilities/codegenNativeComponent.js +1 -1
- package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +2 -4
- package/index.win32.js +3 -4
- package/overrides.json +24 -24
- package/package.json +15 -16
- package/src/private/components/HScrollViewNativeComponents.js +1 -1
- package/src/private/components/VScrollViewNativeComponents.js +1 -1
- package/src/private/featureflags/ReactNativeFeatureFlags.js +11 -6
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +3 -2
- package/src/private/inspector/getInspectorDataForViewAtPoint.js +2 -4
- package/src/private/setup/setUpDOM.js +36 -1
- package/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js +1 -1
- package/src/private/types/HostComponent.js +16 -0
- package/src/private/types/HostInstance.js +50 -0
- package/src/private/webapis/dom/nodes/ReactNativeDocument.js +1 -0
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +40 -32
- package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +1 -1
- package/src/private/webapis/dom/nodes/ReadOnlyElement.js +1 -1
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +1 -1
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +4 -4
- package/src/private/webapis/mutationobserver/MutationObserver.js +9 -9
- package/src/private/webapis/performance/PerformanceObserver.js +6 -6
- package/src/types/globals.d.ts +628 -0
- package/src-win/Libraries/Text/Text.d.ts +1 -1
- package/types/index.d.ts +2 -53
- package/types/modules/globals.d.ts +0 -599
|
@@ -10,9 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
import typeof UnimplementedViewType from '../UnimplementedViews/UnimplementedView';
|
|
14
13
|
import typeof ProgressBarAndroidNativeComponentType from './ProgressBarAndroidNativeComponent';
|
|
14
|
+
import type {ProgressBarAndroidProps} from './ProgressBarAndroidTypes';
|
|
15
15
|
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
export type {ProgressBarAndroidProps};
|
|
17
|
+
|
|
18
|
+
export default require('../UnimplementedViews/UnimplementedView')
|
|
19
|
+
.default as $FlowFixMe as component(
|
|
20
|
+
ref?: React.RefSetter<
|
|
21
|
+
React.ElementRef<ProgressBarAndroidNativeComponentType>,
|
|
22
|
+
>,
|
|
23
|
+
...props: ProgressBarAndroidProps
|
|
24
|
+
);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
|
12
|
+
import type {ViewProps} from '../View/ViewPropTypes';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Style of the ProgressBar and whether it shows indeterminate progress (e.g. spinner).
|
|
16
|
+
*
|
|
17
|
+
* `indeterminate` can only be false if `styleAttr` is Horizontal, and requires a
|
|
18
|
+
* `progress` value.
|
|
19
|
+
*/
|
|
20
|
+
type ProgressBarAndroidStyleAttrProp =
|
|
21
|
+
| {
|
|
22
|
+
styleAttr: 'Horizontal',
|
|
23
|
+
indeterminate: false,
|
|
24
|
+
progress: number,
|
|
25
|
+
}
|
|
26
|
+
| {
|
|
27
|
+
styleAttr:
|
|
28
|
+
| 'Horizontal'
|
|
29
|
+
| 'Normal'
|
|
30
|
+
| 'Small'
|
|
31
|
+
| 'Large'
|
|
32
|
+
| 'Inverse'
|
|
33
|
+
| 'SmallInverse'
|
|
34
|
+
| 'LargeInverse',
|
|
35
|
+
indeterminate: true,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type ProgressBarAndroidProps = $ReadOnly<{
|
|
39
|
+
...ViewProps,
|
|
40
|
+
...ProgressBarAndroidStyleAttrProp,
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Whether to show the ProgressBar (true, the default) or hide it (false).
|
|
44
|
+
*/
|
|
45
|
+
animating?: ?boolean,
|
|
46
|
+
/**
|
|
47
|
+
* Color of the progress bar.
|
|
48
|
+
*/
|
|
49
|
+
color?: ?ColorValue,
|
|
50
|
+
/**
|
|
51
|
+
* Used to locate this view in end-to-end tests.
|
|
52
|
+
*/
|
|
53
|
+
testID?: ?string,
|
|
54
|
+
}>;
|
|
@@ -21,7 +21,7 @@ import React from 'react';
|
|
|
21
21
|
|
|
22
22
|
const Platform = require('../../Utilities/Platform').default;
|
|
23
23
|
|
|
24
|
-
type
|
|
24
|
+
export type RefreshControlPropsIOS = $ReadOnly<{
|
|
25
25
|
/**
|
|
26
26
|
* The color of the refresh indicator.
|
|
27
27
|
*/
|
|
@@ -36,7 +36,7 @@ type IOSProps = $ReadOnly<{
|
|
|
36
36
|
title?: ?string,
|
|
37
37
|
}>;
|
|
38
38
|
|
|
39
|
-
type
|
|
39
|
+
export type RefreshControlPropsAndroid = $ReadOnly<{
|
|
40
40
|
/**
|
|
41
41
|
* Whether the pull to refresh functionality is enabled.
|
|
42
42
|
*/
|
|
@@ -55,11 +55,7 @@ type AndroidProps = $ReadOnly<{
|
|
|
55
55
|
size?: ?('default' | 'large'),
|
|
56
56
|
}>;
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
...ViewProps,
|
|
60
|
-
...IOSProps,
|
|
61
|
-
...AndroidProps,
|
|
62
|
-
|
|
58
|
+
type RefreshControlBaseProps = $ReadOnly<{
|
|
63
59
|
/**
|
|
64
60
|
* Called when the view starts refreshing.
|
|
65
61
|
*/
|
|
@@ -76,6 +72,13 @@ export type RefreshControlProps = $ReadOnly<{
|
|
|
76
72
|
progressViewOffset?: ?number,
|
|
77
73
|
}>;
|
|
78
74
|
|
|
75
|
+
export type RefreshControlProps = $ReadOnly<{
|
|
76
|
+
...ViewProps,
|
|
77
|
+
...RefreshControlPropsIOS,
|
|
78
|
+
...RefreshControlPropsAndroid,
|
|
79
|
+
...RefreshControlBaseProps,
|
|
80
|
+
}>;
|
|
81
|
+
|
|
79
82
|
/**
|
|
80
83
|
* This component is used inside a ScrollView or ListView to add pull to refresh
|
|
81
84
|
* functionality. When the ScrollView is at `scrollY: 0`, swiping down
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
import type {HostComponent} from '../../../../src/private/types/HostComponent';
|
|
13
14
|
|
|
14
15
|
import requireNativeComponent from '../../../ReactNative/requireNativeComponent';
|
|
15
16
|
import * as React from 'react';
|
|
@@ -24,7 +24,7 @@ import * as React from 'react';
|
|
|
24
24
|
* sensor housing area on iPhone X).
|
|
25
25
|
*/
|
|
26
26
|
const exported: component(
|
|
27
|
-
ref
|
|
27
|
+
ref?: React.RefSetter<React.ElementRef<typeof View>>,
|
|
28
28
|
...props: ViewProps
|
|
29
29
|
) = Platform.select({
|
|
30
30
|
ios: require('./RCTSafeAreaViewNativeComponent').default,
|
|
@@ -24,7 +24,7 @@ import * as React from 'react';
|
|
|
24
24
|
* sensor housing area on iPhone X).
|
|
25
25
|
*/
|
|
26
26
|
const exported: component(
|
|
27
|
-
ref
|
|
27
|
+
ref?: React.RefSetter<React.ElementRef<typeof View>>,
|
|
28
28
|
...props: ViewProps
|
|
29
29
|
) = Platform.select({
|
|
30
30
|
ios: require('./RCTSafeAreaViewNativeComponent').default,
|
|
@@ -8,10 +8,8 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
12
|
-
|
|
13
|
-
PartialViewConfig,
|
|
14
|
-
} from '../../Renderer/shims/ReactNativeTypes';
|
|
11
|
+
import type {HostComponent} from '../../../src/private/types/HostComponent';
|
|
12
|
+
import type {PartialViewConfig} from '../../Renderer/shims/ReactNativeTypes';
|
|
15
13
|
import type {ScrollViewNativeProps as Props} from './ScrollViewNativeComponentType';
|
|
16
14
|
|
|
17
15
|
import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry';
|
|
@@ -8,10 +8,8 @@
|
|
|
8
8
|
* @flow strict-local
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
12
|
-
|
|
13
|
-
PartialViewConfig,
|
|
14
|
-
} from '../../Renderer/shims/ReactNativeTypes';
|
|
11
|
+
import type {HostComponent} from '../../../src/private/types/HostComponent';
|
|
12
|
+
import type {PartialViewConfig} from '../../Renderer/shims/ReactNativeTypes';
|
|
15
13
|
import type {ViewProps as Props} from '../View/ViewPropTypes';
|
|
16
14
|
|
|
17
15
|
import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry';
|
|
@@ -8,21 +8,21 @@
|
|
|
8
8
|
* @flow strict-local
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {HostInstance} from '
|
|
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 {
|
|
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
|
|
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
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}>;
|
|
155
|
+
export interface PublicScrollViewInstance
|
|
156
|
+
extends HostInstance,
|
|
157
|
+
ScrollViewImperativeMethods {}
|
|
153
158
|
|
|
154
159
|
type InnerViewInstance = React.ElementRef<View>;
|
|
155
160
|
|
|
156
|
-
type
|
|
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
|
|
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
|
|
379
|
+
export type ScrollViewProps = $ReadOnly<{
|
|
375
380
|
...ViewProps,
|
|
376
|
-
...
|
|
377
|
-
...
|
|
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?: ?
|
|
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<
|
|
706
|
+
class ScrollView extends React.Component<ScrollViewProps, State> {
|
|
702
707
|
static Context: typeof ScrollViewContext = ScrollViewContext;
|
|
703
708
|
|
|
704
|
-
constructor(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:
|
|
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?: ?
|
|
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-
|
|
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
|
|
1922
|
-
...props:
|
|
1905
|
+
ref?: React.RefSetter<PublicScrollViewInstance>,
|
|
1906
|
+
...props: ScrollViewProps
|
|
1923
1907
|
) = React.forwardRef(function Wrapper(
|
|
1924
|
-
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 '
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
114
|
+
value: StatusBarProps['backgroundColor'],
|
|
111
115
|
animated: boolean,
|
|
112
116
|
},
|
|
113
117
|
barStyle: ?{
|
|
114
|
-
value:
|
|
118
|
+
value: StatusBarProps['barStyle'],
|
|
115
119
|
animated: boolean,
|
|
116
120
|
},
|
|
117
|
-
translucent:
|
|
121
|
+
translucent: StatusBarProps['translucent'],
|
|
118
122
|
hidden: ?{
|
|
119
123
|
value: boolean,
|
|
120
124
|
animated: boolean,
|
|
121
|
-
transition:
|
|
125
|
+
transition: StatusBarProps['showHideTransition'],
|
|
122
126
|
},
|
|
123
|
-
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:
|
|
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<
|
|
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:
|
|
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:
|
|
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:
|
|
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(
|
|
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
|
-
|
|
410
|
+
if (this._stackEntry != null) {
|
|
411
|
+
StatusBar.popStackEntry(this._stackEntry);
|
|
412
|
+
}
|
|
404
413
|
}
|
|
405
414
|
|
|
406
415
|
componentDidUpdate() {
|
|
407
|
-
this._stackEntry
|
|
408
|
-
this._stackEntry
|
|
409
|
-
|
|
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
|
/**
|