Skip to content
Permalink
Browse files
RN: Delete Apple TV Props
Summary:
With tvOS (Apple TV) now residing in a separately maintained fork, this removes the residual props from React Native. This only includes the JavaScript changes. The Objective-C changes will come later.

Specifically, the following props have been removed:

- `isTVSelectable`
- `tvParallaxProperties`
- `tvParallaxShiftDistanceX`
- `tvParallaxShiftDistanceY`
- `tvParallaxTiltAngle`
- `tvParallaxMagnification`

Note that `hasTVPreferredFocus` is still being used by Android TV, so it remains.

Changelog:
[Removed] Apple TV View Props

Reviewed By: TheSavior

Differential Revision: D18266278

fbshipit-source-id: 9d1448bf2f434a74e6eb23c70d3a37971e406768
  • Loading branch information
yungsters authored and facebook-github-bot committed Nov 1, 2019
1 parent 5a4d68f commit 548aad4ff1dfef0d71bdd39aa83ad71e522a2546
Show file tree
Hide file tree
Showing 14 changed files with 8 additions and 190 deletions.

This file was deleted.

@@ -29,7 +29,6 @@ import type {PressEvent} from '../../Types/CoreEventTypes';
import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
import type {Props as TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback';
import type {TVParallaxPropertiesType} from '../AppleTV/TVViewPropTypes';

const DEFAULT_PROPS = {
activeOpacity: 0.85,
@@ -41,7 +40,6 @@ const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};

type IOSProps = $ReadOnly<{|
hasTVPreferredFocus?: ?boolean,
tvParallaxProperties?: ?TVParallaxPropertiesType,
|}>;

type AndroidProps = $ReadOnly<{|
@@ -228,21 +226,6 @@ const TouchableHighlight = ((createReactClass({
* @platform android
*/
nextFocusUp: PropTypes.number,
/**
* *(Apple TV only)* Object with properties to control Apple TV parallax effects.
*
* enabled: If true, parallax effects are enabled. Defaults to true.
* shiftDistanceX: Defaults to 2.0.
* shiftDistanceY: Defaults to 2.0.
* tiltAngle: Defaults to 0.05.
* magnification: Defaults to 1.0.
* pressMagnification: Defaults to 1.0.
* pressDuration: Defaults to 0.3.
* pressDelay: Defaults to 0.0.
*
* @platform ios
*/
tvParallaxProperties: PropTypes.object,
/**
* Handy for snapshot tests.
*/
@@ -418,8 +401,6 @@ const TouchableHighlight = ((createReactClass({
)}
onLayout={this.props.onLayout}
hitSlop={this.props.hitSlop}
isTVSelectable={true}
tvParallaxProperties={this.props.tvParallaxProperties}
hasTVPreferredFocus={this.props.hasTVPreferredFocus}
nextFocusDown={this.props.nextFocusDown}
nextFocusForward={this.props.nextFocusForward}
@@ -321,7 +321,6 @@ const TouchableNativeFeedback = createReactClass({
testID: this.props.testID,
onLayout: this.props.onLayout,
hitSlop: this.props.hitSlop,
isTVSelectable: true,
nextFocusDown: this.props.nextFocusDown,
nextFocusForward: this.props.nextFocusForward,
nextFocusLeft: this.props.nextFocusLeft,
@@ -25,7 +25,6 @@ const flattenStyle = require('../../StyleSheet/flattenStyle');

import type {Props as TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback';
import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
import type {TVParallaxPropertiesType} from '../AppleTV/TVViewPropTypes';
import type {PressEvent} from '../../Types/CoreEventTypes';

const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
@@ -37,7 +36,6 @@ type TVProps = $ReadOnly<{|
nextFocusLeft?: ?number,
nextFocusRight?: ?number,
nextFocusUp?: ?number,
tvParallaxProperties?: ?TVParallaxPropertiesType,
|}>;

export type Props = $ReadOnly<{|
@@ -183,10 +181,6 @@ const TouchableOpacity = ((createReactClass({
* @platform android
*/
nextFocusUp: PropTypes.number,
/**
* Apple TV parallax effects
*/
tvParallaxProperties: PropTypes.object,
},

getDefaultProps: function() {
@@ -318,14 +312,12 @@ const TouchableOpacity = ((createReactClass({
nativeID={this.props.nativeID}
testID={this.props.testID}
onLayout={this.props.onLayout}
isTVSelectable={true}
nextFocusDown={this.props.nextFocusDown}
nextFocusForward={this.props.nextFocusForward}
nextFocusLeft={this.props.nextFocusLeft}
nextFocusRight={this.props.nextFocusRight}
nextFocusUp={this.props.nextFocusUp}
hasTVPreferredFocus={this.props.hasTVPreferredFocus}
tvParallaxProperties={this.props.tvParallaxProperties}
hitSlop={this.props.hitSlop}
focusable={
this.props.focusable !== false && this.props.onPress !== undefined
@@ -4,7 +4,6 @@ exports[`TouchableHighlight renders correctly 1`] = `
<View
accessible={true}
focusable={false}
isTVSelectable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}

This file was deleted.

This file was deleted.

@@ -172,7 +172,6 @@ const ReactNativeViewConfig = {
height: true,
hitSlop: {diff: (require('../../Utilities/differ/insetsDiffer'): any)},
importantForAccessibility: true,
isTVSelectable: true,
justifyContent: true,
left: true,
margin: true,
@@ -335,7 +334,6 @@ const ReactNativeViewConfig = {
transform: {diff: require('../../Utilities/differ/matricesDiffer')},
translateX: true,
translateY: true,
tvParallaxProperties: true,
width: true,
zIndex: true,
},
@@ -14,7 +14,6 @@ import type {PressEvent, Layout, LayoutEvent} from '../../Types/CoreEventTypes';
import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType';
import type {Node} from 'react';
import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
import type {TVViewProps} from '../AppleTV/TVViewPropTypes';
import type {
AccessibilityRole,
AccessibilityState,
@@ -275,6 +274,13 @@ type AndroidViewProps = $ReadOnly<{|
*/
importantForAccessibility?: ?('auto' | 'yes' | 'no' | 'no-hide-descendants'),

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

/**
* TV next focus down (see documentation for the View component).
*
@@ -371,10 +377,6 @@ export type ViewProps = $ReadOnly<{|
...AndroidViewProps,
...IOSViewProps,

// There's no easy way to create a different type if (Platform.isTV):
// so we must include TVViewProps
...TVViewProps,

children?: Node,
style?: ?ViewStyleProp,

@@ -13,9 +13,7 @@
const PropTypes = require('prop-types');

const DeprecatedTVViewPropTypes = {
isTVSelectable: PropTypes.bool,
hasTVPreferredFocus: PropTypes.bool,
tvParallaxProperties: PropTypes.object,
tvParallaxShiftDistanceX: PropTypes.number,
tvParallaxShiftDistanceY: PropTypes.number,
tvParallaxTiltAngle: PropTypes.number,
@@ -13,7 +13,6 @@
const DeprecatedEdgeInsetsPropType = require('./DeprecatedEdgeInsetsPropType');
const DeprecatedStyleSheetPropType = require('./DeprecatedStyleSheetPropType');
const DeprecatedViewStylePropTypes = require('./DeprecatedViewStylePropTypes');
const PlatformViewPropTypes = require('../Components/View/PlatformViewPropTypes');
const PropTypes = require('prop-types');

const {DeprecatedAccessibilityRoles} = require('./DeprecatedViewAccessibility');
@@ -406,9 +405,4 @@ module.exports = {
* See http://facebook.github.io/react-native/docs/view.html#needsoffscreenalphacompositing
*/
needsOffscreenAlphaCompositing: PropTypes.bool,

/**
* Any additional platform-specific view prop types, or prop type overrides.
*/
...PlatformViewPropTypes,
};
@@ -69,9 +69,6 @@ class ItemComponent extends React.PureComponent<{
onPress={this._onPress}
onShowUnderlay={this.props.onShowUnderlay}
onHideUnderlay={this.props.onHideUnderlay}
tvParallaxProperties={{
pressMagnification: 1.1,
}}
style={horizontal ? styles.horizItem : styles.item}>
<View
style={[
@@ -60,10 +60,6 @@ class TouchableHighlightBox extends React.Component<{}, $FlowFixMeState> {
style={styles.wrapper}
testID="touchable_highlight_text_button"
activeOpacity={1}
tvParallaxProperties={{
pressMagnification: 1.3,
pressDuration: 0.6,
}}
underlayColor="rgb(210, 230, 255)"
onPress={this.touchableOnPress}>
<View style={styles.wrapperCustom}>
@@ -115,7 +115,7 @@ - (RCTShadowView *)shadowView
#pragma mark - View properties

#if TARGET_OS_TV
// Apple TV properties
// TODO: Delete props for Apple TV.
RCT_EXPORT_VIEW_PROPERTY(isTVSelectable, BOOL)
RCT_EXPORT_VIEW_PROPERTY(hasTVPreferredFocus, BOOL)
RCT_EXPORT_VIEW_PROPERTY(tvParallaxProperties, NSDictionary)

0 comments on commit 548aad4

Please sign in to comment.