From ee26d9bcb0719246efa51af404aa7805404675cc Mon Sep 17 00:00:00 2001 From: Eli White Date: Wed, 7 Mar 2018 12:03:26 -0800 Subject: [PATCH] Make StyleSheet.create type private Summary: This type is being used in many places where a much simpler type is often better. In a real pinch this type can still be accessed as so: ``` function returnsStyleSheet( ): $Call { return StyleSheet.create({ root: { background: 'white', } }) } returnsStyleSheet().foo // foo doesn't exist returnsStyleSheet().root // okay ``` Reviewed By: yungsters Differential Revision: D7178524 fbshipit-source-id: 3c0ed03486ca00f1e287261e402fd47807f1fc3d --- Libraries/StyleSheet/StyleSheet.js | 3 +-- Libraries/StyleSheet/StyleSheetTypes.js | 2 -- RNTester/js/RNTesterExampleList.js | 12 +++--------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/Libraries/StyleSheet/StyleSheet.js b/Libraries/StyleSheet/StyleSheet.js index bb4e57d2c..8e51e7384 100644 --- a/Libraries/StyleSheet/StyleSheet.js +++ b/Libraries/StyleSheet/StyleSheet.js @@ -19,15 +19,14 @@ const flatten = require('flattenStyle'); import type { StyleSheetStyle as _StyleSheetStyle, Styles as _Styles, - StyleSheet as _StyleSheet, StyleObj, LayoutStyle } from 'StyleSheetTypes'; export type StyleProp = StyleObj; export type Styles = _Styles; -export type StyleSheet = _StyleSheet; export type StyleSheetStyle = _StyleSheetStyle; +type StyleSheet<+S: Styles> = $ObjMap StyleSheetStyle>; let hairlineWidth = PixelRatio.roundToNearestPixel(0.4); if (hairlineWidth === 0) { diff --git a/Libraries/StyleSheet/StyleSheetTypes.js b/Libraries/StyleSheet/StyleSheetTypes.js index f23fc1f29..c51787c61 100644 --- a/Libraries/StyleSheet/StyleSheetTypes.js +++ b/Libraries/StyleSheet/StyleSheetTypes.js @@ -240,8 +240,6 @@ export type Styles = { +[key: string]: $Shape