From 2f32fea79a50bdae303126f6d5288ea447f5331b Mon Sep 17 00:00:00 2001 From: Eli White Date: Tue, 8 Jan 2019 18:46:40 -0800 Subject: [PATCH] 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 --- Libraries/StyleSheet/StyleSheet.js | 14 +------------- Libraries/StyleSheet/StyleSheetTypes.js | 4 ++-- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/Libraries/StyleSheet/StyleSheet.js b/Libraries/StyleSheet/StyleSheet.js index 6391c0953..7d8fe1a46 100644 --- a/Libraries/StyleSheet/StyleSheet.js +++ b/Libraries/StyleSheet/StyleSheet.js @@ -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, diff --git a/Libraries/StyleSheet/StyleSheetTypes.js b/Libraries/StyleSheet/StyleSheetTypes.js index 5fd2c1a4d..76199ec1a 100644 --- a/Libraries/StyleSheet/StyleSheetTypes.js +++ b/Libraries/StyleSheet/StyleSheetTypes.js @@ -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