Skip to content

Commit

Permalink
Remove Unused Exports from StyleSheetTypes
Browse files Browse the repository at this point in the history
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 b58e377
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 22 deletions.
9 changes: 4 additions & 5 deletions Libraries/StyleSheet/StyleSheet.js
Expand Up @@ -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

/**
Expand Down
22 changes: 7 additions & 15 deletions Libraries/StyleSheet/StyleSheetTypes.js
Expand Up @@ -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>;

/*
Expand Down
4 changes: 2 additions & 2 deletions Libraries/StyleSheet/flattenStyle.js
Expand Up @@ -11,7 +11,7 @@

var ReactNativePropRegistry;

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

function getStyle(style) {
if (ReactNativePropRegistry === undefined) {
Expand All @@ -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;
}
Expand Down

0 comments on commit b58e377

Please sign in to comment.