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
This commit is contained in:
Eli White 2018-03-07 12:03:26 -08:00 committed by Facebook Github Bot
parent cade297971
commit ee26d9bcb0
3 changed files with 4 additions and 13 deletions

View File

@ -19,15 +19,14 @@ const flatten = require('flattenStyle');
import type {
StyleSheetStyle as _StyleSheetStyle,
Styles as _Styles,
StyleSheet as _StyleSheet,
StyleObj,
LayoutStyle
} from 'StyleSheetTypes';
export type StyleProp = StyleObj;
export type Styles = _Styles;
export type StyleSheet<S> = _StyleSheet<S>;
export type StyleSheetStyle = _StyleSheetStyle;
type StyleSheet<+S: Styles> = $ObjMap<S, (Object) => StyleSheetStyle>;
let hairlineWidth = PixelRatio.roundToNearestPixel(0.4);
if (hairlineWidth === 0) {

View File

@ -240,8 +240,6 @@ export type Styles = {
+[key: string]: $Shape<Style>,
};
export type StyleSheet<+S: Styles> = $ObjMap<S, (Object) => StyleSheetStyle>;
/*
Utility type get non-nullable types for specific style keys.
Useful when a component requires values for certain Style Keys.

View File

@ -20,15 +20,9 @@ const RNTesterActions = require('./RNTesterActions');
const RNTesterStatePersister = require('./RNTesterStatePersister');
const View = require('View');
import type {
RNTesterExample,
} from './RNTesterList.ios';
import type {
PassProps,
} from './RNTesterStatePersister';
import type {
StyleObj,
} from 'StyleSheetTypes';
import type {RNTesterExample} from './RNTesterList.ios';
import type {PassProps} from './RNTesterStatePersister';
import type {StyleObj} from 'StyleSheetTypes';
type Props = {
onNavigate: Function,