Skip to content

Commit

Permalink
RN: Delete Apple TV Props
Browse files Browse the repository at this point in the history
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 548aad4
Show file tree
Hide file tree
Showing 14 changed files with 8 additions and 190 deletions.
108 changes: 0 additions & 108 deletions Libraries/Components/AppleTV/TVViewPropTypes.js

This file was deleted.

19 changes: 0 additions & 19 deletions Libraries/Components/Touchable/TouchableHighlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<{|
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 0 additions & 8 deletions Libraries/Components/Touchable/TouchableOpacity.js
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -37,7 +36,6 @@ type TVProps = $ReadOnly<{|
nextFocusLeft?: ?number,
nextFocusRight?: ?number,
nextFocusUp?: ?number,
tvParallaxProperties?: ?TVParallaxPropertiesType,
|}>;

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

getDefaultProps: function() {
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ exports[`TouchableHighlight renders correctly 1`] = `
<View
accessible={true}
focusable={false}
isTVSelectable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
Expand Down
14 changes: 0 additions & 14 deletions Libraries/Components/View/PlatformViewPropTypes.android.js

This file was deleted.

16 changes: 0 additions & 16 deletions Libraries/Components/View/PlatformViewPropTypes.ios.js

This file was deleted.

2 changes: 0 additions & 2 deletions Libraries/Components/View/ReactNativeViewViewConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -335,7 +334,6 @@ const ReactNativeViewConfig = {
transform: {diff: require('../../Utilities/differ/matricesDiffer')},
translateX: true,
translateY: true,
tvParallaxProperties: true,
width: true,
zIndex: true,
},
Expand Down
12 changes: 7 additions & 5 deletions Libraries/Components/View/ViewPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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).
*
Expand Down Expand Up @@ -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,

Expand Down
2 changes: 0 additions & 2 deletions Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 0 additions & 6 deletions Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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,
};
3 changes: 0 additions & 3 deletions RNTester/js/components/ListExampleShared.js
Original file line number Diff line number Diff line change
Expand Up @@ -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={[
Expand Down
4 changes: 0 additions & 4 deletions RNTester/js/examples/Touchable/TouchableExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}>
Expand Down
2 changes: 1 addition & 1 deletion React/Views/RCTViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 548aad4

Please sign in to comment.