Skip to content

Commit

Permalink
Remove usage of Internal StyleSheet type
Browse files Browse the repository at this point in the history
Summary: This type shouldn't be necessary from outside code. All callsites were able to be fixed by using the other types like TextStyleProp

Reviewed By: yungsters

Differential Revision: D7187551

fbshipit-source-id: 34fb7fb5f5e72e6cfcb9748157cb5eb6ad3e1f46
  • Loading branch information
elicwhite authored and facebook-github-bot committed Mar 8, 2018
1 parent 5f497ca commit d89517d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions Libraries/StyleSheet/StyleSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const StyleSheetValidation = require('StyleSheetValidation');
const flatten = require('flattenStyle');

import type {
StyleSheetStyle as _StyleSheetStyle,
____StyleSheetInternalStyleIdentifier_Internal as StyleSheetInternalStyleIdentifier,
Styles as _Styles,
____StyleObj_Internal,
____ViewStyleProp_Internal,
Expand All @@ -32,8 +32,6 @@ export type TextStyleProp = ____TextStyleProp_Internal;
export type ImageStyleProp = ____ImageStyleProp_Internal;

export type Styles = _Styles;
export type StyleSheetStyle = _StyleSheetStyle;
type StyleSheet<+S: Styles> = $ObjMap<S, (Object) => StyleSheetStyle>;

let hairlineWidth = PixelRatio.roundToNearestPixel(0.4);
if (hairlineWidth === 0) {
Expand All @@ -47,7 +45,7 @@ const absoluteFillObject: LayoutStyle = {
top: 0,
bottom: 0,
};
const absoluteFill: StyleSheetStyle =
const absoluteFill: StyleSheetInternalStyleIdentifier =
ReactNativePropRegistry.register(absoluteFillObject); // This also freezes it

/**
Expand Down Expand Up @@ -223,7 +221,7 @@ module.exports = {
/**
* Creates a StyleSheet style reference from the given object.
*/
create<S: Styles>(obj: S): StyleSheet<S> {
create<+S: Styles>(obj: S): $ObjMap<S, (Object) => StyleSheetInternalStyleIdentifier> {
const result = {};
for (const key in obj) {
StyleSheetValidation.validateStyle(key, obj);
Expand Down
4 changes: 2 additions & 2 deletions Libraries/StyleSheet/StyleSheetTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import AnimatedNode from 'AnimatedNode';

export opaque type StyleSheetStyle: number = number;
export opaque type ____StyleSheetInternalStyleIdentifier_Internal: number = number;

export type ColorValue = null | string;
export type DimensionValue = null | number | string | AnimatedNode;
Expand Down Expand Up @@ -224,7 +224,7 @@ type GenericStyleProp<+T> =
| null
| void
| T
| StyleSheetStyle
| ____StyleSheetInternalStyleIdentifier_Internal
| number
| false
| ''
Expand Down

0 comments on commit d89517d

Please sign in to comment.