Skip to content

Commit

Permalink
TVViewPropTypes, PlatformViewPropTypes, DeprecatedTVViewPropTypes (fa…
Browse files Browse the repository at this point in the history
…cebook#21372)

Summary:
Related to facebook#21342

- Split TVViewPropTypes
- PlatformViewPropTypes (dependencies) flow types and old prop-type definitions
- ViewStylePropTypes (dependencies) rm prop-type

Flow tests succeed

[GENERAL] [ENHANCEMENT] [TVViewPropTypes.js] - rm prop-types
[GENERAL] [ENHANCEMENT] [PlatformViewPropTypes.android.js] - replace prop-types by Flow
[GENERAL] [ENHANCEMENT] [PlatformViewPropTypes.ios.js] - replace prop-types by Flow
[GENERAL] [ENHANCEMENT] [DeprecatedTVViewPropTypes.js] - old prop-types
Pull Request resolved: facebook#21372

Differential Revision: D10095528

Pulled By: TheSavior

fbshipit-source-id: 4fc52ab194f680f95aabefedcbf119d6897672b7
  • Loading branch information
exced authored and facebook-github-bot committed Sep 27, 2018
1 parent 2145bda commit 894a703
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 53 deletions.
73 changes: 41 additions & 32 deletions Libraries/Components/AppleTV/TVViewPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,76 +9,85 @@
*/

'use strict';
const PropTypes = require('prop-types');

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,
|}>;

/**
* Additional View properties for Apple TV
*/
const TVViewPropTypes = {
export type TVViewProps = $ReadOnly<{|
/**
* When set to true, this view will be focusable
* and navigable using the TV remote.
* *(Apple TV only)* When set to true, this view will be focusable
* and navigable using the Apple TV remote.
*
* @platform ios
*/
isTVSelectable: PropTypes.bool,
isTVSelectable?: boolean,

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

/**
* *(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,
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: PropTypes.number,
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: PropTypes.number,
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: PropTypes.number,
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: PropTypes.number,
};

export type TVViewProps = $ReadOnly<{|
isTVSelectable?: boolean,
hasTVPreferredFocus?: boolean,
tvParallaxProperties?: Object,
tvParallaxShiftDistanceX?: number,
tvParallaxShiftDistanceY?: number,
tvParallaxTiltAngle?: number,
tvParallaxMagnification?: number,
|}>;

module.exports = TVViewPropTypes;
14 changes: 14 additions & 0 deletions Libraries/Components/View/PlatformViewPropTypes.android.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* 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 = {};
16 changes: 16 additions & 0 deletions Libraries/Components/View/PlatformViewPropTypes.ios.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* 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 'TVViewPropTypes';

export type PlatformViewPropTypes = TVViewProps;
21 changes: 0 additions & 21 deletions Libraries/Components/View/PlatformViewPropTypes.js

This file was deleted.

25 changes: 25 additions & 0 deletions Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* 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';

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,
tvParallaxMagnification: PropTypes.number,
};

module.exports = DeprecatedTVViewPropTypes;

0 comments on commit 894a703

Please sign in to comment.