@office-iss/react-native-win32 0.0.0-canary.287 → 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 +42 -1
- package/CHANGELOG.md +15 -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 -15
- 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
|
@@ -12,12 +12,7 @@
|
|
|
12
12
|
// TextInputs. All calls relating to the keyboard should be funneled
|
|
13
13
|
// through here.
|
|
14
14
|
|
|
15
|
-
import type {
|
|
16
|
-
HostInstance,
|
|
17
|
-
MeasureInWindowOnSuccessCallback,
|
|
18
|
-
MeasureLayoutOnSuccessCallback,
|
|
19
|
-
MeasureOnSuccessCallback,
|
|
20
|
-
} from '../../Renderer/shims/ReactNativeTypes';
|
|
15
|
+
import type {HostInstance} from '../../../src/private/types/HostInstance';
|
|
21
16
|
|
|
22
17
|
import {Commands as AndroidTextInputCommands} from '../../Components/TextInput/AndroidTextInputNativeComponent';
|
|
23
18
|
import {Commands as iOSTextInputCommands} from '../../Components/TextInput/RCTSingelineTextInputNativeComponent';
|
|
@@ -27,18 +22,7 @@ const {findNodeHandle} = require('../../ReactNative/RendererProxy');
|
|
|
27
22
|
const Platform = require('../../Utilities/Platform').default;
|
|
28
23
|
|
|
29
24
|
let currentlyFocusedInputRef: ?HostInstance = null;
|
|
30
|
-
const inputs = new Set<
|
|
31
|
-
blur(): void,
|
|
32
|
-
focus(): void,
|
|
33
|
-
measure(callback: MeasureOnSuccessCallback): void,
|
|
34
|
-
measureInWindow(callback: MeasureInWindowOnSuccessCallback): void,
|
|
35
|
-
measureLayout(
|
|
36
|
-
relativeToNativeNode: number | HostInstance,
|
|
37
|
-
onSuccess: MeasureLayoutOnSuccessCallback,
|
|
38
|
-
onFail?: () => void,
|
|
39
|
-
): void,
|
|
40
|
-
setNativeProps(nativeProps: {...}): void,
|
|
41
|
-
}>();
|
|
25
|
+
const inputs = new Set<HostInstance>();
|
|
42
26
|
|
|
43
27
|
function currentlyFocusedInput(): ?HostInstance {
|
|
44
28
|
return currentlyFocusedInputRef;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @format
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type {HostComponent} from '
|
|
6
|
+
import type {HostComponent} from '../../../src/private/types/HostComponent';
|
|
7
7
|
|
|
8
8
|
import requireNativeComponent from '../../ReactNative/requireNativeComponent';
|
|
9
9
|
import codegenNativeCommands from '../../Utilities/codegenNativeCommands';
|
|
@@ -370,7 +370,7 @@ const LONG_PRESS_ALLOWED_MOVEMENT = 10;
|
|
|
370
370
|
*
|
|
371
371
|
* @lends Touchable.prototype
|
|
372
372
|
*/
|
|
373
|
-
const
|
|
373
|
+
const TouchableMixinImpl = {
|
|
374
374
|
componentDidMount: function () {
|
|
375
375
|
if (!Platform.isTV) {
|
|
376
376
|
return;
|
|
@@ -946,12 +946,12 @@ const {
|
|
|
946
946
|
touchableHandleFocus,
|
|
947
947
|
touchableHandleBlur,
|
|
948
948
|
...TouchableMixinWithoutDefaultFocusAndBlur
|
|
949
|
-
} =
|
|
950
|
-
|
|
949
|
+
} = TouchableMixinImpl;
|
|
950
|
+
TouchableMixinImpl.withoutDefaultFocusAndBlur =
|
|
951
951
|
TouchableMixinWithoutDefaultFocusAndBlur;
|
|
952
952
|
|
|
953
|
-
const
|
|
954
|
-
Mixin:
|
|
953
|
+
const TouchableImpl = {
|
|
954
|
+
Mixin: TouchableMixinImpl,
|
|
955
955
|
/**
|
|
956
956
|
* Renders a debugging overlay to visualize touch target with hitSlop (might not work on Android).
|
|
957
957
|
*/
|
|
@@ -960,7 +960,7 @@ const Touchable = {
|
|
|
960
960
|
hitSlop,
|
|
961
961
|
}: {
|
|
962
962
|
color: ColorValue,
|
|
963
|
-
hitSlop
|
|
963
|
+
hitSlop?: EdgeInsetsProp,
|
|
964
964
|
...
|
|
965
965
|
}): null | React.Node => {
|
|
966
966
|
if (__DEV__) {
|
|
@@ -970,4 +970,4 @@ const Touchable = {
|
|
|
970
970
|
},
|
|
971
971
|
};
|
|
972
972
|
|
|
973
|
-
export default
|
|
973
|
+
export default TouchableImpl;
|
|
@@ -375,7 +375,7 @@ const LONG_PRESS_ALLOWED_MOVEMENT = 10;
|
|
|
375
375
|
*
|
|
376
376
|
* @lends Touchable.prototype
|
|
377
377
|
*/
|
|
378
|
-
const
|
|
378
|
+
const TouchableMixinImpl = {
|
|
379
379
|
componentDidMount: function () {
|
|
380
380
|
if (!Platform.isTV) {
|
|
381
381
|
return;
|
|
@@ -951,12 +951,12 @@ const {
|
|
|
951
951
|
touchableHandleFocus,
|
|
952
952
|
touchableHandleBlur,
|
|
953
953
|
...TouchableMixinWithoutDefaultFocusAndBlur
|
|
954
|
-
} =
|
|
955
|
-
|
|
954
|
+
} = TouchableMixinImpl;
|
|
955
|
+
TouchableMixinImpl.withoutDefaultFocusAndBlur =
|
|
956
956
|
TouchableMixinWithoutDefaultFocusAndBlur;
|
|
957
957
|
|
|
958
|
-
const
|
|
959
|
-
Mixin:
|
|
958
|
+
const TouchableImpl = {
|
|
959
|
+
Mixin: TouchableMixinImpl,
|
|
960
960
|
/**
|
|
961
961
|
* Renders a debugging overlay to visualize touch target with hitSlop (might not work on Android).
|
|
962
962
|
*/
|
|
@@ -965,7 +965,7 @@ const Touchable = {
|
|
|
965
965
|
hitSlop,
|
|
966
966
|
}: {
|
|
967
967
|
color: ColorValue,
|
|
968
|
-
hitSlop
|
|
968
|
+
hitSlop?: EdgeInsetsProp,
|
|
969
969
|
...
|
|
970
970
|
}): null | React.Node => {
|
|
971
971
|
if (__DEV__) {
|
|
@@ -975,4 +975,4 @@ const Touchable = {
|
|
|
975
975
|
},
|
|
976
976
|
};
|
|
977
977
|
|
|
978
|
-
export default
|
|
978
|
+
export default TouchableImpl;
|
|
@@ -214,7 +214,7 @@ class TouchableBounce extends React.Component<Props, State> {
|
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
export default (React.forwardRef((props, hostRef) => (
|
|
217
|
+
export default (React.forwardRef((props, hostRef: React.RefSetter<mixed>) => (
|
|
218
218
|
<TouchableBounce {...props} hostRef={hostRef} />
|
|
219
219
|
)): component(
|
|
220
220
|
ref: React.RefSetter<mixed>,
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
|
12
|
-
import
|
|
12
|
+
import type {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback';
|
|
13
13
|
|
|
14
14
|
import View from '../../Components/View/View';
|
|
15
15
|
import Pressability, {
|
|
@@ -32,21 +32,39 @@ type IOSProps = $ReadOnly<{
|
|
|
32
32
|
hasTVPreferredFocus?: ?boolean,
|
|
33
33
|
}>;
|
|
34
34
|
|
|
35
|
-
type
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
type TouchableHighlightBaseProps = $ReadOnly<{
|
|
36
|
+
/**
|
|
37
|
+
* Determines what the opacity of the wrapped view should be when touch is active.
|
|
38
|
+
*/
|
|
40
39
|
activeOpacity?: ?number,
|
|
40
|
+
/**
|
|
41
|
+
* The color of the underlay that will show through when the touch is active.
|
|
42
|
+
*/
|
|
41
43
|
underlayColor?: ?ColorValue,
|
|
44
|
+
/**
|
|
45
|
+
* @see https://reactnative.dev/docs/view#style
|
|
46
|
+
*/
|
|
42
47
|
style?: ?ViewStyleProp,
|
|
48
|
+
/**
|
|
49
|
+
* Called immediately after the underlay is shown
|
|
50
|
+
*/
|
|
43
51
|
onShowUnderlay?: ?() => void,
|
|
52
|
+
/**
|
|
53
|
+
* Called immediately after the underlay is hidden
|
|
54
|
+
*/
|
|
44
55
|
onHideUnderlay?: ?() => void,
|
|
45
56
|
testOnly_pressed?: ?boolean,
|
|
46
57
|
|
|
47
58
|
hostRef: React.RefSetter<React.ElementRef<typeof View>>,
|
|
48
59
|
}>;
|
|
49
60
|
|
|
61
|
+
type TouchableHighlightProps = $ReadOnly<{
|
|
62
|
+
...TouchableWithoutFeedbackProps,
|
|
63
|
+
...AndroidProps,
|
|
64
|
+
...IOSProps,
|
|
65
|
+
...TouchableHighlightBaseProps,
|
|
66
|
+
}>;
|
|
67
|
+
|
|
50
68
|
type ExtraStyles = $ReadOnly<{
|
|
51
69
|
child: ViewStyleProp,
|
|
52
70
|
underlay: ViewStyleProp,
|
|
@@ -153,7 +171,10 @@ type State = $ReadOnly<{
|
|
|
153
171
|
* ```
|
|
154
172
|
*
|
|
155
173
|
*/
|
|
156
|
-
class
|
|
174
|
+
class TouchableHighlightImpl extends React.Component<
|
|
175
|
+
TouchableHighlightProps,
|
|
176
|
+
State,
|
|
177
|
+
> {
|
|
157
178
|
_hideTimeout: ?TimeoutID;
|
|
158
179
|
_isMounted: boolean = false;
|
|
159
180
|
|
|
@@ -368,7 +389,7 @@ class TouchableHighlight extends React.Component<Props, State> {
|
|
|
368
389
|
this.state.pressability.configure(this._createPressabilityConfig());
|
|
369
390
|
}
|
|
370
391
|
|
|
371
|
-
componentDidUpdate(prevProps:
|
|
392
|
+
componentDidUpdate(prevProps: TouchableHighlightProps, prevState: State) {
|
|
372
393
|
this.state.pressability.configure(this._createPressabilityConfig());
|
|
373
394
|
}
|
|
374
395
|
|
|
@@ -381,13 +402,13 @@ class TouchableHighlight extends React.Component<Props, State> {
|
|
|
381
402
|
}
|
|
382
403
|
}
|
|
383
404
|
|
|
384
|
-
const
|
|
385
|
-
ref
|
|
386
|
-
...props: $ReadOnly<$Diff<
|
|
405
|
+
const TouchableHighlight: component(
|
|
406
|
+
ref?: React.RefSetter<React.ElementRef<typeof View>>,
|
|
407
|
+
...props: $ReadOnly<$Diff<TouchableHighlightProps, {+hostRef: mixed}>>
|
|
387
408
|
) = React.forwardRef((props, hostRef) => (
|
|
388
|
-
<
|
|
409
|
+
<TouchableHighlightImpl {...props} hostRef={hostRef} />
|
|
389
410
|
));
|
|
390
411
|
|
|
391
|
-
|
|
412
|
+
TouchableHighlight.displayName = 'TouchableHighlight';
|
|
392
413
|
|
|
393
|
-
export default
|
|
414
|
+
export default TouchableHighlight;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {GestureResponderEvent} from '../../Types/CoreEventTypes';
|
|
12
|
-
import
|
|
12
|
+
import type {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback';
|
|
13
13
|
|
|
14
14
|
import View from '../../Components/View/View';
|
|
15
15
|
import Pressability, {
|
|
@@ -23,61 +23,82 @@ import {Commands} from '../View/ViewNativeComponent';
|
|
|
23
23
|
import invariant from 'invariant';
|
|
24
24
|
import * as React from 'react';
|
|
25
25
|
|
|
26
|
-
type
|
|
27
|
-
...React.ElementConfig<TouchableWithoutFeedback>,
|
|
28
|
-
|
|
26
|
+
type TVProps = {
|
|
29
27
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* methods to generate that dictionary.
|
|
34
|
-
*/
|
|
35
|
-
background?: ?(
|
|
36
|
-
| $ReadOnly<{
|
|
37
|
-
type: 'ThemeAttrAndroid',
|
|
38
|
-
attribute:
|
|
39
|
-
| 'selectableItemBackground'
|
|
40
|
-
| 'selectableItemBackgroundBorderless',
|
|
41
|
-
rippleRadius: ?number,
|
|
42
|
-
}>
|
|
43
|
-
| $ReadOnly<{
|
|
44
|
-
type: 'RippleAndroid',
|
|
45
|
-
color: ?number,
|
|
46
|
-
borderless: boolean,
|
|
47
|
-
rippleRadius: ?number,
|
|
48
|
-
}>
|
|
49
|
-
),
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* TV preferred focus (see documentation for the View component).
|
|
28
|
+
* *(Apple TV only)* TV preferred focus (see documentation for the View component).
|
|
29
|
+
*
|
|
30
|
+
* @platform ios
|
|
53
31
|
*/
|
|
54
32
|
hasTVPreferredFocus?: ?boolean,
|
|
55
33
|
|
|
56
34
|
/**
|
|
57
|
-
*
|
|
35
|
+
* Designates the next view to receive focus when the user navigates down. See the Android documentation.
|
|
36
|
+
*
|
|
37
|
+
* @platform android
|
|
58
38
|
*/
|
|
59
39
|
nextFocusDown?: ?number,
|
|
60
40
|
|
|
61
41
|
/**
|
|
62
|
-
*
|
|
42
|
+
* Designates the next view to receive focus when the user navigates forward. See the Android documentation.
|
|
43
|
+
*
|
|
44
|
+
* @platform android
|
|
63
45
|
*/
|
|
64
46
|
nextFocusForward?: ?number,
|
|
65
47
|
|
|
66
48
|
/**
|
|
67
|
-
*
|
|
49
|
+
* Designates the next view to receive focus when the user navigates left. See the Android documentation.
|
|
50
|
+
*
|
|
51
|
+
* @platform android
|
|
68
52
|
*/
|
|
69
53
|
nextFocusLeft?: ?number,
|
|
70
54
|
|
|
71
55
|
/**
|
|
72
|
-
*
|
|
56
|
+
* Designates the next view to receive focus when the user navigates right. See the Android documentation.
|
|
57
|
+
*
|
|
58
|
+
* @platform android
|
|
73
59
|
*/
|
|
74
60
|
nextFocusRight?: ?number,
|
|
75
61
|
|
|
76
62
|
/**
|
|
77
|
-
*
|
|
63
|
+
* Designates the next view to receive focus when the user navigates up. See the Android documentation.
|
|
64
|
+
*
|
|
65
|
+
* @platform android
|
|
78
66
|
*/
|
|
79
67
|
nextFocusUp?: ?number,
|
|
68
|
+
};
|
|
80
69
|
|
|
70
|
+
export type TouchableNativeFeedbackProps = $ReadOnly<{
|
|
71
|
+
...TouchableWithoutFeedbackProps,
|
|
72
|
+
...TVProps,
|
|
73
|
+
/**
|
|
74
|
+
* Determines the type of background drawable that's going to be used to display feedback.
|
|
75
|
+
* It takes an object with type property and extra data depending on the type.
|
|
76
|
+
* It's recommended to use one of the following static methods to generate that dictionary:
|
|
77
|
+
* 1) TouchableNativeFeedback.SelectableBackground() - will create object that represents android theme's
|
|
78
|
+
* default background for selectable elements (?android:attr/selectableItemBackground)
|
|
79
|
+
* 2) TouchableNativeFeedback.SelectableBackgroundBorderless() - will create object that represent android
|
|
80
|
+
* theme's default background for borderless selectable elements
|
|
81
|
+
* (?android:attr/selectableItemBackgroundBorderless). Available on android API level 21+
|
|
82
|
+
* 3) TouchableNativeFeedback.Ripple(color, borderless) - will create object that represents ripple drawable
|
|
83
|
+
* with specified color (as a string). If property borderless evaluates to true the ripple will render
|
|
84
|
+
* outside of the view bounds (see native actionbar buttons as an example of that behavior). This background
|
|
85
|
+
* type is available on Android API level 21+
|
|
86
|
+
*/
|
|
87
|
+
background?: ?(
|
|
88
|
+
| $ReadOnly<{
|
|
89
|
+
type: 'ThemeAttrAndroid',
|
|
90
|
+
attribute:
|
|
91
|
+
| 'selectableItemBackground'
|
|
92
|
+
| 'selectableItemBackgroundBorderless',
|
|
93
|
+
rippleRadius: ?number,
|
|
94
|
+
}>
|
|
95
|
+
| $ReadOnly<{
|
|
96
|
+
type: 'RippleAndroid',
|
|
97
|
+
color: ?number,
|
|
98
|
+
borderless: boolean,
|
|
99
|
+
rippleRadius: ?number,
|
|
100
|
+
}>
|
|
101
|
+
),
|
|
81
102
|
/**
|
|
82
103
|
* Set to true to add the ripple effect to the foreground of the view, instead
|
|
83
104
|
* of the background. This is useful if one of your child views has a
|
|
@@ -95,50 +116,74 @@ type State = $ReadOnly<{
|
|
|
95
116
|
pressability: Pressability,
|
|
96
117
|
}>;
|
|
97
118
|
|
|
98
|
-
|
|
119
|
+
/**
|
|
120
|
+
* A wrapper for making views respond properly to touches (Android only).
|
|
121
|
+
* On Android this component uses native state drawable to display touch feedback.
|
|
122
|
+
* At the moment it only supports having a single View instance as a child node,
|
|
123
|
+
* as it's implemented by replacing that View with another instance of RCTView node with some additional properties set.
|
|
124
|
+
*
|
|
125
|
+
* Background drawable of native feedback touchable can be customized with background property.
|
|
126
|
+
*
|
|
127
|
+
* @see https://reactnative.dev/docs/touchablenativefeedback#content
|
|
128
|
+
*/
|
|
129
|
+
class TouchableNativeFeedback extends React.Component<
|
|
130
|
+
TouchableNativeFeedbackProps,
|
|
131
|
+
State,
|
|
132
|
+
> {
|
|
99
133
|
/**
|
|
100
|
-
* Creates
|
|
101
|
-
*
|
|
134
|
+
* Creates an object that represents android theme's default background for
|
|
135
|
+
* selectable elements (?android:attr/selectableItemBackground).
|
|
136
|
+
*
|
|
137
|
+
* @param rippleRadius The radius of ripple effect
|
|
102
138
|
*/
|
|
103
|
-
static SelectableBackground: (rippleRadius
|
|
139
|
+
static SelectableBackground: (rippleRadius?: ?number) => $ReadOnly<{
|
|
104
140
|
attribute: 'selectableItemBackground',
|
|
105
141
|
type: 'ThemeAttrAndroid',
|
|
106
142
|
rippleRadius: ?number,
|
|
107
|
-
}> = (rippleRadius
|
|
143
|
+
}> = (rippleRadius?: ?number) => ({
|
|
108
144
|
type: 'ThemeAttrAndroid',
|
|
109
145
|
attribute: 'selectableItemBackground',
|
|
110
146
|
rippleRadius,
|
|
111
147
|
});
|
|
112
148
|
|
|
113
149
|
/**
|
|
114
|
-
* Creates
|
|
115
|
-
*
|
|
150
|
+
* Creates an object that represent android theme's default background for borderless
|
|
151
|
+
* selectable elements (?android:attr/selectableItemBackgroundBorderless).
|
|
152
|
+
* Available on android API level 21+.
|
|
153
|
+
*
|
|
154
|
+
* @param rippleRadius The radius of ripple effect
|
|
116
155
|
*/
|
|
117
|
-
static SelectableBackgroundBorderless: (rippleRadius
|
|
156
|
+
static SelectableBackgroundBorderless: (rippleRadius?: ?number) => $ReadOnly<{
|
|
118
157
|
attribute: 'selectableItemBackgroundBorderless',
|
|
119
158
|
type: 'ThemeAttrAndroid',
|
|
120
159
|
rippleRadius: ?number,
|
|
121
|
-
}> = (rippleRadius
|
|
160
|
+
}> = (rippleRadius?: ?number) => ({
|
|
122
161
|
type: 'ThemeAttrAndroid',
|
|
123
162
|
attribute: 'selectableItemBackgroundBorderless',
|
|
124
163
|
rippleRadius,
|
|
125
164
|
});
|
|
126
165
|
|
|
127
166
|
/**
|
|
128
|
-
* Creates
|
|
129
|
-
*
|
|
130
|
-
* of the view bounds
|
|
167
|
+
* Creates an object that represents ripple drawable with specified color (as a
|
|
168
|
+
* string). If property `borderless` evaluates to true the ripple will
|
|
169
|
+
* render outside of the view bounds (see native actionbar buttons as an
|
|
170
|
+
* example of that behavior). This background type is available on Android
|
|
171
|
+
* API level 21+.
|
|
172
|
+
*
|
|
173
|
+
* @param color The ripple color
|
|
174
|
+
* @param borderless If the ripple can render outside it's bounds
|
|
175
|
+
* @param rippleRadius The radius of ripple effect
|
|
131
176
|
*/
|
|
132
177
|
static Ripple: (
|
|
133
178
|
color: string,
|
|
134
179
|
borderless: boolean,
|
|
135
|
-
rippleRadius
|
|
180
|
+
rippleRadius?: ?number,
|
|
136
181
|
) => $ReadOnly<{
|
|
137
182
|
borderless: boolean,
|
|
138
183
|
color: ?number,
|
|
139
184
|
rippleRadius: ?number,
|
|
140
185
|
type: 'RippleAndroid',
|
|
141
|
-
}> = (color: string, borderless: boolean, rippleRadius
|
|
186
|
+
}> = (color: string, borderless: boolean, rippleRadius?: ?number) => {
|
|
142
187
|
const processedColor = processColor(color);
|
|
143
188
|
invariant(
|
|
144
189
|
processedColor == null || typeof processedColor === 'number',
|
|
@@ -336,7 +381,10 @@ class TouchableNativeFeedback extends React.Component<Props, State> {
|
|
|
336
381
|
);
|
|
337
382
|
}
|
|
338
383
|
|
|
339
|
-
componentDidUpdate(
|
|
384
|
+
componentDidUpdate(
|
|
385
|
+
prevProps: TouchableNativeFeedbackProps,
|
|
386
|
+
prevState: State,
|
|
387
|
+
) {
|
|
340
388
|
this.state.pressability.configure(this._createPressabilityConfig());
|
|
341
389
|
}
|
|
342
390
|
|