Skip to content

Commit

Permalink
Move and Rename propType definitions in ShadowPropTypesIOS (#21379)
Browse files Browse the repository at this point in the history
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: #21379

Differential Revision: D10098750

Pulled By: TheSavior

fbshipit-source-id: f7f2e4bf7b837c00a14b1fbd930d1b29ffb63549
  • Loading branch information
gvarandas authored and facebook-github-bot committed Sep 28, 2018
1 parent c18458b commit f94d2ad
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 54 deletions.
50 changes: 0 additions & 50 deletions Libraries/Components/View/ShadowPropTypesIOS.js

This file was deleted.

4 changes: 2 additions & 2 deletions Libraries/Components/View/ViewStylePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
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');

/**
* Warning: Some of these properties may not be supported in all releases.
*/
const ViewStylePropTypes = {
...LayoutPropTypes,
...ShadowPropTypesIOS,
...DeprecatedShadowPropTypesIOS,
...DeprecatedTransformPropTypes,
backfaceVisibility: ReactPropTypes.oneOf(['visible', 'hidden']),
backgroundColor: DeprecatedColorPropType,
Expand Down
25 changes: 25 additions & 0 deletions Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.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.
*
* @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;
4 changes: 2 additions & 2 deletions Libraries/Image/ImageStylePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']),
Expand Down
25 changes: 25 additions & 0 deletions Libraries/StyleSheet/StyleSheetTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
|}>;

Expand Down

0 comments on commit f94d2ad

Please sign in to comment.