Skip to content

Commit ee26d9b

Browse files
elicwhitefacebook-github-bot
authored andcommitted
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<typeof StyleSheet.create, *> { 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
1 parent cade297 commit ee26d9b

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

Libraries/StyleSheet/StyleSheet.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@ const flatten = require('flattenStyle');
1919
import type {
2020
StyleSheetStyle as _StyleSheetStyle,
2121
Styles as _Styles,
22-
StyleSheet as _StyleSheet,
2322
StyleObj,
2423
LayoutStyle
2524
} from 'StyleSheetTypes';
2625

2726
export type StyleProp = StyleObj;
2827
export type Styles = _Styles;
29-
export type StyleSheet<S> = _StyleSheet<S>;
3028
export type StyleSheetStyle = _StyleSheetStyle;
29+
type StyleSheet<+S: Styles> = $ObjMap<S, (Object) => StyleSheetStyle>;
3130

3231
let hairlineWidth = PixelRatio.roundToNearestPixel(0.4);
3332
if (hairlineWidth === 0) {

Libraries/StyleSheet/StyleSheetTypes.js

-2
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,6 @@ export type Styles = {
240240
+[key: string]: $Shape<Style>,
241241
};
242242

243-
export type StyleSheet<+S: Styles> = $ObjMap<S, (Object) => StyleSheetStyle>;
244-
245243
/*
246244
Utility type get non-nullable types for specific style keys.
247245
Useful when a component requires values for certain Style Keys.

RNTester/js/RNTesterExampleList.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,9 @@ const RNTesterActions = require('./RNTesterActions');
2020
const RNTesterStatePersister = require('./RNTesterStatePersister');
2121
const View = require('View');
2222

23-
import type {
24-
RNTesterExample,
25-
} from './RNTesterList.ios';
26-
import type {
27-
PassProps,
28-
} from './RNTesterStatePersister';
29-
import type {
30-
StyleObj,
31-
} from 'StyleSheetTypes';
23+
import type {RNTesterExample} from './RNTesterList.ios';
24+
import type {PassProps} from './RNTesterStatePersister';
25+
import type {StyleObj} from 'StyleSheetTypes';
3226

3327
type Props = {
3428
onNavigate: Function,

0 commit comments

Comments
 (0)