Skip to content

Commit b58e377

Browse files
elicwhitefacebook-github-bot
authored andcommitted
Remove Unused Exports from StyleSheetTypes
Summary: These types were barely used and unnecessary. Reviewed By: yungsters Differential Revision: D7177287 fbshipit-source-id: 63cb6d3aae4889a92b2c23f0df864b5657e6e1ee
1 parent 135637c commit b58e377

File tree

3 files changed

+13
-22
lines changed

3 files changed

+13
-22
lines changed

Libraries/StyleSheet/StyleSheet.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,28 @@ import type {
2020
StyleSheetStyle as _StyleSheetStyle,
2121
Styles as _Styles,
2222
StyleSheet as _StyleSheet,
23-
StyleValue as _StyleValue,
2423
StyleObj,
24+
LayoutStyle
2525
} from 'StyleSheetTypes';
2626

2727
export type StyleProp = StyleObj;
2828
export type Styles = _Styles;
2929
export type StyleSheet<S> = _StyleSheet<S>;
30-
export type StyleValue = _StyleValue;
3130
export type StyleSheetStyle = _StyleSheetStyle;
3231

3332
let hairlineWidth = PixelRatio.roundToNearestPixel(0.4);
3433
if (hairlineWidth === 0) {
3534
hairlineWidth = 1 / PixelRatio.get();
3635
}
3736

38-
const absoluteFillObject = {
39-
position: ('absolute': 'absolute'),
37+
const absoluteFillObject: LayoutStyle = {
38+
position: 'absolute',
4039
left: 0,
4140
right: 0,
4241
top: 0,
4342
bottom: 0,
4443
};
45-
const absoluteFill: typeof absoluteFillObject =
44+
const absoluteFill: StyleSheetStyle =
4645
ReactNativePropRegistry.register(absoluteFillObject); // This also freezes it
4746

4847
/**

Libraries/StyleSheet/StyleSheetTypes.js

+7-15
Original file line numberDiff line numberDiff line change
@@ -220,34 +220,26 @@ export type Style = {
220220
+overlayColor?: string,
221221
};
222222

223-
export type StyleProp<+T> =
223+
type GenericStyleProp<+T> =
224224
| null
225225
| void
226226
| T
227227
| StyleSheetStyle
228228
| number
229229
| false
230230
| ''
231-
| $ReadOnlyArray<StyleProp<T>>;
231+
| $ReadOnlyArray<GenericStyleProp<T>>;
232232

233-
// export type ViewStyleProp = StyleProp<$Shape<ViewStyle<DimensionValue>>>;
234-
// export type TextStyleProp = StyleProp<
235-
// $Shape<TextStyle<DimensionValue, ColorValue>>,
236-
// >;
237-
// export type ImageStyleProp = StyleProp<
238-
// $Shape<ImageStyle<DimensionValue, ColorValue>>,
239-
// >;
233+
export type StyleObj = GenericStyleProp<$Shape<Style>>;
240234

241-
export type StyleObj = StyleProp<$Shape<Style>>;
242-
export type StyleValue = StyleObj;
243-
244-
export type ViewStyleProp = StyleProp<$ReadOnly<$Shape<ViewStyle>>>;
245-
export type TextStyleProp = StyleProp<$ReadOnly<$Shape<TextStyle>>>;
246-
export type ImageStyleProp = StyleProp<$ReadOnly<$Shape<ImageStyle>>>;
235+
export type ViewStyleProp = GenericStyleProp<$ReadOnly<$Shape<ViewStyle>>>;
236+
export type TextStyleProp = GenericStyleProp<$ReadOnly<$Shape<TextStyle>>>;
237+
export type ImageStyleProp = GenericStyleProp<$ReadOnly<$Shape<ImageStyle>>>;
247238

248239
export type Styles = {
249240
+[key: string]: $Shape<Style>,
250241
};
242+
251243
export type StyleSheet<+S: Styles> = $ObjMap<S, (Object) => StyleSheetStyle>;
252244

253245
/*

Libraries/StyleSheet/flattenStyle.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
var ReactNativePropRegistry;
1313

14-
import type { StyleProp, Style } from 'StyleSheetTypes';
14+
import type { StyleObj, Style } from 'StyleSheetTypes';
1515

1616
function getStyle(style) {
1717
if (ReactNativePropRegistry === undefined) {
@@ -23,7 +23,7 @@ function getStyle(style) {
2323
return style;
2424
}
2525

26-
function flattenStyle(style: ?StyleProp<Style>): ?Style {
26+
function flattenStyle(style: ?StyleObj): ?Style {
2727
if (style == null) {
2828
return undefined;
2929
}

0 commit comments

Comments
 (0)