Permalink
Browse files

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
  • Loading branch information...
TheSavior authored and facebook-github-bot committed Mar 7, 2018
1 parent cade297 commit ee26d9bcb0719246efa51af404aa7805404675cc
@@ -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) {
@@ -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.
@@ -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,

0 comments on commit ee26d9b

Please sign in to comment.