Apple TV: TouchableOpacity and Button need hasTVPreferredFocus support
Summary: **Motivation** Give `TouchableOpacity` and `Button` the same TV focus support as is already present in `TouchableHighlight`. **Test plan** Manual testing on TV simulator and devices. Closes https://github.com/facebook/react-native/pull/15561 Differential Revision: D5665976 Pulled By: hramos fbshipit-source-id: 0d5c588e1c82471f23617a3df1b77abc589a7c63
This commit is contained in:
parent
52a67db629
commit
c1223c5530
|
@ -58,6 +58,7 @@ class Button extends React.Component<{
|
|||
accessibilityLabel?: ?string,
|
||||
disabled?: ?boolean,
|
||||
testID?: ?string,
|
||||
hasTVPreferredFocus?: ?boolean,
|
||||
}> {
|
||||
static propTypes = {
|
||||
/**
|
||||
|
@ -84,6 +85,12 @@ class Button extends React.Component<{
|
|||
* Used to locate this view in end-to-end tests.
|
||||
*/
|
||||
testID: PropTypes.string,
|
||||
/**
|
||||
* *(Apple TV only)* TV preferred focus (see documentation for the View component).
|
||||
*
|
||||
* @platform ios
|
||||
*/
|
||||
hasTVPreferredFocus: PropTypes.bool,
|
||||
};
|
||||
|
||||
render() {
|
||||
|
@ -92,6 +99,7 @@ class Button extends React.Component<{
|
|||
color,
|
||||
onPress,
|
||||
title,
|
||||
hasTVPreferredFocus,
|
||||
disabled,
|
||||
testID,
|
||||
} = this.props;
|
||||
|
@ -121,6 +129,7 @@ class Button extends React.Component<{
|
|||
accessibilityComponentType="button"
|
||||
accessibilityLabel={accessibilityLabel}
|
||||
accessibilityTraits={accessibilityTraits}
|
||||
hasTVPreferredFocus={hasTVPreferredFocus}
|
||||
testID={testID}
|
||||
disabled={disabled}
|
||||
onPress={onPress}>
|
||||
|
|
|
@ -129,6 +129,12 @@ var TouchableOpacity = createReactClass({
|
|||
* active. Defaults to 0.2.
|
||||
*/
|
||||
activeOpacity: PropTypes.number,
|
||||
/**
|
||||
* *(Apple TV only)* TV preferred focus (see documentation for the View component).
|
||||
*
|
||||
* @platform ios
|
||||
*/
|
||||
hasTVPreferredFocus: PropTypes.bool,
|
||||
/**
|
||||
* Apple TV parallax effects
|
||||
*/
|
||||
|
@ -246,6 +252,7 @@ var TouchableOpacity = createReactClass({
|
|||
testID={this.props.testID}
|
||||
onLayout={this.props.onLayout}
|
||||
isTVSelectable={true}
|
||||
hasTVPreferredFocus={this.props.hasTVPreferredFocus}
|
||||
tvParallaxProperties={this.props.tvParallaxProperties}
|
||||
hitSlop={this.props.hitSlop}
|
||||
onStartShouldSetResponder={this.touchableHandleStartShouldSetResponder}
|
||||
|
|
Loading…
Reference in New Issue