@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,8 +10,68 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
//
|
|
14
|
-
import
|
|
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
24
|
|
|
16
|
-
|
|
17
|
-
|
|
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
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
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
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {
|
|
12
|
+
MeasureInWindowOnSuccessCallback,
|
|
13
|
+
MeasureLayoutOnSuccessCallback,
|
|
14
|
+
MeasureOnSuccessCallback,
|
|
15
|
+
} from '../../../src/private/types/HostInstance';
|
|
16
|
+
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
|
17
|
+
import type {NativeSyntheticEvent} from '../../Types/CoreEventTypes';
|
|
18
|
+
import type {ViewProps} from '../View/ViewPropTypes';
|
|
19
|
+
|
|
20
|
+
import * as React from 'react';
|
|
21
|
+
|
|
22
|
+
export type DrawerStates = 'Idle' | 'Dragging' | 'Settling';
|
|
23
|
+
|
|
24
|
+
export type DrawerSlideEvent = NativeSyntheticEvent<
|
|
25
|
+
$ReadOnly<{
|
|
26
|
+
offset: number,
|
|
27
|
+
}>,
|
|
28
|
+
>;
|
|
29
|
+
|
|
30
|
+
export type DrawerLayoutAndroidProps = $ReadOnly<{
|
|
31
|
+
...ViewProps,
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Determines whether the keyboard gets dismissed in response to a drag.
|
|
35
|
+
* - 'none' (the default), drags do not dismiss the keyboard.
|
|
36
|
+
* - 'on-drag', the keyboard is dismissed when a drag begins.
|
|
37
|
+
*/
|
|
38
|
+
keyboardDismissMode?: ?('none' | 'on-drag'),
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Specifies the background color of the drawer. The default value is white.
|
|
42
|
+
* If you want to set the opacity of the drawer, use rgba. Example:
|
|
43
|
+
*
|
|
44
|
+
* ```
|
|
45
|
+
* return (
|
|
46
|
+
* <DrawerLayoutAndroid drawerBackgroundColor="rgba(0,0,0,0.5)">
|
|
47
|
+
* </DrawerLayoutAndroid>
|
|
48
|
+
* );
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
drawerBackgroundColor?: ?ColorValue,
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Specifies the side of the screen from which the drawer will slide in.
|
|
55
|
+
*/
|
|
56
|
+
drawerPosition: ?('left' | 'right'),
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Specifies the width of the drawer, more precisely the width of the view that be pulled in
|
|
60
|
+
* from the edge of the window.
|
|
61
|
+
*/
|
|
62
|
+
drawerWidth?: ?number,
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Specifies the lock mode of the drawer. The drawer can be locked in 3 states:
|
|
66
|
+
* - unlocked (default), meaning that the drawer will respond (open/close) to touch gestures.
|
|
67
|
+
* - locked-closed, meaning that the drawer will stay closed and not respond to gestures.
|
|
68
|
+
* - locked-open, meaning that the drawer will stay opened and not respond to gestures.
|
|
69
|
+
* The drawer may still be opened and closed programmatically (`openDrawer`/`closeDrawer`).
|
|
70
|
+
*/
|
|
71
|
+
drawerLockMode?: ?('unlocked' | 'locked-closed' | 'locked-open'),
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Function called whenever there is an interaction with the navigation view.
|
|
75
|
+
*/
|
|
76
|
+
onDrawerSlide?: ?(event: DrawerSlideEvent) => mixed,
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Function called when the drawer state has changed. The drawer can be in 3 states:
|
|
80
|
+
* - Idle, meaning there is no interaction with the navigation view happening at the time
|
|
81
|
+
* - Dragging, meaning there is currently an interaction with the navigation view
|
|
82
|
+
* - Settling, meaning that there was an interaction with the navigation view, and the
|
|
83
|
+
* navigation view is now finishing its closing or opening animation
|
|
84
|
+
*/
|
|
85
|
+
onDrawerStateChanged?: ?(state: DrawerStates) => mixed,
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Function called whenever the navigation view has been opened.
|
|
89
|
+
*/
|
|
90
|
+
onDrawerOpen?: ?() => mixed,
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Function called whenever the navigation view has been closed.
|
|
94
|
+
*/
|
|
95
|
+
onDrawerClose?: ?() => mixed,
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The navigation view that will be rendered to the side of the screen and can be pulled in.
|
|
99
|
+
*/
|
|
100
|
+
renderNavigationView: () => React.MixedElement,
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Make the drawer take the entire screen and draw the background of the
|
|
104
|
+
* status bar to allow it to open over the status bar. It will only have an
|
|
105
|
+
* effect on API 21+.
|
|
106
|
+
*/
|
|
107
|
+
statusBarBackgroundColor?: ?ColorValue,
|
|
108
|
+
}>;
|
|
109
|
+
|
|
110
|
+
export type DrawerLayoutAndroidState = {
|
|
111
|
+
drawerOpened: boolean,
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export interface DrawerLayoutAndroidMethods {
|
|
115
|
+
/**
|
|
116
|
+
* Opens the drawer.
|
|
117
|
+
*/
|
|
118
|
+
openDrawer(): void;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Closes the drawer.
|
|
122
|
+
*/
|
|
123
|
+
closeDrawer(): void;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Native methods
|
|
127
|
+
*/
|
|
128
|
+
blur(): void;
|
|
129
|
+
focus(): void;
|
|
130
|
+
measure(callback: MeasureOnSuccessCallback): void;
|
|
131
|
+
measureInWindow(callback: MeasureInWindowOnSuccessCallback): void;
|
|
132
|
+
measureLayout(
|
|
133
|
+
relativeToNativeNode: number,
|
|
134
|
+
onSuccess: MeasureLayoutOnSuccessCallback,
|
|
135
|
+
onFail?: () => void,
|
|
136
|
+
): void;
|
|
137
|
+
setNativeProps(nativeProps: Object): void;
|
|
138
|
+
}
|
|
@@ -25,7 +25,7 @@ import View from '../View/View';
|
|
|
25
25
|
import Keyboard from './Keyboard';
|
|
26
26
|
import * as React from 'react';
|
|
27
27
|
|
|
28
|
-
type
|
|
28
|
+
export type KeyboardAvoidingViewProps = $ReadOnly<{
|
|
29
29
|
...ViewProps,
|
|
30
30
|
|
|
31
31
|
/**
|
|
@@ -59,7 +59,10 @@ type State = {
|
|
|
59
59
|
* View that moves out of the way when the keyboard appears by automatically
|
|
60
60
|
* adjusting its height, position, or bottom padding.
|
|
61
61
|
*/
|
|
62
|
-
class KeyboardAvoidingView extends React.Component<
|
|
62
|
+
class KeyboardAvoidingView extends React.Component<
|
|
63
|
+
KeyboardAvoidingViewProps,
|
|
64
|
+
State,
|
|
65
|
+
> {
|
|
63
66
|
_frame: ?ViewLayout = null;
|
|
64
67
|
_keyboardEvent: ?KeyboardEvent = null;
|
|
65
68
|
_subscriptions: Array<EventSubscription> = [];
|
|
@@ -67,7 +70,7 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
|
|
|
67
70
|
_initialFrameHeight: number = 0;
|
|
68
71
|
_bottom: number = 0;
|
|
69
72
|
|
|
70
|
-
constructor(props:
|
|
73
|
+
constructor(props: KeyboardAvoidingViewProps) {
|
|
71
74
|
super(props);
|
|
72
75
|
this.state = {bottom: 0};
|
|
73
76
|
this.viewRef = React.createRef();
|
|
@@ -175,7 +178,7 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
|
|
|
175
178
|
}
|
|
176
179
|
};
|
|
177
180
|
|
|
178
|
-
componentDidUpdate(_:
|
|
181
|
+
componentDidUpdate(_: KeyboardAvoidingViewProps, prevState: State): void {
|
|
179
182
|
const enabled = this.props.enabled ?? true;
|
|
180
183
|
if (enabled && this._bottom !== prevState.bottom) {
|
|
181
184
|
this.setState({bottom: this._bottom});
|
|
@@ -13,7 +13,7 @@ import StyleSheet from '../../StyleSheet/StyleSheet';
|
|
|
13
13
|
import LayoutConformanceNativeComponent from './LayoutConformanceNativeComponent';
|
|
14
14
|
import * as React from 'react';
|
|
15
15
|
|
|
16
|
-
type
|
|
16
|
+
export type LayoutConformanceProps = $ReadOnly<{
|
|
17
17
|
/**
|
|
18
18
|
* strict: Layout in accordance with W3C spec, even when breaking
|
|
19
19
|
* compatibility: Layout with the same behavior as previous versions of React Native
|
|
@@ -29,13 +29,15 @@ type Props = $ReadOnly<{
|
|
|
29
29
|
// degrade the error experience).
|
|
30
30
|
const isFabricUIManagerInstalled = global?.nativeFabricUIManager != null;
|
|
31
31
|
|
|
32
|
-
function LayoutConformance(props:
|
|
32
|
+
function LayoutConformance(props: LayoutConformanceProps): React.Node {
|
|
33
33
|
return (
|
|
34
34
|
<LayoutConformanceNativeComponent {...props} style={styles.container} />
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
function UnimplementedLayoutConformance(
|
|
38
|
+
function UnimplementedLayoutConformance(
|
|
39
|
+
props: LayoutConformanceProps,
|
|
40
|
+
): React.Node {
|
|
39
41
|
if (__DEV__) {
|
|
40
42
|
const warnOnce = require('../../Utilities/warnOnce').default;
|
|
41
43
|
|
|
@@ -50,7 +52,7 @@ function UnimplementedLayoutConformance(props: Props): React.Node {
|
|
|
50
52
|
|
|
51
53
|
export default (isFabricUIManagerInstalled
|
|
52
54
|
? LayoutConformance
|
|
53
|
-
: UnimplementedLayoutConformance) as component(...
|
|
55
|
+
: UnimplementedLayoutConformance) as component(...LayoutConformanceProps);
|
|
54
56
|
|
|
55
57
|
const styles = StyleSheet.create({
|
|
56
58
|
container: {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {HostComponent} from '
|
|
11
|
+
import type {HostComponent} from '../../../src/private/types/HostComponent';
|
|
12
12
|
import type {ViewProps} from '../View/ViewPropTypes';
|
|
13
13
|
|
|
14
14
|
import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry';
|
|
@@ -9,17 +9,11 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {
|
|
12
|
+
GestureResponderEvent,
|
|
12
13
|
LayoutChangeEvent,
|
|
13
14
|
MouseEvent,
|
|
14
|
-
GestureResponderEvent,
|
|
15
15
|
} from '../../Types/CoreEventTypes';
|
|
16
|
-
import type {
|
|
17
|
-
AccessibilityActionEvent,
|
|
18
|
-
AccessibilityActionInfo,
|
|
19
|
-
AccessibilityRole,
|
|
20
|
-
AccessibilityState,
|
|
21
|
-
AccessibilityValue,
|
|
22
|
-
} from '../View/ViewAccessibility';
|
|
16
|
+
import type {ViewProps} from '../View/ViewPropTypes';
|
|
23
17
|
|
|
24
18
|
import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
|
|
25
19
|
import usePressability from '../../Pressability/usePressability';
|
|
@@ -27,59 +21,18 @@ import {type RectOrSize} from '../../StyleSheet/Rect';
|
|
|
27
21
|
import useMergeRefs from '../../Utilities/useMergeRefs';
|
|
28
22
|
import View from '../View/View';
|
|
29
23
|
import useAndroidRippleForView, {
|
|
30
|
-
type
|
|
24
|
+
type PressableAndroidRippleConfig,
|
|
31
25
|
} from './useAndroidRippleForView';
|
|
32
26
|
import * as React from 'react';
|
|
33
27
|
import {useMemo, useRef, useState} from 'react';
|
|
34
28
|
|
|
35
29
|
type ViewStyleProp = $ElementType<React.ElementConfig<typeof View>, 'style'>;
|
|
36
30
|
|
|
37
|
-
export type
|
|
31
|
+
export type PressableStateCallbackType = $ReadOnly<{
|
|
38
32
|
pressed: boolean,
|
|
39
33
|
}>;
|
|
40
34
|
|
|
41
|
-
type
|
|
42
|
-
/**
|
|
43
|
-
* Accessibility.
|
|
44
|
-
*/
|
|
45
|
-
accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
|
|
46
|
-
accessibilityElementsHidden?: ?boolean,
|
|
47
|
-
accessibilityHint?: ?Stringish,
|
|
48
|
-
accessibilityLanguage?: ?Stringish,
|
|
49
|
-
accessibilityIgnoresInvertColors?: ?boolean,
|
|
50
|
-
accessibilityLabel?: ?Stringish,
|
|
51
|
-
accessibilityLiveRegion?: ?('none' | 'polite' | 'assertive'),
|
|
52
|
-
accessibilityRole?: ?AccessibilityRole,
|
|
53
|
-
accessibilityState?: ?AccessibilityState,
|
|
54
|
-
accessibilityValue?: ?AccessibilityValue,
|
|
55
|
-
'aria-valuemax'?: AccessibilityValue['max'],
|
|
56
|
-
'aria-valuemin'?: AccessibilityValue['min'],
|
|
57
|
-
'aria-valuenow'?: AccessibilityValue['now'],
|
|
58
|
-
'aria-valuetext'?: AccessibilityValue['text'],
|
|
59
|
-
accessibilityViewIsModal?: ?boolean,
|
|
60
|
-
'aria-modal'?: ?boolean,
|
|
61
|
-
accessible?: ?boolean,
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* alias for accessibilityState
|
|
65
|
-
*
|
|
66
|
-
* see https://reactnative.dev/docs/accessibility#accessibilitystate
|
|
67
|
-
*/
|
|
68
|
-
'aria-busy'?: ?boolean,
|
|
69
|
-
'aria-checked'?: ?boolean | 'mixed',
|
|
70
|
-
'aria-disabled'?: ?boolean,
|
|
71
|
-
'aria-expanded'?: ?boolean,
|
|
72
|
-
'aria-selected'?: ?boolean,
|
|
73
|
-
/**
|
|
74
|
-
* A value indicating whether the accessibility elements contained within
|
|
75
|
-
* this accessibility element are hidden.
|
|
76
|
-
*/
|
|
77
|
-
'aria-hidden'?: ?boolean,
|
|
78
|
-
'aria-live'?: ?('polite' | 'assertive' | 'off'),
|
|
79
|
-
focusable?: ?boolean,
|
|
80
|
-
importantForAccessibility?: ?('auto' | 'yes' | 'no' | 'no-hide-descendants'),
|
|
81
|
-
onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
|
|
82
|
-
|
|
35
|
+
type PressableBaseProps = $ReadOnly<{
|
|
83
36
|
/**
|
|
84
37
|
* Whether a press gesture can be interrupted by a parent gesture such as a
|
|
85
38
|
* scroll event. Defaults to true.
|
|
@@ -90,7 +43,7 @@ type Props = $ReadOnly<{
|
|
|
90
43
|
* Either children or a render prop that receives a boolean reflecting whether
|
|
91
44
|
* the component is currently pressed.
|
|
92
45
|
*/
|
|
93
|
-
children: React.Node | ((state:
|
|
46
|
+
children: React.Node | ((state: PressableStateCallbackType) => React.Node),
|
|
94
47
|
|
|
95
48
|
/**
|
|
96
49
|
* Duration to wait after hover in before calling `onHoverIn`.
|
|
@@ -162,7 +115,9 @@ type Props = $ReadOnly<{
|
|
|
162
115
|
* Either view styles or a function that receives a boolean reflecting whether
|
|
163
116
|
* the component is currently pressed and returns view styles.
|
|
164
117
|
*/
|
|
165
|
-
style?:
|
|
118
|
+
style?:
|
|
119
|
+
| ViewStyleProp
|
|
120
|
+
| ((state: PressableStateCallbackType) => ViewStyleProp),
|
|
166
121
|
|
|
167
122
|
/**
|
|
168
123
|
* Identifier used to find this view in tests.
|
|
@@ -177,7 +132,7 @@ type Props = $ReadOnly<{
|
|
|
177
132
|
/**
|
|
178
133
|
* Enables the Android ripple effect and configures its color.
|
|
179
134
|
*/
|
|
180
|
-
android_ripple?: ?
|
|
135
|
+
android_ripple?: ?PressableAndroidRippleConfig,
|
|
181
136
|
|
|
182
137
|
/**
|
|
183
138
|
* Used only for documentation or testing (e.g. snapshot testing).
|
|
@@ -188,11 +143,11 @@ type Props = $ReadOnly<{
|
|
|
188
143
|
* Duration to wait after press down before calling `onPressIn`.
|
|
189
144
|
*/
|
|
190
145
|
unstable_pressDelay?: ?number,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
146
|
+
}>;
|
|
147
|
+
|
|
148
|
+
export type PressableProps = $ReadOnly<{
|
|
149
|
+
...ViewProps,
|
|
150
|
+
...PressableBaseProps,
|
|
196
151
|
}>;
|
|
197
152
|
|
|
198
153
|
type Instance = React.ElementRef<typeof View>;
|
|
@@ -202,7 +157,7 @@ type Instance = React.ElementRef<typeof View>;
|
|
|
202
157
|
* component is currently pressed or not.
|
|
203
158
|
*/
|
|
204
159
|
function Pressable(
|
|
205
|
-
props:
|
|
160
|
+
props: PressableProps,
|
|
206
161
|
forwardedRef: React.RefSetter<Instance>,
|
|
207
162
|
): React.Node {
|
|
208
163
|
const {
|
|
@@ -364,6 +319,6 @@ const MemoedPressable = React.memo(React.forwardRef(Pressable));
|
|
|
364
319
|
MemoedPressable.displayName = 'Pressable';
|
|
365
320
|
|
|
366
321
|
export default (MemoedPressable: component(
|
|
367
|
-
ref
|
|
368
|
-
...props:
|
|
322
|
+
ref?: React.RefSetter<React.ElementRef<typeof View>>,
|
|
323
|
+
...props: PressableProps
|
|
369
324
|
));
|
|
@@ -9,28 +9,23 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {
|
|
12
|
+
GestureResponderEvent,
|
|
12
13
|
LayoutChangeEvent,
|
|
13
14
|
MouseEvent,
|
|
14
|
-
GestureResponderEvent,
|
|
15
15
|
// [Windows
|
|
16
16
|
BlurEvent,
|
|
17
17
|
FocusEvent,
|
|
18
18
|
KeyEvent, // Windows]
|
|
19
19
|
} from '../../Types/CoreEventTypes';
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
AccessibilityActionInfo,
|
|
23
|
-
AccessibilityRole,
|
|
24
|
-
AccessibilityState,
|
|
25
|
-
AccessibilityValue,
|
|
26
|
-
} from '../View/ViewAccessibility';
|
|
20
|
+
|
|
21
|
+
import type {ViewProps} from '../View/ViewPropTypes';
|
|
27
22
|
|
|
28
23
|
import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
|
|
29
24
|
import usePressability from '../../Pressability/usePressability';
|
|
30
25
|
import {type RectOrSize} from '../../StyleSheet/Rect';
|
|
31
26
|
import useMergeRefs from '../../Utilities/useMergeRefs';
|
|
32
27
|
import useAndroidRippleForView, {
|
|
33
|
-
type
|
|
28
|
+
type PressableAndroidRippleConfig,
|
|
34
29
|
} from './useAndroidRippleForView';
|
|
35
30
|
import * as React from 'react';
|
|
36
31
|
import {useMemo, useRef, useState} from 'react';
|
|
@@ -39,54 +34,11 @@ import View from '../View/View';
|
|
|
39
34
|
|
|
40
35
|
type ViewStyleProp = $ElementType<React.ElementConfig<typeof View>, 'style'>;
|
|
41
36
|
|
|
42
|
-
export type
|
|
37
|
+
export type PressableStateCallbackType = $ReadOnly<{
|
|
43
38
|
pressed: boolean,
|
|
44
39
|
}>;
|
|
45
40
|
|
|
46
|
-
type
|
|
47
|
-
/**
|
|
48
|
-
* Accessibility.
|
|
49
|
-
*/
|
|
50
|
-
accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
|
|
51
|
-
accessibilityElementsHidden?: ?boolean,
|
|
52
|
-
accessibilityHint?: ?Stringish,
|
|
53
|
-
accessibilityLanguage?: ?Stringish,
|
|
54
|
-
accessibilityIgnoresInvertColors?: ?boolean,
|
|
55
|
-
accessibilityLabel?: ?Stringish,
|
|
56
|
-
accessibilityLiveRegion?: ?('none' | 'polite' | 'assertive'),
|
|
57
|
-
accessibilityRole?: ?AccessibilityRole,
|
|
58
|
-
accessibilityState?: ?AccessibilityState,
|
|
59
|
-
accessibilityValue?: ?AccessibilityValue,
|
|
60
|
-
'aria-valuemax'?: AccessibilityValue['max'],
|
|
61
|
-
'aria-valuemin'?: AccessibilityValue['min'],
|
|
62
|
-
'aria-valuenow'?: AccessibilityValue['now'],
|
|
63
|
-
'aria-valuetext'?: AccessibilityValue['text'],
|
|
64
|
-
accessibilityViewIsModal?: ?boolean,
|
|
65
|
-
'aria-modal'?: ?boolean,
|
|
66
|
-
accessible?: ?boolean,
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* alias for accessibilityState
|
|
70
|
-
*
|
|
71
|
-
* see https://reactnative.dev/docs/accessibility#accessibilitystate
|
|
72
|
-
*/
|
|
73
|
-
'aria-busy'?: ?boolean,
|
|
74
|
-
'aria-checked'?: ?boolean | 'mixed',
|
|
75
|
-
'aria-disabled'?: ?boolean,
|
|
76
|
-
'aria-expanded'?: ?boolean,
|
|
77
|
-
'aria-selected'?: ?boolean,
|
|
78
|
-
'aria-multiselectable'?: ?boolean, // Win32
|
|
79
|
-
'aria-required'?: ?boolean, // Win32
|
|
80
|
-
/**
|
|
81
|
-
* A value indicating whether the accessibility elements contained within
|
|
82
|
-
* this accessibility element are hidden.
|
|
83
|
-
*/
|
|
84
|
-
'aria-hidden'?: ?boolean,
|
|
85
|
-
'aria-live'?: ?('polite' | 'assertive' | 'off'),
|
|
86
|
-
focusable?: ?boolean,
|
|
87
|
-
importantForAccessibility?: ?('auto' | 'yes' | 'no' | 'no-hide-descendants'),
|
|
88
|
-
onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
|
|
89
|
-
|
|
41
|
+
type PressableBaseProps = $ReadOnly<{
|
|
90
42
|
/**
|
|
91
43
|
* Whether a press gesture can be interrupted by a parent gesture such as a
|
|
92
44
|
* scroll event. Defaults to true.
|
|
@@ -97,7 +49,7 @@ type Props = $ReadOnly<{
|
|
|
97
49
|
* Either children or a render prop that receives a boolean reflecting whether
|
|
98
50
|
* the component is currently pressed.
|
|
99
51
|
*/
|
|
100
|
-
children: React.Node | ((state:
|
|
52
|
+
children: React.Node | ((state: PressableStateCallbackType) => React.Node),
|
|
101
53
|
|
|
102
54
|
/**
|
|
103
55
|
* Duration to wait after hover in before calling `onHoverIn`.
|
|
@@ -209,7 +161,9 @@ type Props = $ReadOnly<{
|
|
|
209
161
|
* Either view styles or a function that receives a boolean reflecting whether
|
|
210
162
|
* the component is currently pressed and returns view styles.
|
|
211
163
|
*/
|
|
212
|
-
style?:
|
|
164
|
+
style?:
|
|
165
|
+
| ViewStyleProp
|
|
166
|
+
| ((state: PressableStateCallbackType) => ViewStyleProp),
|
|
213
167
|
|
|
214
168
|
/**
|
|
215
169
|
* Identifier used to find this view in tests.
|
|
@@ -224,7 +178,7 @@ type Props = $ReadOnly<{
|
|
|
224
178
|
/**
|
|
225
179
|
* Enables the Android ripple effect and configures its color.
|
|
226
180
|
*/
|
|
227
|
-
android_ripple?: ?
|
|
181
|
+
android_ripple?: ?PressableAndroidRippleConfig,
|
|
228
182
|
|
|
229
183
|
/**
|
|
230
184
|
* Used only for documentation or testing (e.g. snapshot testing).
|
|
@@ -235,11 +189,11 @@ type Props = $ReadOnly<{
|
|
|
235
189
|
* Duration to wait after press down before calling `onPressIn`.
|
|
236
190
|
*/
|
|
237
191
|
unstable_pressDelay?: ?number,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
192
|
+
}>;
|
|
193
|
+
|
|
194
|
+
export type PressableProps = $ReadOnly<{
|
|
195
|
+
...ViewProps,
|
|
196
|
+
...PressableBaseProps,
|
|
243
197
|
}>;
|
|
244
198
|
|
|
245
199
|
type Instance = React.ElementRef<typeof View>;
|
|
@@ -249,7 +203,7 @@ type Instance = React.ElementRef<typeof View>;
|
|
|
249
203
|
* component is currently pressed or not.
|
|
250
204
|
*/
|
|
251
205
|
function Pressable(
|
|
252
|
-
props:
|
|
206
|
+
props: PressableProps,
|
|
253
207
|
forwardedRef: React.RefSetter<Instance>,
|
|
254
208
|
): React.Node {
|
|
255
209
|
const {
|
|
@@ -432,6 +386,6 @@ const MemoedPressable = React.memo(React.forwardRef(Pressable));
|
|
|
432
386
|
MemoedPressable.displayName = 'Pressable';
|
|
433
387
|
|
|
434
388
|
export default (MemoedPressable: component(
|
|
435
|
-
ref
|
|
436
|
-
...props:
|
|
389
|
+
ref?: React.RefSetter<React.ElementRef<typeof View>>,
|
|
390
|
+
...props: PressableProps
|
|
437
391
|
));
|
|
@@ -26,7 +26,7 @@ type NativeBackgroundProp = $ReadOnly<{
|
|
|
26
26
|
rippleRadius: ?number,
|
|
27
27
|
}>;
|
|
28
28
|
|
|
29
|
-
export type
|
|
29
|
+
export type PressableAndroidRippleConfig = {
|
|
30
30
|
color?: ColorValue,
|
|
31
31
|
borderless?: boolean,
|
|
32
32
|
radius?: number,
|
|
@@ -38,7 +38,7 @@ export type RippleConfig = {
|
|
|
38
38
|
* supported versions of Android.
|
|
39
39
|
*/
|
|
40
40
|
export default function useAndroidRippleForView(
|
|
41
|
-
rippleConfig: ?
|
|
41
|
+
rippleConfig: ?PressableAndroidRippleConfig,
|
|
42
42
|
viewRef: {current: null | React.ElementRef<typeof View>},
|
|
43
43
|
): ?$ReadOnly<{
|
|
44
44
|
onPressIn: (event: GestureResponderEvent) => void,
|
|
@@ -8,52 +8,13 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
12
|
-
import type {ViewProps} from '../View/ViewPropTypes';
|
|
11
|
+
import type {ProgressBarAndroidProps} from './ProgressBarAndroidTypes';
|
|
13
12
|
|
|
14
13
|
import ProgressBarAndroidNativeComponent from './ProgressBarAndroidNativeComponent';
|
|
15
14
|
|
|
16
15
|
const React = require('react');
|
|
17
16
|
|
|
18
|
-
export type ProgressBarAndroidProps
|
|
19
|
-
...ViewProps,
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Style of the ProgressBar and whether it shows indeterminate progress (e.g. spinner).
|
|
23
|
-
*
|
|
24
|
-
* `indeterminate` can only be false if `styleAttr` is Horizontal, and requires a
|
|
25
|
-
* `progress` value.
|
|
26
|
-
*/
|
|
27
|
-
...
|
|
28
|
-
| {
|
|
29
|
-
styleAttr: 'Horizontal',
|
|
30
|
-
indeterminate: false,
|
|
31
|
-
progress: number,
|
|
32
|
-
}
|
|
33
|
-
| {
|
|
34
|
-
typeAttr:
|
|
35
|
-
| 'Horizontal'
|
|
36
|
-
| 'Normal'
|
|
37
|
-
| 'Small'
|
|
38
|
-
| 'Large'
|
|
39
|
-
| 'Inverse'
|
|
40
|
-
| 'SmallInverse'
|
|
41
|
-
| 'LargeInverse',
|
|
42
|
-
indeterminate: true,
|
|
43
|
-
},
|
|
44
|
-
/**
|
|
45
|
-
* Whether to show the ProgressBar (true, the default) or hide it (false).
|
|
46
|
-
*/
|
|
47
|
-
animating?: ?boolean,
|
|
48
|
-
/**
|
|
49
|
-
* Color of the progress bar.
|
|
50
|
-
*/
|
|
51
|
-
color?: ?ColorValue,
|
|
52
|
-
/**
|
|
53
|
-
* Used to locate this view in end-to-end tests.
|
|
54
|
-
*/
|
|
55
|
-
testID?: ?string,
|
|
56
|
-
}>;
|
|
17
|
+
export type {ProgressBarAndroidProps};
|
|
57
18
|
|
|
58
19
|
/**
|
|
59
20
|
* React component that wraps the Android-only `ProgressBar`. This component is
|
|
@@ -79,7 +40,7 @@ export type ProgressBarAndroidProps = $ReadOnly<{
|
|
|
79
40
|
* ```
|
|
80
41
|
*/
|
|
81
42
|
const ProgressBarAndroidWithForwardedRef: component(
|
|
82
|
-
ref
|
|
43
|
+
ref?: React.RefSetter<
|
|
83
44
|
React.ElementRef<typeof ProgressBarAndroidNativeComponent>,
|
|
84
45
|
>,
|
|
85
46
|
...props: ProgressBarAndroidProps
|
|
@@ -106,7 +67,4 @@ const ProgressBarAndroidWithForwardedRef: component(
|
|
|
106
67
|
);
|
|
107
68
|
});
|
|
108
69
|
|
|
109
|
-
export default
|
|
110
|
-
* error found when Flow v0.89 was deployed. To see the error, delete this
|
|
111
|
-
* comment and run Flow. */
|
|
112
|
-
(ProgressBarAndroidWithForwardedRef: typeof ProgressBarAndroidNativeComponent);
|
|
70
|
+
export default ProgressBarAndroidWithForwardedRef;
|