Rename Style to DangerouslyImpreciseStyle
Reviewed By: yungsters Differential Revision: D7190268 fbshipit-source-id: d652a95be7550d65cfbfc59f41d7bda92915bacf
This commit is contained in:
parent
5b32358c9e
commit
4895c645ea
|
@ -20,14 +20,14 @@ const flatten = require('flattenStyle');
|
|||
import type {
|
||||
____StyleSheetInternalStyleIdentifier_Internal as StyleSheetInternalStyleIdentifier,
|
||||
____Styles_Internal,
|
||||
____StyleObj_Internal,
|
||||
____DangerouslyImpreciseStyleProp_Internal,
|
||||
____ViewStyleProp_Internal,
|
||||
____TextStyleProp_Internal,
|
||||
____ImageStyleProp_Internal,
|
||||
LayoutStyle,
|
||||
} from 'StyleSheetTypes';
|
||||
|
||||
export type DangerouslyImpreciseStyleProp = ____StyleObj_Internal;
|
||||
export type DangerouslyImpreciseStyleProp = ____DangerouslyImpreciseStyleProp_Internal;
|
||||
export type ViewStyleProp = ____ViewStyleProp_Internal;
|
||||
export type TextStyleProp = ____TextStyleProp_Internal;
|
||||
export type ImageStyleProp = ____ImageStyleProp_Internal;
|
||||
|
|
|
@ -213,7 +213,7 @@ export type ImageStyle = $ReadOnly<{|
|
|||
overlayColor?: string,
|
||||
|}>;
|
||||
|
||||
export type Style = {
|
||||
export type DangerouslyImpreciseStyle = {
|
||||
...$Exact<TextStyle>,
|
||||
+resizeMode?: 'contain' | 'cover' | 'stretch' | 'center' | 'repeat',
|
||||
+tintColor?: ColorValue,
|
||||
|
@ -230,7 +230,9 @@ type GenericStyleProp<+T> =
|
|||
| ''
|
||||
| $ReadOnlyArray<GenericStyleProp<T>>;
|
||||
|
||||
export type ____StyleObj_Internal = GenericStyleProp<$Shape<Style>>;
|
||||
export type ____DangerouslyImpreciseStyleProp_Internal = GenericStyleProp<
|
||||
$Shape<DangerouslyImpreciseStyle>,
|
||||
>;
|
||||
export type ____ViewStyleProp_Internal = GenericStyleProp<
|
||||
$ReadOnly<$Shape<ViewStyle>>,
|
||||
>;
|
||||
|
@ -242,7 +244,7 @@ export type ____ImageStyleProp_Internal = GenericStyleProp<
|
|||
>;
|
||||
|
||||
export type ____Styles_Internal = {
|
||||
+[key: string]: $Shape<Style>,
|
||||
+[key: string]: $Shape<DangerouslyImpreciseStyle>,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -260,4 +262,6 @@ type Props = {position: TypeForStyleKey<'position'>};
|
|||
This will correctly give you the type 'absolute' | 'relative' instead of the
|
||||
weak type of just string;
|
||||
*/
|
||||
export type TypeForStyleKey<+key: $Keys<Style>> = $ElementType<Style, key>;
|
||||
export type TypeForStyleKey<
|
||||
+key: $Keys<DangerouslyImpreciseStyle>,
|
||||
> = $ElementType<DangerouslyImpreciseStyle, key>;
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
*
|
||||
* @providesModule flattenStyle
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var ReactNativePropRegistry;
|
||||
|
||||
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
|
||||
import type { Style } from 'StyleSheetTypes';
|
||||
import type {DangerouslyImpreciseStyle} from 'StyleSheetTypes';
|
||||
|
||||
function getStyle(style) {
|
||||
if (ReactNativePropRegistry === undefined) {
|
||||
|
@ -24,7 +25,9 @@ function getStyle(style) {
|
|||
return style;
|
||||
}
|
||||
|
||||
function flattenStyle(style: ?DangerouslyImpreciseStyleProp): ?Style {
|
||||
function flattenStyle(
|
||||
style: ?DangerouslyImpreciseStyleProp,
|
||||
): ?DangerouslyImpreciseStyle {
|
||||
if (style == null) {
|
||||
return undefined;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue