Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions packages/react-native/Libraries/Components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,6 @@ type ButtonPropsCore = Readonly<{
*/
color?: ?ColorValue,

/**
* TV preferred focus.
*
* @platform tv
*
* @default `false`
* @deprecated Use `focusable` instead
*/
hasTVPreferredFocus?: ?boolean,

/**
* Designates the next view to receive focus when the user navigates down. See
* the [Android documentation][android:nextFocusDown].
Expand Down Expand Up @@ -219,7 +209,6 @@ const Button: component(
onPress,
touchSoundDisabled,
title,
hasTVPreferredFocus,
nextFocusDown,
nextFocusForward,
nextFocusLeft,
Expand Down Expand Up @@ -290,7 +279,6 @@ const Button: component(
accessibilityRole="button"
accessibilityState={_accessibilityState}
importantForAccessibility={_importantForAccessibility}
hasTVPreferredFocus={hasTVPreferredFocus}
nextFocusDown={nextFocusDown}
nextFocusForward={nextFocusForward}
nextFocusLeft={nextFocusLeft}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ type AndroidProps = Readonly<{
nextFocusUp?: ?number,
}>;

type IOSProps = Readonly<{
/**
* @deprecated Use `focusable` instead
*/
hasTVPreferredFocus?: ?boolean,
}>;

type TouchableHighlightBaseProps = Readonly<{
/**
* Opacity of the wrapped view when touch is active. Requires `underlayColor` to be set.
Expand Down Expand Up @@ -75,7 +68,6 @@ type TouchableHighlightBaseProps = Readonly<{
export type TouchableHighlightProps = Readonly<{
...TouchableWithoutFeedbackProps,
...AndroidProps,
...IOSProps,
...TouchableHighlightBaseProps,
}>;

Expand Down Expand Up @@ -281,7 +273,6 @@ class TouchableHighlightImpl extends React.Component<
)}
onLayout={this.props.onLayout}
hitSlop={this.props.hitSlop}
hasTVPreferredFocus={this.props.hasTVPreferredFocus}
nextFocusDown={this.props.nextFocusDown}
nextFocusForward={this.props.nextFocusForward}
nextFocusLeft={this.props.nextFocusLeft}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ import * as React from 'react';
import {cloneElement} from 'react';

type TouchableNativeFeedbackTVProps = {
/**
* *(Apple TV only)* TV preferred focus (see documentation for the View component).
*
* @platform ios
* @deprecated Use `focusable` instead
*/
hasTVPreferredFocus?: ?boolean,

/**
* Designates the next view to receive focus when the user navigates down. See the Android documentation.
*
Expand Down Expand Up @@ -345,7 +337,6 @@ class TouchableNativeFeedback extends React.Component<
accessibilityLiveRegion: accessibilityLiveRegion,
accessibilityElementsHidden:
this.props['aria-hidden'] ?? this.props.accessibilityElementsHidden,
hasTVPreferredFocus: this.props.hasTVPreferredFocus,
hitSlop: this.props.hitSlop,
focusable:
this.props.focusable !== false &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ import * as React from 'react';
export type TouchableOpacityInstance = HostInstance;

export type TouchableOpacityTVProps = Readonly<{
/**
* *(Apple TV only)* TV preferred focus (see documentation for the View component).
*
* @platform ios
* @deprecated Use `focusable` instead
*/
hasTVPreferredFocus?: ?boolean,

/**
* Designates the next view to receive focus when the user navigates down. See the Android documentation.
*
Expand Down Expand Up @@ -261,7 +253,6 @@ class TouchableOpacity extends React.Component<
nextFocusLeft={this.props.nextFocusLeft}
nextFocusRight={this.props.nextFocusRight}
nextFocusUp={this.props.nextFocusUp}
hasTVPreferredFocus={this.props.hasTVPreferredFocus}
hitSlop={this.props.hitSlop}
focusable={
this.props.focusable !== false &&
Expand Down
16 changes: 0 additions & 16 deletions packages/react-native/Libraries/Components/View/ViewPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,6 @@ export type ViewPropsAndroid = Readonly<{
*/
renderToHardwareTextureAndroid?: ?boolean,

/**
* Whether to force the Android TV focus engine to move focus to this view.
*
* @platform android
* @deprecated Use `focusable` instead
*/
hasTVPreferredFocus?: ?boolean,

/**
* Designates the next view to receive focus when the user navigates down.
* The value is the `nativeID` of the target view.
Expand Down Expand Up @@ -390,14 +382,6 @@ export type TVViewPropsIOS = Readonly<{
*/
isTVSelectable?: boolean,

/**
* *(Apple TV only)* May be set to true to force the Apple TV focus engine to move focus to this view.
*
* @platform ios
* @deprecated Use `focusable` instead
*/
hasTVPreferredFocus?: boolean,

/**
* *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 2.0.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ function createViewsWithLargeAmountOfPropsAndStyles(count: number): React.Node {
aria-live={'polite'}
collapsable={false}
focusable={i % 2 === 0}
hasTVPreferredFocus={i % 2 === 0}
id={String(i)}
importantForAccessibility={'no-hide-descendants'}
nativeID={String(i)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ function buildViewsWithFullPropBag(
aria-live="polite"
collapsable={false}
focusable={i % 2 === 0}
hasTVPreferredFocus={i % 2 === 0}
id={String(i)}
importantForAccessibility="no-hide-descendants"
nativeID={String(i)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ const validAttributesForNonEventProps = {

// ReactViewManager @ReactProps
accessible: true,
hasTVPreferredFocus: true,
nextFocusDown: true,
nextFocusForward: true,
nextFocusLeft: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,16 @@ public open class ReactViewManager : ReactClippingViewManager<ReactViewGroup>()
view.axOrderList = axOrderList
}

@ReactProp(name = "hasTVPreferredFocus")
public open fun setTVPreferredFocus(view: ReactViewGroup, hasTVPreferredFocus: Boolean) {
if (hasTVPreferredFocus) {
view.isFocusable = true
view.isFocusableInTouchMode = true
view.requestFocus()
}
}
/**
* Retained for binary compatibility with [ReactViewManager] subclasses.
*
* This method no longer registers a React prop or changes view focus.
*/
@Deprecated("Use focusable or focus() instead")
public open fun setTVPreferredFocus(
view: ReactViewGroup,
hasTVPreferredFocus: Boolean,
): Unit = Unit

@ReactProp(name = ViewProps.BACKGROUND_IMAGE, customType = "BackgroundImage")
public open fun setBackgroundImage(view: ReactViewGroup, backgroundImage: ReadableArray?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ void FocusOrderingHelper::traverseAndUpdateNextFocusableElement(
// We only care about focusable elements since only they can be both
// focused and present in the hierarchy
if (currNode->getTraits().check(ShadowNodeTraits::Trait::KeyboardFocusable) ||
(props != nullptr &&
(props->focusable || props->accessible || props->hasTVPreferredFocus))) {
(props != nullptr && (props->focusable || props->accessible))) {
LayoutMetrics nodeLayoutMetrics = uimanager.getRelativeLayoutMetrics(
*currNode, parentShadowNode.get(), {.includeTransform = true});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ HostPlatformViewProps::HostPlatformViewProps(
"focusable",
sourceProps.focusable,
{})),
hasTVPreferredFocus(convertRawProp(
context,
rawProps,
"hasTVPreferredFocus",
sourceProps.hasTVPreferredFocus,
{})),
needsOffscreenAlphaCompositing(convertRawProp(
context,
rawProps,
Expand Down Expand Up @@ -120,7 +114,6 @@ void HostPlatformViewProps::setProp(
RAW_SET_PROP_SWITCH_CASE(nativeBackground, "nativeBackgroundAndroid");
RAW_SET_PROP_SWITCH_CASE(nativeForeground, "nativeForegroundAndroid");
RAW_SET_PROP_SWITCH_CASE_BASIC(focusable);
RAW_SET_PROP_SWITCH_CASE_BASIC(hasTVPreferredFocus);
RAW_SET_PROP_SWITCH_CASE_BASIC(needsOffscreenAlphaCompositing);
RAW_SET_PROP_SWITCH_CASE_BASIC(renderToHardwareTextureAndroid);
RAW_SET_PROP_SWITCH_CASE_BASIC(screenReaderFocusable);
Expand Down Expand Up @@ -482,10 +475,6 @@ folly::dynamic HostPlatformViewProps::getDiffProps(
result["focusable"] = focusable;
}

if (hasTVPreferredFocus != oldProps->hasTVPreferredFocus) {
result["hasTVPreferredFocus"] = hasTVPreferredFocus;
}

if (needsOffscreenAlphaCompositing !=
oldProps->needsOffscreenAlphaCompositing) {
result["needsOffscreenAlphaCompositing"] = needsOffscreenAlphaCompositing;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class HostPlatformViewProps : public BaseViewProps {
std::optional<NativeDrawable> nativeForeground{};

bool focusable{false};
bool hasTVPreferredFocus{false};
bool needsOffscreenAlphaCompositing{false};
bool renderToHardwareTextureAndroid{false};
bool screenReaderFocusable{false};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ inline bool formsStackingContext(const ViewProps &viewProps)
inline bool formsView(const ViewProps &viewProps)
{
return viewProps.nativeBackground.has_value() || viewProps.nativeForeground.has_value() || viewProps.focusable ||
viewProps.hasTVPreferredFocus || viewProps.needsOffscreenAlphaCompositing ||
viewProps.renderToHardwareTextureAndroid || viewProps.screenReaderFocusable;
viewProps.needsOffscreenAlphaCompositing || viewProps.renderToHardwareTextureAndroid ||
viewProps.screenReaderFocusable;
}

inline bool isKeyboardFocusable(const ViewProps &viewProps)
{
return (viewProps.focusable || viewProps.hasTVPreferredFocus);
return viewProps.focusable;
}

} // namespace facebook::react::HostPlatformViewTraitsInitializer
Loading
Loading