Move and Rename propType definitions in ShadowPropTypesIOS (#21379)

Summary:
related #21342

move TransformPropTypes.js
fix flow error

- [x] yarn prettier
- [x] yarn flow-check-android
- [x] yarn flow-check-ios

All flow checks pass.

[GENERAL] [ENHANCEMENT] [DeprecatedShadowPropTypesIOS.js] - Created.
Pull Request resolved: https://github.com/facebook/react-native/pull/21379

Differential Revision: D10098750

Pulled By: TheSavior

fbshipit-source-id: f7f2e4bf7b837c00a14b1fbd930d1b29ffb63549
This commit is contained in:
Guilherme Varandas
2018-09-27 19:31:28 -07:00
committed by Facebook Github Bot
parent c18458b394
commit f94d2ade86
5 changed files with 54 additions and 54 deletions

View File

@@ -1,50 +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.
*
* @flow
* @format
*/
'use strict';
const DeprecatedColorPropType = require('DeprecatedColorPropType');
const ReactPropTypes = require('prop-types');
/**
* These props can be used to dynamically generate shadows on views, images, text, etc.
*
* Because they are dynamically generated, they may cause performance regressions. Static
* shadow image asset may be a better way to go for optimal performance.
*
* These properties are iOS only - for similar functionality on Android, use the [`elevation`
* property](docs/viewstyleproptypes.html#elevation).
*/
const ShadowPropTypesIOS = {
/**
* Sets the drop shadow color
* @platform ios
*/
shadowColor: DeprecatedColorPropType,
/**
* Sets the drop shadow offset
* @platform ios
*/
shadowOffset: ReactPropTypes.shape({
width: ReactPropTypes.number,
height: ReactPropTypes.number,
}),
/**
* Sets the drop shadow opacity (multiplied by the color's alpha component)
* @platform ios
*/
shadowOpacity: ReactPropTypes.number,
/**
* Sets the drop shadow blur radius
* @platform ios
*/
shadowRadius: ReactPropTypes.number,
};
module.exports = ShadowPropTypesIOS;

View File

@@ -13,7 +13,7 @@
const DeprecatedColorPropType = require('DeprecatedColorPropType');
const LayoutPropTypes = require('LayoutPropTypes');
const ReactPropTypes = require('prop-types');
const ShadowPropTypesIOS = require('ShadowPropTypesIOS');
const DeprecatedShadowPropTypesIOS = require('DeprecatedShadowPropTypesIOS');
const DeprecatedTransformPropTypes = require('DeprecatedTransformPropTypes');
/**
@@ -21,7 +21,7 @@ const DeprecatedTransformPropTypes = require('DeprecatedTransformPropTypes');
*/
const ViewStylePropTypes = {
...LayoutPropTypes,
...ShadowPropTypesIOS,
...DeprecatedShadowPropTypesIOS,
...DeprecatedTransformPropTypes,
backfaceVisibility: ReactPropTypes.oneOf(['visible', 'hidden']),
backgroundColor: DeprecatedColorPropType,

View 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.
*
* @flow
* @format
*/
'use strict';
const DeprecatedColorPropType = require('DeprecatedColorPropType');
const ReactPropTypes = require('prop-types');
const DeprecatedShadowPropTypesIOS = {
shadowColor: DeprecatedColorPropType,
shadowOffset: ReactPropTypes.shape({
width: ReactPropTypes.number,
height: ReactPropTypes.number,
}),
shadowOpacity: ReactPropTypes.number,
shadowRadius: ReactPropTypes.number,
};
module.exports = DeprecatedShadowPropTypesIOS;

View File

@@ -13,12 +13,12 @@ const DeprecatedColorPropType = require('DeprecatedColorPropType');
const ImageResizeMode = require('ImageResizeMode');
const LayoutPropTypes = require('LayoutPropTypes');
const ReactPropTypes = require('prop-types');
const ShadowPropTypesIOS = require('ShadowPropTypesIOS');
const DeprecatedShadowPropTypesIOS = require('DeprecatedShadowPropTypesIOS');
const DeprecatedTransformPropTypes = require('DeprecatedTransformPropTypes');
const ImageStylePropTypes = {
...LayoutPropTypes,
...ShadowPropTypesIOS,
...DeprecatedShadowPropTypesIOS,
...DeprecatedTransformPropTypes,
resizeMode: ReactPropTypes.oneOf(Object.keys(ImageResizeMode)),
backfaceVisibility: ReactPropTypes.oneOf(['visible', 'hidden']),

View File

@@ -131,13 +131,38 @@ export type ____TransformStyle_Internal = $ReadOnly<{|
>,
|}>;
/**
* These props can be used to dynamically generate shadows on views, images, text, etc.
*
* Because they are dynamically generated, they may cause performance regressions. Static
* shadow image asset may be a better way to go for optimal performance.
*
* These properties are iOS only - for similar functionality on Android, use the [`elevation`
* property](docs/viewstyleproptypes.html#elevation).
*/
export type ____ShadowStyle_Internal = $ReadOnly<{|
/**
* Sets the drop shadow color
* @platform ios
*/
shadowColor?: ColorValue,
/**
* Sets the drop shadow offset
* @platform ios
*/
shadowOffset?: $ReadOnly<{|
width?: number,
height?: number,
|}>,
/**
* Sets the drop shadow opacity (multiplied by the color's alpha component)
* @platform ios
*/
shadowOpacity?: number | AnimatedNode,
/**
* Sets the drop shadow blur radius
* @platform ios
*/
shadowRadius?: number,
|}>;