Move ViewStyle, TextStyle, ImageStyle from StyleSheetTypes to StyleSheet
Reviewed By: yungsters Differential Revision: D7282491 fbshipit-source-id: d6b54d0a2e1fe1816b6a856b1b0b1245a655320a
This commit is contained in:
parent
f68e04136c
commit
a0388f4adc
|
@ -22,8 +22,11 @@ import type {
|
|||
____Styles_Internal,
|
||||
____DangerouslyImpreciseStyle_Internal,
|
||||
____DangerouslyImpreciseStyleProp_Internal,
|
||||
____ViewStyle_Internal,
|
||||
____ViewStyleProp_Internal,
|
||||
____TextStyle_Internal,
|
||||
____TextStyleProp_Internal,
|
||||
____ImageStyle_Internal,
|
||||
____ImageStyleProp_Internal,
|
||||
LayoutStyle,
|
||||
} from 'StyleSheetTypes';
|
||||
|
@ -87,9 +90,60 @@ export type TypeForStyleKey<
|
|||
+key: $Keys<____DangerouslyImpreciseStyle_Internal>,
|
||||
> = $ElementType<____DangerouslyImpreciseStyle_Internal, key>;
|
||||
|
||||
/**
|
||||
* This type is an object of the different possible style
|
||||
* properties that can be specified for View.
|
||||
*
|
||||
* Note that this isn't a safe way to type a style prop for a component as
|
||||
* results from StyleSheet.create return an internal identifier, not
|
||||
* an object of styles.
|
||||
*
|
||||
* If you want to type the style prop of a function,
|
||||
* consider using ViewStyleProp.
|
||||
*
|
||||
* A reasonable usage of this type is for helper functions that return an
|
||||
* object of styles to pass to a View that can't be precomputed with
|
||||
* StyleSheet.create.
|
||||
*/
|
||||
export type ViewStyle = ____ViewStyle_Internal;
|
||||
|
||||
/**
|
||||
* This type is an object of the different possible style
|
||||
* properties that can be specified for Text.
|
||||
*
|
||||
* Note that this isn't a safe way to type a style prop for a component as
|
||||
* results from StyleSheet.create return an internal identifier, not
|
||||
* an object of styles.
|
||||
*
|
||||
* If you want to type the style prop of a function,
|
||||
* consider using TextStyleProp.
|
||||
*
|
||||
* A reasonable usage of this type is for helper functions that return an
|
||||
* object of styles to pass to a Text that can't be precomputed with
|
||||
* StyleSheet.create.
|
||||
*/
|
||||
export type TextStyle = ____TextStyle_Internal;
|
||||
|
||||
/**
|
||||
* This type is an object of the different possible style
|
||||
* properties that can be specified for Image.
|
||||
*
|
||||
* Note that this isn't a safe way to type a style prop for a component as
|
||||
* results from StyleSheet.create return an internal identifier, not
|
||||
* an object of styles.
|
||||
*
|
||||
* If you want to type the style prop of a function,
|
||||
* consider using ImageStyleProp.
|
||||
*
|
||||
* A reasonable usage of this type is for helper functions that return an
|
||||
* object of styles to pass to an Image that can't be precomputed with
|
||||
* StyleSheet.create.
|
||||
*/
|
||||
export type ImageStyle = ____ImageStyle_Internal;
|
||||
|
||||
/**
|
||||
* WARNING: You probably shouldn't be using this type. This type is an object
|
||||
* with all possible style key's and their values. Note that this isn't
|
||||
* with all possible style keys and their values. Note that this isn't
|
||||
* a safe way to type a style prop for a component as results from
|
||||
* StyleSheet.create return an internal identifier, not an object of styles.
|
||||
*
|
||||
|
|
|
@ -126,7 +126,7 @@ export type ShadowStyle = $ReadOnly<{|
|
|||
shadowRadius?: number,
|
||||
|}>;
|
||||
|
||||
export type ViewStyle = $ReadOnly<{|
|
||||
export type ____ViewStyle_Internal = $ReadOnly<{|
|
||||
...$Exact<LayoutStyle>,
|
||||
...$Exact<ShadowStyle>,
|
||||
...$Exact<TransformStyle>,
|
||||
|
@ -160,8 +160,8 @@ export type ViewStyle = $ReadOnly<{|
|
|||
elevation?: number,
|
||||
|}>;
|
||||
|
||||
export type TextStyle = $ReadOnly<{|
|
||||
...$Exact<ViewStyle>,
|
||||
export type ____TextStyle_Internal = $ReadOnly<{|
|
||||
...$Exact<____ViewStyle_Internal>,
|
||||
color?: ColorValue,
|
||||
fontFamily?: string,
|
||||
fontSize?: number,
|
||||
|
@ -206,15 +206,15 @@ export type TextStyle = $ReadOnly<{|
|
|||
writingDirection?: 'auto' | 'ltr' | 'rtl',
|
||||
|}>;
|
||||
|
||||
export type ImageStyle = $ReadOnly<{|
|
||||
...$Exact<ViewStyle>,
|
||||
export type ____ImageStyle_Internal = $ReadOnly<{|
|
||||
...$Exact<____ViewStyle_Internal>,
|
||||
resizeMode?: 'contain' | 'cover' | 'stretch' | 'center' | 'repeat',
|
||||
tintColor?: ColorValue,
|
||||
overlayColor?: string,
|
||||
|}>;
|
||||
|
||||
export type ____DangerouslyImpreciseStyle_Internal = {
|
||||
...$Exact<TextStyle>,
|
||||
...$Exact<____TextStyle_Internal>,
|
||||
+resizeMode?: 'contain' | 'cover' | 'stretch' | 'center' | 'repeat',
|
||||
+tintColor?: ColorValue,
|
||||
+overlayColor?: string,
|
||||
|
@ -234,13 +234,13 @@ export type ____DangerouslyImpreciseStyleProp_Internal = GenericStyleProp<
|
|||
$Shape<____DangerouslyImpreciseStyle_Internal>,
|
||||
>;
|
||||
export type ____ViewStyleProp_Internal = GenericStyleProp<
|
||||
$ReadOnly<$Shape<ViewStyle>>,
|
||||
$ReadOnly<$Shape<____ViewStyle_Internal>>,
|
||||
>;
|
||||
export type ____TextStyleProp_Internal = GenericStyleProp<
|
||||
$ReadOnly<$Shape<TextStyle>>,
|
||||
$ReadOnly<$Shape<____TextStyle_Internal>>,
|
||||
>;
|
||||
export type ____ImageStyleProp_Internal = GenericStyleProp<
|
||||
$ReadOnly<$Shape<ImageStyle>>,
|
||||
$ReadOnly<$Shape<____ImageStyle_Internal>>,
|
||||
>;
|
||||
|
||||
export type ____Styles_Internal = {
|
||||
|
|
Loading…
Reference in New Issue