Remove LayoutStyle, ShadowStyle, TransformStyle in favor of just ViewStyleProp

Summary: We are working to remove additional types and eventually define everything at the top level as a public exported type of react-native. I was able to update callsites by just using ViewStyleProp in places that were expecting a prop of just one of these. It is a little bit weaker, but much simpler. If a callsite wants to only take margin, it should just take a margin prop instead of a LayoutStyle prop.

Reviewed By: rickhanlonii

Differential Revision: D13599460

fbshipit-source-id: 12c01bc58baa7f6acf33e0b8aab05dabb79c646b
This commit is contained in:
Eli White 2019-01-08 18:46:40 -08:00 committed by Facebook Github Bot
parent 65194534f6
commit 2f32fea79a
2 changed files with 3 additions and 15 deletions

View File

@ -25,9 +25,6 @@ import type {
____TextStyleProp_Internal,
____ImageStyle_Internal,
____ImageStyleProp_Internal,
____LayoutStyle_Internal,
____ShadowStyle_Internal,
____TransformStyle_Internal,
} from 'StyleSheetTypes';
/**
@ -154,21 +151,12 @@ export type ImageStyle = ____ImageStyle_Internal;
*/
export type DangerouslyImpreciseStyle = ____DangerouslyImpreciseStyle_Internal;
/**
* These types are simlilar to the style types above. They are objects of the
* possible style keys in that group. For example, ShadowStyle contains
* keys like `shadowColor` and `shadowRadius`.
*/
export type LayoutStyle = ____LayoutStyle_Internal;
export type ShadowStyle = ____ShadowStyle_Internal;
export type TransformStyle = ____TransformStyle_Internal;
let hairlineWidth = PixelRatio.roundToNearestPixel(0.4);
if (hairlineWidth === 0) {
hairlineWidth = 1 / PixelRatio.get();
}
const absoluteFill: LayoutStyle = {
const absoluteFill = {
position: 'absolute',
left: 0,
right: 0,

View File

@ -28,7 +28,7 @@ export type DimensionValue = null | number | string | AnimatedNode;
* These properties are a subset of our styles that are consumed by the layout
* algorithm and affect the positioning and sizing of views.
*/
export type ____LayoutStyle_Internal = $ReadOnly<{|
type ____LayoutStyle_Internal = $ReadOnly<{|
/** `display` sets the display type of this component.
*
* It works similarly to `display` in CSS, but only support 'flex' and 'none'.
@ -460,7 +460,7 @@ export type ____LayoutStyle_Internal = $ReadOnly<{|
direction?: 'inherit' | 'ltr' | 'rtl',
|}>;
export type ____TransformStyle_Internal = $ReadOnly<{|
type ____TransformStyle_Internal = $ReadOnly<{|
/**
* `transform` accepts an array of transformation objects. Each object specifies
* the property that will be transformed as the key, and the value to use in the