react-native-tvos 0.82.0-0rc3 → 0.82.0-0rc5
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/Libraries/Animated/nodes/AnimatedValue.js +0 -8
- package/Libraries/Components/Pressable/Pressable.d.ts +1 -1
- package/Libraries/Components/Pressable/Pressable.js +14 -12
- package/Libraries/Components/Switch/Switch.js +1 -1
- package/Libraries/Components/TV/TVParallaxProperties.d.ts +42 -0
- package/Libraries/Components/TV/TVViewPropTypes.js +45 -8
- package/Libraries/Components/Touchable/TouchableHighlight.js +5 -29
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +5 -49
- package/Libraries/Components/Touchable/TouchableOpacity.js +5 -55
- package/Libraries/Components/View/View.js +12 -0
- package/Libraries/Components/View/ViewPropTypes.d.ts +59 -37
- package/Libraries/Components/View/ViewPropTypes.js +5 -86
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Interaction/PanResponder.js +6 -51
- package/React/Base/RCTBridge.mm +16 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ComponentDescriptors.cpp +0 -1
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ComponentDescriptors.h +0 -1
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ShadowNodes.cpp +0 -1
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ShadowNodes.h +0 -11
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/States.h +0 -2
- package/React/Fabric/Mounting/RCTComponentViewProtocol.h +6 -0
- package/React/Fabric/Mounting/RCTComponentViewRegistry.mm +1 -0
- package/React/Fabric/Mounting/UIView+ComponentViewProtocol.h +2 -0
- package/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm +5 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +10 -0
- package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt +18 -8
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt +2 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt +9 -10
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/index.js +6 -0
- package/package.json +8 -8
- package/sdks/hermes-engine/hermes-engine.podspec +1 -1
- package/sdks/hermes-engine/hermes-utils.rb +2 -2
- package/sdks/hermes-engine/version.properties +1 -1
- package/sdks/hermesc/osx-bin/hermes +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/settings.gradle.kts +23 -0
- package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -0
- package/types/public/ReactNativeTVTypes.d.ts +1 -43
|
@@ -18,7 +18,6 @@ import type {AnimatedNodeConfig} from './AnimatedNode';
|
|
|
18
18
|
import type AnimatedTracking from './AnimatedTracking';
|
|
19
19
|
|
|
20
20
|
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
|
|
21
|
-
import InteractionManager from '../../Interaction/InteractionManager';
|
|
22
21
|
import AnimatedInterpolation from './AnimatedInterpolation';
|
|
23
22
|
import AnimatedWithChildren from './AnimatedWithChildren';
|
|
24
23
|
|
|
@@ -312,10 +311,6 @@ export default class AnimatedValue extends AnimatedWithChildren {
|
|
|
312
311
|
* See https://reactnative.dev/docs/animatedvalue#animate
|
|
313
312
|
*/
|
|
314
313
|
animate(animation: Animation, callback: ?EndCallback): void {
|
|
315
|
-
let handle = null;
|
|
316
|
-
if (animation.__isInteraction) {
|
|
317
|
-
handle = InteractionManager.createInteractionHandle();
|
|
318
|
-
}
|
|
319
314
|
const previousAnimation = this._animation;
|
|
320
315
|
this._animation && this._animation.stop();
|
|
321
316
|
this._animation = animation;
|
|
@@ -328,9 +323,6 @@ export default class AnimatedValue extends AnimatedWithChildren {
|
|
|
328
323
|
},
|
|
329
324
|
result => {
|
|
330
325
|
this._animation = null;
|
|
331
|
-
if (handle !== null) {
|
|
332
|
-
InteractionManager.clearInteractionHandle(handle);
|
|
333
|
-
}
|
|
334
326
|
callback && callback(result);
|
|
335
327
|
},
|
|
336
328
|
previousAnimation,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import {View} from '../View/View';
|
|
21
21
|
import {AccessibilityProps} from '../View/ViewAccessibility';
|
|
22
22
|
import {ViewProps} from '../View/ViewPropTypes';
|
|
23
|
-
import {TVParallaxProperties} from '
|
|
23
|
+
import {TVParallaxProperties} from '../TV/TVParallaxProperties';
|
|
24
24
|
|
|
25
25
|
export interface PressableStateCallbackType {
|
|
26
26
|
readonly pressed: boolean;
|
|
@@ -251,7 +251,7 @@ function Pressable({
|
|
|
251
251
|
const android_rippleConfig = useAndroidRippleForView(android_ripple, viewRef);
|
|
252
252
|
|
|
253
253
|
const [pressed, setPressed] = usePressState(testOnly_pressed === true);
|
|
254
|
-
const [focused, setFocused] =
|
|
254
|
+
const [focused, setFocused] = useState(false);
|
|
255
255
|
|
|
256
256
|
const shouldUpdatePressed =
|
|
257
257
|
typeof children === 'function' || typeof style === 'function';
|
|
@@ -287,9 +287,6 @@ function Pressable({
|
|
|
287
287
|
accessibilityLiveRegion,
|
|
288
288
|
accessibilityLabel,
|
|
289
289
|
accessibilityState: _accessibilityState,
|
|
290
|
-
focusable:
|
|
291
|
-
focusable !== false && disabled !== true && ariaDisabled !== true,
|
|
292
|
-
isTVSelectable: isTVSelectable !== false && accessible !== false,
|
|
293
290
|
accessibilityValue,
|
|
294
291
|
hitSlop,
|
|
295
292
|
};
|
|
@@ -376,6 +373,16 @@ function Pressable({
|
|
|
376
373
|
|
|
377
374
|
const eventHandlers = usePressability(config);
|
|
378
375
|
|
|
376
|
+
const computedStyle = useMemo(() => {
|
|
377
|
+
return typeof style === 'function' ? style({pressed, focused}) : style;
|
|
378
|
+
}, [pressed, focused, style]);
|
|
379
|
+
|
|
380
|
+
const computedChildren = useMemo(() => {
|
|
381
|
+
return typeof children === 'function'
|
|
382
|
+
? children({pressed, focused})
|
|
383
|
+
: children;
|
|
384
|
+
}, [pressed, focused, children]);
|
|
385
|
+
|
|
379
386
|
return (
|
|
380
387
|
<View
|
|
381
388
|
{...restPropsWithDefaults}
|
|
@@ -386,16 +393,11 @@ function Pressable({
|
|
|
386
393
|
nextFocusLeft={tagForComponentOrHandle(props.nextFocusLeft)}
|
|
387
394
|
nextFocusRight={tagForComponentOrHandle(props.nextFocusRight)}
|
|
388
395
|
nextFocusUp={tagForComponentOrHandle(props.nextFocusUp)}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
accessible !== false &&
|
|
392
|
-
disabled !== true &&
|
|
393
|
-
ariaDisabled !== true
|
|
394
|
-
}
|
|
395
|
-
style={typeof style === 'function' ? style({pressed, focused}) : style}
|
|
396
|
+
focusable={focusable !== false && isTVSelectable !== false}
|
|
397
|
+
style={computedStyle}
|
|
396
398
|
tvParallaxProperties={tvParallaxProperties}
|
|
397
399
|
collapsable={false}>
|
|
398
|
-
{
|
|
400
|
+
{computedChildren}
|
|
399
401
|
{__DEV__ ? <PressabilityDebugView color="red" hitSlop={hitSlop} /> : null}
|
|
400
402
|
</View>
|
|
401
403
|
);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type TVParallaxProperties = {
|
|
2
|
+
/**
|
|
3
|
+
* If true, parallax effects are enabled. Defaults to true.
|
|
4
|
+
*/
|
|
5
|
+
enabled?: boolean | undefined,
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Defaults to 2.0.
|
|
9
|
+
*/
|
|
10
|
+
shiftDistanceX?: number | undefined,
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Defaults to 2.0.
|
|
14
|
+
*/
|
|
15
|
+
shiftDistanceY?: number | undefined,
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Defaults to 0.05.
|
|
19
|
+
*/
|
|
20
|
+
tiltAngle?: number | undefined,
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Defaults to 1.0
|
|
24
|
+
*/
|
|
25
|
+
magnification?: number | undefined,
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Defaults to 1.0
|
|
29
|
+
*/
|
|
30
|
+
pressMagnification?: number | undefined,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Defaults to 0.3
|
|
34
|
+
*/
|
|
35
|
+
pressDuration?: number | undefined,
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated No longer used
|
|
39
|
+
*/
|
|
40
|
+
pressDelay?: number | undefined,
|
|
41
|
+
};
|
|
42
|
+
|
|
@@ -53,30 +53,36 @@ export type TVParallaxPropertiesType = $ReadOnly<{|
|
|
|
53
53
|
|}>;
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
56
|
+
* These props are for both Apple TV and Android TV.
|
|
57
|
+
* TODO: update `@react-native/eslint-plugin` so that the
|
|
58
|
+
* name can be changed to TVViewProps
|
|
57
59
|
*/
|
|
58
60
|
export type TVViewProps = $ReadOnly<{|
|
|
59
61
|
/**
|
|
60
|
-
*
|
|
61
|
-
* and navigable using the Apple TV remote.
|
|
62
|
+
* @deprecated Replaced by `focusable`.
|
|
62
63
|
*
|
|
63
64
|
* @platform ios
|
|
64
65
|
*/
|
|
65
|
-
isTVSelectable?: boolean,
|
|
66
|
+
isTVSelectable?: ?boolean,
|
|
66
67
|
|
|
67
68
|
/**
|
|
68
|
-
*
|
|
69
|
+
* Whether this `View` should be focusable with a non-touch input device, eg. receive focus with a hardware keyboard.
|
|
69
70
|
*
|
|
70
|
-
* @platform ios
|
|
71
71
|
*/
|
|
72
|
-
|
|
72
|
+
focusable?: ?boolean,
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* May be set to true to force the focus engine to move focus to this view.
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
hasTVPreferredFocus?: ?boolean,
|
|
73
79
|
|
|
74
80
|
/**
|
|
75
81
|
* *(Apple TV only)* Object with properties to control Apple TV parallax effects.
|
|
76
82
|
*
|
|
77
83
|
* @platform ios
|
|
78
84
|
*/
|
|
79
|
-
tvParallaxProperties?: TVParallaxPropertiesType,
|
|
85
|
+
tvParallaxProperties?: ?TVParallaxPropertiesType,
|
|
80
86
|
|
|
81
87
|
/**
|
|
82
88
|
* Additional properties needed for flow checks on TVFocusGuideView
|
|
@@ -87,4 +93,35 @@ export type TVViewProps = $ReadOnly<{|
|
|
|
87
93
|
safePadding?: string | null,
|
|
88
94
|
onPressIn?: (event: any) => void,
|
|
89
95
|
onPressOut?: (event: any) => void,
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* TV next focus forward (see documentation for the View component).
|
|
99
|
+
*
|
|
100
|
+
* @platform android
|
|
101
|
+
*/
|
|
102
|
+
nextFocusForward?: ?number,
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* TV next focus down (see documentation for the View component).
|
|
106
|
+
*
|
|
107
|
+
*/
|
|
108
|
+
nextFocusDown?: ?number,
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* TV next focus left (see documentation for the View component).
|
|
112
|
+
*
|
|
113
|
+
*/
|
|
114
|
+
nextFocusLeft?: ?number,
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* TV next focus right (see documentation for the View component).
|
|
118
|
+
*
|
|
119
|
+
*/
|
|
120
|
+
nextFocusRight?: ?number,
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* TV next focus up (see documentation for the View component).
|
|
124
|
+
*
|
|
125
|
+
*/
|
|
126
|
+
nextFocusUp?: ?number,
|
|
90
127
|
|}>;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
|
12
|
-
import type {
|
|
12
|
+
import type {TVViewProps} from '../TV/TVViewPropTypes';
|
|
13
13
|
import type {AccessibilityState} from '../View/ViewAccessibility';
|
|
14
14
|
import type {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback';
|
|
15
15
|
|
|
@@ -24,25 +24,6 @@ import tagForComponentOrHandle from '../TV/tagForComponentOrHandle';
|
|
|
24
24
|
import * as React from 'react';
|
|
25
25
|
import {cloneElement} from 'react';
|
|
26
26
|
|
|
27
|
-
type AndroidProps = $ReadOnly<{
|
|
28
|
-
nextFocusDown?: ?number,
|
|
29
|
-
nextFocusForward?: ?number,
|
|
30
|
-
nextFocusLeft?: ?number,
|
|
31
|
-
nextFocusRight?: ?number,
|
|
32
|
-
nextFocusUp?: ?number,
|
|
33
|
-
}>;
|
|
34
|
-
|
|
35
|
-
type IOSProps = $ReadOnly<{
|
|
36
|
-
hasTVPreferredFocus?: ?boolean,
|
|
37
|
-
isTVSelectable?: ?boolean,
|
|
38
|
-
tvParallaxProperties?: TVParallaxPropertiesType,
|
|
39
|
-
nextFocusDown?: ?number,
|
|
40
|
-
nextFocusForward?: ?number,
|
|
41
|
-
nextFocusLeft?: ?number,
|
|
42
|
-
nextFocusRight?: ?number,
|
|
43
|
-
nextFocusUp?: ?number,
|
|
44
|
-
}>;
|
|
45
|
-
|
|
46
27
|
type TouchableHighlightBaseProps = $ReadOnly<{
|
|
47
28
|
/**
|
|
48
29
|
* Determines what the opacity of the wrapped view should be when touch is active.
|
|
@@ -71,8 +52,7 @@ type TouchableHighlightBaseProps = $ReadOnly<{
|
|
|
71
52
|
|
|
72
53
|
export type TouchableHighlightProps = $ReadOnly<{
|
|
73
54
|
...TouchableWithoutFeedbackProps,
|
|
74
|
-
...
|
|
75
|
-
...IOSProps,
|
|
55
|
+
...TVViewProps,
|
|
76
56
|
...TouchableHighlightBaseProps,
|
|
77
57
|
}>;
|
|
78
58
|
|
|
@@ -371,8 +351,9 @@ class TouchableHighlightImpl extends React.Component<
|
|
|
371
351
|
onLayout={this.props.onLayout}
|
|
372
352
|
hitSlop={this.props.hitSlop}
|
|
373
353
|
hasTVPreferredFocus={this.props.hasTVPreferredFocus === true}
|
|
374
|
-
|
|
375
|
-
this.props.
|
|
354
|
+
focusable={
|
|
355
|
+
this.props.focusable !== false &&
|
|
356
|
+
this.props.isTVSelectable !== false
|
|
376
357
|
}
|
|
377
358
|
tvParallaxProperties={this.props.tvParallaxProperties}
|
|
378
359
|
nextFocusDown={tagForComponentOrHandle(this.props.nextFocusDown)}
|
|
@@ -380,11 +361,6 @@ class TouchableHighlightImpl extends React.Component<
|
|
|
380
361
|
nextFocusLeft={tagForComponentOrHandle(this.props.nextFocusLeft)}
|
|
381
362
|
nextFocusRight={tagForComponentOrHandle(this.props.nextFocusRight)}
|
|
382
363
|
nextFocusUp={tagForComponentOrHandle(this.props.nextFocusUp)}
|
|
383
|
-
focusable={
|
|
384
|
-
this.props.focusable !== false &&
|
|
385
|
-
this.props.onPress !== undefined &&
|
|
386
|
-
!this.props.disabled
|
|
387
|
-
}
|
|
388
364
|
nativeID={this.props.id ?? this.props.nativeID}
|
|
389
365
|
testID={this.props.testID}
|
|
390
366
|
ref={this.props.hostRef}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {GestureResponderEvent} from '../../Types/CoreEventTypes';
|
|
12
|
+
import type {TVViewProps} from '../TV/TVViewPropTypes';
|
|
12
13
|
import type {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback';
|
|
13
14
|
|
|
14
15
|
import View from '../../Components/View/View';
|
|
@@ -25,53 +26,9 @@ import invariant from 'invariant';
|
|
|
25
26
|
import * as React from 'react';
|
|
26
27
|
import {cloneElement} from 'react';
|
|
27
28
|
|
|
28
|
-
type TouchableNativeFeedbackTVProps = {
|
|
29
|
-
/**
|
|
30
|
-
* *(Apple TV only)* TV preferred focus (see documentation for the View component).
|
|
31
|
-
*
|
|
32
|
-
* @platform ios
|
|
33
|
-
*/
|
|
34
|
-
hasTVPreferredFocus?: ?boolean,
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Designates the next view to receive focus when the user navigates down. See the Android documentation.
|
|
38
|
-
*
|
|
39
|
-
* @platform android
|
|
40
|
-
*/
|
|
41
|
-
nextFocusDown?: ?number,
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Designates the next view to receive focus when the user navigates forward. See the Android documentation.
|
|
45
|
-
*
|
|
46
|
-
* @platform android
|
|
47
|
-
*/
|
|
48
|
-
nextFocusForward?: ?number,
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Designates the next view to receive focus when the user navigates left. See the Android documentation.
|
|
52
|
-
*
|
|
53
|
-
* @platform android
|
|
54
|
-
*/
|
|
55
|
-
nextFocusLeft?: ?number,
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Designates the next view to receive focus when the user navigates right. See the Android documentation.
|
|
59
|
-
*
|
|
60
|
-
* @platform android
|
|
61
|
-
*/
|
|
62
|
-
nextFocusRight?: ?number,
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Designates the next view to receive focus when the user navigates up. See the Android documentation.
|
|
66
|
-
*
|
|
67
|
-
* @platform android
|
|
68
|
-
*/
|
|
69
|
-
nextFocusUp?: ?number,
|
|
70
|
-
};
|
|
71
|
-
|
|
72
29
|
export type TouchableNativeFeedbackProps = $ReadOnly<{
|
|
73
30
|
...TouchableWithoutFeedbackProps,
|
|
74
|
-
...
|
|
31
|
+
...TVViewProps,
|
|
75
32
|
/**
|
|
76
33
|
* Determines the type of background drawable that's going to be used to display feedback.
|
|
77
34
|
* It takes an object with type property and extra data depending on the type.
|
|
@@ -366,16 +323,15 @@ class TouchableNativeFeedback extends React.Component<
|
|
|
366
323
|
this.props['aria-hidden'] ?? this.props.accessibilityElementsHidden,
|
|
367
324
|
hasTVPreferredFocus: this.props.hasTVPreferredFocus,
|
|
368
325
|
hitSlop: this.props.hitSlop,
|
|
369
|
-
focusable:
|
|
370
|
-
this.props.focusable !== false &&
|
|
371
|
-
this.props.onPress !== undefined &&
|
|
372
|
-
!this.props.disabled,
|
|
373
326
|
nativeID: this.props.id ?? this.props.nativeID,
|
|
374
327
|
nextFocusDown: tagForComponentOrHandle(this.props.nextFocusDown),
|
|
375
328
|
nextFocusForward: tagForComponentOrHandle(this.props.nextFocusForward),
|
|
376
329
|
nextFocusLeft: tagForComponentOrHandle(this.props.nextFocusLeft),
|
|
377
330
|
nextFocusRight: tagForComponentOrHandle(this.props.nextFocusRight),
|
|
378
331
|
nextFocusUp: tagForComponentOrHandle(this.props.nextFocusUp),
|
|
332
|
+
focusable:
|
|
333
|
+
this.props.focusable !== false &&
|
|
334
|
+
this.props.isTVSelectable !== false,
|
|
379
335
|
onLayout: this.props.onLayout,
|
|
380
336
|
testID: this.props.testID,
|
|
381
337
|
},
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
|
|
12
|
-
import type {
|
|
12
|
+
import type {TVViewProps} from '../TV/TVViewPropTypes';
|
|
13
13
|
import type {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback';
|
|
14
14
|
|
|
15
15
|
import Animated from '../../Animated/Animated';
|
|
@@ -23,52 +23,6 @@ import Platform from '../../Utilities/Platform';
|
|
|
23
23
|
import tagForComponentOrHandle from '../TV/tagForComponentOrHandle';
|
|
24
24
|
import * as React from 'react';
|
|
25
25
|
|
|
26
|
-
export type TouchableOpacityTVProps = $ReadOnly<{
|
|
27
|
-
/**
|
|
28
|
-
* *(Apple TV only)* TV preferred focus (see documentation for the View component).
|
|
29
|
-
*
|
|
30
|
-
* @platform ios
|
|
31
|
-
*/
|
|
32
|
-
hasTVPreferredFocus?: ?boolean,
|
|
33
|
-
isTVSelectable?: ?boolean,
|
|
34
|
-
tvParallaxProperties?: TVParallaxPropertiesType,
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Designates the next view to receive focus when the user navigates down. See the Android documentation.
|
|
38
|
-
*
|
|
39
|
-
* @platform android
|
|
40
|
-
*/
|
|
41
|
-
nextFocusDown?: ?number,
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Designates the next view to receive focus when the user navigates forward. See the Android documentation.
|
|
45
|
-
*
|
|
46
|
-
* @platform android
|
|
47
|
-
*/
|
|
48
|
-
nextFocusForward?: ?number,
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Designates the next view to receive focus when the user navigates left. See the Android documentation.
|
|
52
|
-
*
|
|
53
|
-
* @platform android
|
|
54
|
-
*/
|
|
55
|
-
nextFocusLeft?: ?number,
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Designates the next view to receive focus when the user navigates right. See the Android documentation.
|
|
59
|
-
*
|
|
60
|
-
* @platform android
|
|
61
|
-
*/
|
|
62
|
-
nextFocusRight?: ?number,
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Designates the next view to receive focus when the user navigates up. See the Android documentation.
|
|
66
|
-
*
|
|
67
|
-
* @platform android
|
|
68
|
-
*/
|
|
69
|
-
nextFocusUp?: ?number,
|
|
70
|
-
}>;
|
|
71
|
-
|
|
72
26
|
type TouchableOpacityBaseProps = $ReadOnly<{
|
|
73
27
|
/**
|
|
74
28
|
* Determines what the opacity of the wrapped view should be when touch is active.
|
|
@@ -82,7 +36,7 @@ type TouchableOpacityBaseProps = $ReadOnly<{
|
|
|
82
36
|
|
|
83
37
|
export type TouchableOpacityProps = $ReadOnly<{
|
|
84
38
|
...TouchableWithoutFeedbackProps,
|
|
85
|
-
...
|
|
39
|
+
...TVViewProps,
|
|
86
40
|
...TouchableOpacityBaseProps,
|
|
87
41
|
}>;
|
|
88
42
|
|
|
@@ -338,16 +292,12 @@ class TouchableOpacity extends React.Component<
|
|
|
338
292
|
nextFocusRight={tagForComponentOrHandle(this.props.nextFocusRight)}
|
|
339
293
|
nextFocusUp={tagForComponentOrHandle(this.props.nextFocusUp)}
|
|
340
294
|
hasTVPreferredFocus={this.props.hasTVPreferredFocus === true}
|
|
341
|
-
isTVSelectable={
|
|
342
|
-
this.props.isTVSelectable !== false && this.props.accessible !== false
|
|
343
|
-
}
|
|
344
|
-
tvParallaxProperties={this.props.tvParallaxProperties}
|
|
345
|
-
hitSlop={this.props.hitSlop}
|
|
346
295
|
focusable={
|
|
347
296
|
this.props.focusable !== false &&
|
|
348
|
-
this.props.
|
|
349
|
-
!this.props.disabled
|
|
297
|
+
this.props.isTVSelectable !== false
|
|
350
298
|
}
|
|
299
|
+
tvParallaxProperties={this.props.tvParallaxProperties}
|
|
300
|
+
hitSlop={this.props.hitSlop}
|
|
351
301
|
// $FlowFixMe[prop-missing]
|
|
352
302
|
ref={this.props.hostRef}
|
|
353
303
|
{...eventHandlers}>
|
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import type {HostInstance} from '../../../src/private/types/HostInstance';
|
|
11
12
|
import type {ViewProps} from './ViewPropTypes';
|
|
12
13
|
|
|
13
14
|
import TextAncestorContext from '../../Text/TextAncestorContext';
|
|
15
|
+
import Platform from '../../Utilities/Platform';
|
|
14
16
|
import useMergeRefs from '../../Utilities/useMergeRefs';
|
|
15
17
|
import ViewNativeComponent from './ViewNativeComponent';
|
|
16
18
|
import {Commands} from './ViewNativeComponent';
|
|
@@ -59,6 +61,8 @@ component View(
|
|
|
59
61
|
const {
|
|
60
62
|
accessibilityState,
|
|
61
63
|
accessibilityValue,
|
|
64
|
+
isTVSelectable,
|
|
65
|
+
focusable,
|
|
62
66
|
'aria-busy': ariaBusy,
|
|
63
67
|
'aria-checked': ariaChecked,
|
|
64
68
|
'aria-disabled': ariaDisabled,
|
|
@@ -141,6 +145,14 @@ component View(
|
|
|
141
145
|
};
|
|
142
146
|
}
|
|
143
147
|
|
|
148
|
+
if (Platform.OS === 'ios') {
|
|
149
|
+
processedProps.isTVSelectable = focusable ?? isTVSelectable ?? false;
|
|
150
|
+
delete processedProps.focusable;
|
|
151
|
+
} else {
|
|
152
|
+
processedProps.focusable = focusable ?? false;
|
|
153
|
+
delete processedProps.isTVSelectable;
|
|
154
|
+
}
|
|
155
|
+
|
|
144
156
|
const actualView =
|
|
145
157
|
ref == null ? (
|
|
146
158
|
<ViewNativeComponent {...processedProps} />
|
|
@@ -26,52 +26,92 @@ import {Touchable} from '../Touchable/Touchable';
|
|
|
26
26
|
import {AccessibilityProps} from './ViewAccessibility';
|
|
27
27
|
import type {BubblingEventHandler} from 'react-native/Libraries/Types/CodegenTypes';
|
|
28
28
|
|
|
29
|
-
export
|
|
29
|
+
export type TVParallaxProperties = {
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
|
|
31
|
+
* If true, parallax effects are enabled. Defaults to true.
|
|
32
|
+
*/
|
|
33
|
+
enabled?: boolean | undefined;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Defaults to 2.0.
|
|
37
|
+
*/
|
|
38
|
+
shiftDistanceX?: number | undefined;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Defaults to 2.0.
|
|
42
|
+
*/
|
|
43
|
+
shiftDistanceY?: number | undefined;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Defaults to 0.05.
|
|
47
|
+
*/
|
|
48
|
+
tiltAngle?: number | undefined;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Defaults to 1.0
|
|
52
|
+
*/
|
|
53
|
+
magnification?: number | undefined;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Defaults to 1.0
|
|
57
|
+
*/
|
|
58
|
+
pressMagnification?: number | undefined;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Defaults to 0.3
|
|
62
|
+
*/
|
|
63
|
+
pressDuration?: number | undefined;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated No longer used
|
|
67
|
+
*/
|
|
68
|
+
pressDelay?: number | undefined;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export interface TVViewProps {
|
|
72
|
+
/**
|
|
73
|
+
* Callback that is called when the view is blurred.
|
|
33
74
|
*
|
|
34
|
-
*
|
|
75
|
+
* Note: This will only be called if the view is focusable.
|
|
35
76
|
*/
|
|
36
|
-
|
|
77
|
+
onBlur?: ((e: BlurEvent) => void) | null | undefined;
|
|
37
78
|
|
|
38
79
|
/**
|
|
39
|
-
*
|
|
80
|
+
* Callback that is called when the view is focused.
|
|
40
81
|
*
|
|
41
|
-
*
|
|
82
|
+
* Note: This will only be called if the view is focusable.
|
|
42
83
|
*/
|
|
43
|
-
|
|
84
|
+
onFocus?: ((e: FocusEvent) => void) | null | undefined;
|
|
44
85
|
|
|
45
86
|
/**
|
|
46
|
-
*
|
|
87
|
+
* @deprecated Replaced by `focusable`.
|
|
47
88
|
*
|
|
48
89
|
* @platform ios
|
|
49
90
|
*/
|
|
50
|
-
|
|
91
|
+
isTVSelectable?: boolean | undefined;
|
|
51
92
|
|
|
52
93
|
/**
|
|
53
|
-
* *(Apple TV
|
|
94
|
+
* *(Apple TV and Android TV)* May be set to true to force the Apple TV focus engine to move focus to this view.
|
|
54
95
|
*
|
|
55
96
|
* @platform ios
|
|
56
97
|
*/
|
|
57
|
-
|
|
98
|
+
hasTVPreferredFocus?: boolean | undefined;
|
|
58
99
|
|
|
59
100
|
/**
|
|
60
|
-
*
|
|
101
|
+
* Whether this `View` should be focusable with a non-touch input device, eg. receive focus with a hardware keyboard.
|
|
61
102
|
*
|
|
62
|
-
* @platform ios
|
|
63
103
|
*/
|
|
64
|
-
|
|
104
|
+
focusable?: boolean | undefined;
|
|
65
105
|
|
|
66
106
|
/**
|
|
67
|
-
* *(Apple TV only)*
|
|
107
|
+
* *(Apple TV only)* Object with properties to control Apple TV parallax effects.
|
|
68
108
|
*
|
|
69
109
|
* @platform ios
|
|
70
110
|
*/
|
|
71
|
-
|
|
111
|
+
tvParallaxProperties?: TVParallaxProperties | undefined;
|
|
72
112
|
}
|
|
73
113
|
|
|
74
|
-
export interface ViewPropsIOS
|
|
114
|
+
export interface ViewPropsIOS {
|
|
75
115
|
/**
|
|
76
116
|
* Whether this view should be rendered as a bitmap before compositing.
|
|
77
117
|
*
|
|
@@ -86,20 +126,6 @@ export interface ViewPropsIOS extends TVViewPropsIOS {
|
|
|
86
126
|
}
|
|
87
127
|
|
|
88
128
|
export interface ViewPropsAndroid {
|
|
89
|
-
/**
|
|
90
|
-
* Callback that is called when the view is blurred.
|
|
91
|
-
*
|
|
92
|
-
* Note: This will only be called if the view is focusable.
|
|
93
|
-
*/
|
|
94
|
-
onBlur?: ((e: BlurEvent) => void) | null | undefined;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Callback that is called when the view is focused.
|
|
98
|
-
*
|
|
99
|
-
* Note: This will only be called if the view is focusable.
|
|
100
|
-
*/
|
|
101
|
-
onFocus?: ((e: FocusEvent) => void) | null | undefined;
|
|
102
|
-
|
|
103
129
|
/**
|
|
104
130
|
* Whether this view should render itself (and all of its children) into a single hardware texture on the GPU.
|
|
105
131
|
*
|
|
@@ -109,11 +135,6 @@ export interface ViewPropsAndroid {
|
|
|
109
135
|
*/
|
|
110
136
|
renderToHardwareTextureAndroid?: boolean | undefined;
|
|
111
137
|
|
|
112
|
-
/**
|
|
113
|
-
* Whether this `View` should be focusable with a non-touch input device, eg. receive focus with a hardware keyboard.
|
|
114
|
-
*/
|
|
115
|
-
focusable?: boolean | undefined;
|
|
116
|
-
|
|
117
138
|
/**
|
|
118
139
|
* Indicates whether this `View` should be focusable with a non-touch input device, eg. receive focus with a hardware keyboard.
|
|
119
140
|
* See https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
|
|
@@ -132,6 +153,7 @@ export interface ViewPropsAndroid {
|
|
|
132
153
|
export interface ViewProps
|
|
133
154
|
extends ViewPropsAndroid,
|
|
134
155
|
ViewPropsIOS,
|
|
156
|
+
TVViewProps,
|
|
135
157
|
GestureResponderHandlers,
|
|
136
158
|
Touchable,
|
|
137
159
|
PointerEvents,
|