Remove Unused Exports from StyleSheetTypes

Summary: These types were barely used and unnecessary.

Reviewed By: yungsters

Differential Revision: D7177287

fbshipit-source-id: 63cb6d3aae4889a92b2c23f0df864b5657e6e1ee
This commit is contained in:
Eli White 2018-03-06 23:21:59 -08:00 committed by Facebook Github Bot
parent 135637ce24
commit b58e377961
3 changed files with 13 additions and 22 deletions

View File

@ -20,14 +20,13 @@ import type {
StyleSheetStyle as _StyleSheetStyle, StyleSheetStyle as _StyleSheetStyle,
Styles as _Styles, Styles as _Styles,
StyleSheet as _StyleSheet, StyleSheet as _StyleSheet,
StyleValue as _StyleValue,
StyleObj, StyleObj,
LayoutStyle
} from 'StyleSheetTypes'; } from 'StyleSheetTypes';
export type StyleProp = StyleObj; export type StyleProp = StyleObj;
export type Styles = _Styles; export type Styles = _Styles;
export type StyleSheet<S> = _StyleSheet<S>; export type StyleSheet<S> = _StyleSheet<S>;
export type StyleValue = _StyleValue;
export type StyleSheetStyle = _StyleSheetStyle; export type StyleSheetStyle = _StyleSheetStyle;
let hairlineWidth = PixelRatio.roundToNearestPixel(0.4); let hairlineWidth = PixelRatio.roundToNearestPixel(0.4);
@ -35,14 +34,14 @@ if (hairlineWidth === 0) {
hairlineWidth = 1 / PixelRatio.get(); hairlineWidth = 1 / PixelRatio.get();
} }
const absoluteFillObject = { const absoluteFillObject: LayoutStyle = {
position: ('absolute': 'absolute'), position: 'absolute',
left: 0, left: 0,
right: 0, right: 0,
top: 0, top: 0,
bottom: 0, bottom: 0,
}; };
const absoluteFill: typeof absoluteFillObject = const absoluteFill: StyleSheetStyle =
ReactNativePropRegistry.register(absoluteFillObject); // This also freezes it ReactNativePropRegistry.register(absoluteFillObject); // This also freezes it
/** /**

View File

@ -220,7 +220,7 @@ export type Style = {
+overlayColor?: string, +overlayColor?: string,
}; };
export type StyleProp<+T> = type GenericStyleProp<+T> =
| null | null
| void | void
| T | T
@ -228,26 +228,18 @@ export type StyleProp<+T> =
| number | number
| false | false
| '' | ''
| $ReadOnlyArray<StyleProp<T>>; | $ReadOnlyArray<GenericStyleProp<T>>;
// export type ViewStyleProp = StyleProp<$Shape<ViewStyle<DimensionValue>>>; export type StyleObj = GenericStyleProp<$Shape<Style>>;
// export type TextStyleProp = StyleProp<
// $Shape<TextStyle<DimensionValue, ColorValue>>,
// >;
// export type ImageStyleProp = StyleProp<
// $Shape<ImageStyle<DimensionValue, ColorValue>>,
// >;
export type StyleObj = StyleProp<$Shape<Style>>; export type ViewStyleProp = GenericStyleProp<$ReadOnly<$Shape<ViewStyle>>>;
export type StyleValue = StyleObj; export type TextStyleProp = GenericStyleProp<$ReadOnly<$Shape<TextStyle>>>;
export type ImageStyleProp = GenericStyleProp<$ReadOnly<$Shape<ImageStyle>>>;
export type ViewStyleProp = StyleProp<$ReadOnly<$Shape<ViewStyle>>>;
export type TextStyleProp = StyleProp<$ReadOnly<$Shape<TextStyle>>>;
export type ImageStyleProp = StyleProp<$ReadOnly<$Shape<ImageStyle>>>;
export type Styles = { export type Styles = {
+[key: string]: $Shape<Style>, +[key: string]: $Shape<Style>,
}; };
export type StyleSheet<+S: Styles> = $ObjMap<S, (Object) => StyleSheetStyle>; export type StyleSheet<+S: Styles> = $ObjMap<S, (Object) => StyleSheetStyle>;
/* /*

View File

@ -11,7 +11,7 @@
var ReactNativePropRegistry; var ReactNativePropRegistry;
import type { StyleProp, Style } from 'StyleSheetTypes'; import type { StyleObj, Style } from 'StyleSheetTypes';
function getStyle(style) { function getStyle(style) {
if (ReactNativePropRegistry === undefined) { if (ReactNativePropRegistry === undefined) {
@ -23,7 +23,7 @@ function getStyle(style) {
return style; return style;
} }
function flattenStyle(style: ?StyleProp<Style>): ?Style { function flattenStyle(style: ?StyleObj): ?Style {
if (style == null) { if (style == null) {
return undefined; return undefined;
} }