Skip to content
Permalink
Browse files

Remove Unused Exports from StyleSheetTypes

Summary: These types were barely used and unnecessary.

Reviewed By: yungsters

Differential Revision: D7177287

fbshipit-source-id: 63cb6d3aae4889a92b2c23f0df864b5657e6e1ee
  • Loading branch information...
TheSavior authored and facebook-github-bot committed Mar 7, 2018
1 parent 135637c commit b58e377961ddd278bfa36df0e15953f976875de6
@@ -20,29 +20,28 @@ import type {
StyleSheetStyle as _StyleSheetStyle,
Styles as _Styles,
StyleSheet as _StyleSheet,
StyleValue as _StyleValue,
StyleObj,
LayoutStyle
} from 'StyleSheetTypes';

export type StyleProp = StyleObj;
export type Styles = _Styles;
export type StyleSheet<S> = _StyleSheet<S>;
export type StyleValue = _StyleValue;
export type StyleSheetStyle = _StyleSheetStyle;

let hairlineWidth = PixelRatio.roundToNearestPixel(0.4);
if (hairlineWidth === 0) {
hairlineWidth = 1 / PixelRatio.get();
}

const absoluteFillObject = {
position: ('absolute': 'absolute'),
const absoluteFillObject: LayoutStyle = {
position: 'absolute',
left: 0,
right: 0,
top: 0,
bottom: 0,
};
const absoluteFill: typeof absoluteFillObject =
const absoluteFill: StyleSheetStyle =
ReactNativePropRegistry.register(absoluteFillObject); // This also freezes it

/**
@@ -220,34 +220,26 @@ export type Style = {
+overlayColor?: string,
};

export type StyleProp<+T> =
type GenericStyleProp<+T> =
| null
| void
| T
| StyleSheetStyle
| number
| false
| ''
| $ReadOnlyArray<StyleProp<T>>;
| $ReadOnlyArray<GenericStyleProp<T>>;

// export type ViewStyleProp = StyleProp<$Shape<ViewStyle<DimensionValue>>>;
// export type TextStyleProp = StyleProp<
// $Shape<TextStyle<DimensionValue, ColorValue>>,
// >;
// export type ImageStyleProp = StyleProp<
// $Shape<ImageStyle<DimensionValue, ColorValue>>,
// >;
export type StyleObj = GenericStyleProp<$Shape<Style>>;

export type StyleObj = StyleProp<$Shape<Style>>;
export type StyleValue = StyleObj;

export type ViewStyleProp = StyleProp<$ReadOnly<$Shape<ViewStyle>>>;
export type TextStyleProp = StyleProp<$ReadOnly<$Shape<TextStyle>>>;
export type ImageStyleProp = StyleProp<$ReadOnly<$Shape<ImageStyle>>>;
export type ViewStyleProp = GenericStyleProp<$ReadOnly<$Shape<ViewStyle>>>;
export type TextStyleProp = GenericStyleProp<$ReadOnly<$Shape<TextStyle>>>;
export type ImageStyleProp = GenericStyleProp<$ReadOnly<$Shape<ImageStyle>>>;

export type Styles = {
+[key: string]: $Shape<Style>,
};

export type StyleSheet<+S: Styles> = $ObjMap<S, (Object) => StyleSheetStyle>;

/*
@@ -11,7 +11,7 @@

var ReactNativePropRegistry;

import type { StyleProp, Style } from 'StyleSheetTypes';
import type { StyleObj, Style } from 'StyleSheetTypes';

function getStyle(style) {
if (ReactNativePropRegistry === undefined) {
@@ -23,7 +23,7 @@ function getStyle(style) {
return style;
}

function flattenStyle(style: ?StyleProp<Style>): ?Style {
function flattenStyle(style: ?StyleObj): ?Style {
if (style == null) {
return undefined;
}

0 comments on commit b58e377

Please sign in to comment.
You can’t perform that action at this time.