mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-10 22:47:58 +08:00
Remove usage of Internal StyleSheet type
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
This commit is contained in:
committed by
Facebook Github Bot
parent
5f497ca302
commit
d89517d60a
@@ -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,
|
||||
@@ -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) {
|
||||
@@ -47,7 +45,7 @@ const absoluteFillObject: LayoutStyle = {
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
};
|
||||
const absoluteFill: StyleSheetStyle =
|
||||
const absoluteFill: StyleSheetInternalStyleIdentifier =
|
||||
ReactNativePropRegistry.register(absoluteFillObject); // This also freezes it
|
||||
|
||||
/**
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
@@ -224,7 +224,7 @@ type GenericStyleProp<+T> =
|
||||
| null
|
||||
| void
|
||||
| T
|
||||
| StyleSheetStyle
|
||||
| ____StyleSheetInternalStyleIdentifier_Internal
|
||||
| number
|
||||
| false
|
||||
| ''
|
||||
|
||||
Reference in New Issue
Block a user