From 548aad4ff1dfef0d71bdd39aa83ad71e522a2546 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Fri, 1 Nov 2019 08:47:27 -0700 Subject: [PATCH] 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 --- .../Components/AppleTV/TVViewPropTypes.js | 108 ------------------ .../Touchable/TouchableHighlight.js | 19 --- .../TouchableNativeFeedback.android.js | 1 - .../Components/Touchable/TouchableOpacity.js | 8 -- .../TouchableHighlight-test.js.snap | 1 - .../View/PlatformViewPropTypes.android.js | 14 --- .../View/PlatformViewPropTypes.ios.js | 16 --- .../View/ReactNativeViewViewConfig.js | 2 - Libraries/Components/View/ViewPropTypes.js | 12 +- .../DeprecatedTVViewPropTypes.js | 2 - .../DeprecatedViewPropTypes.js | 6 - RNTester/js/components/ListExampleShared.js | 3 - .../js/examples/Touchable/TouchableExample.js | 4 - React/Views/RCTViewManager.m | 2 +- 14 files changed, 8 insertions(+), 190 deletions(-) delete mode 100644 Libraries/Components/AppleTV/TVViewPropTypes.js delete mode 100644 Libraries/Components/View/PlatformViewPropTypes.android.js delete mode 100644 Libraries/Components/View/PlatformViewPropTypes.ios.js diff --git a/Libraries/Components/AppleTV/TVViewPropTypes.js b/Libraries/Components/AppleTV/TVViewPropTypes.js deleted file mode 100644 index d7492967bc128b..00000000000000 --- a/Libraries/Components/AppleTV/TVViewPropTypes.js +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -export type TVParallaxPropertiesType = $ReadOnly<{| - /** - * If true, parallax effects are enabled. Defaults to true. - */ - enabled?: boolean, - - /** - * Defaults to 2.0. - */ - shiftDistanceX?: number, - - /** - * Defaults to 2.0. - */ - shiftDistanceY?: number, - - /** - * Defaults to 0.05. - */ - tiltAngle?: number, - - /** - * Defaults to 1.0 - */ - magnification?: number, - - /** - * Defaults to 1.0 - */ - pressMagnification?: number, - - /** - * Defaults to 0.3 - */ - pressDuration?: number, - - /** - * Defaults to 0.3 - */ - pressDelay?: number, -|}>; - -/** - * Additional View properties for Apple TV - */ -export type TVViewProps = $ReadOnly<{| - /** - * *(Apple TV only)* When set to true, this view will be focusable - * and navigable using the Apple TV remote. - * - * @platform ios - */ - 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 - */ - hasTVPreferredFocus?: boolean, - - /** - * *(Apple TV only)* Object with properties to control Apple TV parallax effects. - * - * @platform ios - */ - tvParallaxProperties?: TVParallaxPropertiesType, - - /** - * *(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. - * - * @platform ios - */ - tvParallaxShiftDistanceX?: number, - - /** - * *(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. - * - * @platform ios - */ - tvParallaxShiftDistanceY?: number, - - /** - * *(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 0.05. - * - * @platform ios - */ - tvParallaxTiltAngle?: number, - - /** - * *(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 1.0. - * - * @platform ios - */ - tvParallaxMagnification?: number, -|}>; diff --git a/Libraries/Components/Touchable/TouchableHighlight.js b/Libraries/Components/Touchable/TouchableHighlight.js index 56606d0d3ec31c..561d23454884b4 100644 --- a/Libraries/Components/Touchable/TouchableHighlight.js +++ b/Libraries/Components/Touchable/TouchableHighlight.js @@ -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} diff --git a/Libraries/Components/Touchable/TouchableNativeFeedback.android.js b/Libraries/Components/Touchable/TouchableNativeFeedback.android.js index e9ef048c452b01..d3d50404818e2b 100644 --- a/Libraries/Components/Touchable/TouchableNativeFeedback.android.js +++ b/Libraries/Components/Touchable/TouchableNativeFeedback.android.js @@ -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, diff --git a/Libraries/Components/Touchable/TouchableOpacity.js b/Libraries/Components/Touchable/TouchableOpacity.js index 3be1844e1553ce..9751492e48dc45 100644 --- a/Libraries/Components/Touchable/TouchableOpacity.js +++ b/Libraries/Components/Touchable/TouchableOpacity.js @@ -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 diff --git a/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableHighlight-test.js.snap b/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableHighlight-test.js.snap index 3bbbc05d27c045..41d3391d3c4298 100644 --- a/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableHighlight-test.js.snap +++ b/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableHighlight-test.js.snap @@ -4,7 +4,6 @@ exports[`TouchableHighlight renders correctly 1`] = ` { 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}> diff --git a/React/Views/RCTViewManager.m b/React/Views/RCTViewManager.m index 4c503aa8c809bb..550759cabb2684 100644 --- a/React/Views/RCTViewManager.m +++ b/React/Views/RCTViewManager.m @@ -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)