mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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
This commit is contained in:
committed by
Facebook Github Bot
parent
5a4d68feb5
commit
548aad4ff1
@@ -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,
|
||||
|}>;
|
||||
@@ -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]}
|
||||
|
||||
@@ -1,14 +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.
|
||||
*
|
||||
* @providesModule PlatformViewPropTypes
|
||||
* @format
|
||||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
export type PlatformViewPropTypes = {};
|
||||
@@ -1,16 +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.
|
||||
*
|
||||
* @providesModule PlatformViewPropTypes
|
||||
* @format
|
||||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {TVViewProps} from '../AppleTV/TVViewPropTypes';
|
||||
|
||||
export type PlatformViewPropTypes = TVViewProps;
|
||||
@@ -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 @@ RCT_EXPORT_MODULE()
|
||||
#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)
|
||||
|
||||
Reference in New Issue
Block a user