mirror of
https://github.com/status-im/react-native.git
synced 2025-02-22 14:18:23 +00:00
TVViewPropTypes, PlatformViewPropTypes, DeprecatedTVViewPropTypes (#21372)
Summary: Related to #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: https://github.com/facebook/react-native/pull/21372 Differential Revision: D10095528 Pulled By: TheSavior fbshipit-source-id: 4fc52ab194f680f95aabefedcbf119d6897672b7
This commit is contained in:
parent
0da7e8d9ae
commit
e3ae85d7c7
@ -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
Libraries/Components/View/PlatformViewPropTypes.android.js
Normal file
14
Libraries/Components/View/PlatformViewPropTypes.android.js
Normal file
@ -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
Libraries/Components/View/PlatformViewPropTypes.ios.js
Normal file
16
Libraries/Components/View/PlatformViewPropTypes.ios.js
Normal file
@ -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;
|
@ -1,21 +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 strict-local
|
||||
*/
|
||||
|
||||
const Platform = require('Platform');
|
||||
|
||||
let TVViewPropTypes = {};
|
||||
// We need to always include TVViewPropTypes on Android
|
||||
// as unlike on iOS we can't detect TV devices at build time
|
||||
// and hence make view manager export a different list of native properties.
|
||||
if (Platform.isTV || Platform.OS === 'android') {
|
||||
TVViewPropTypes = require('TVViewPropTypes');
|
||||
}
|
||||
|
||||
module.exports = TVViewPropTypes;
|
25
Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js
Normal file
25
Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js
Normal file
@ -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;
|
Loading…
x
Reference in New Issue
Block a user