Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions packages/react-native/Libraries/StyleSheet/StyleSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,25 @@ import type {
____ColorValue_Internal,
____DangerouslyImpreciseStyle_Internal,
____DangerouslyImpreciseStyleProp_Internal,
____FontVariant_Internal,
____ImageStyle_Internal,
____ImageStyleProp_Internal,
____TextStyle_Internal,
____TextStyleProp_Internal,
____TransformStyle_Internal,
____ViewStyle_Internal,
____ViewStyleProp_Internal,
NativeColorValue,
} from './StyleSheetTypes';
const StyleSheet: StyleSheetExports = (
require('./StyleSheetExports') as $FlowFixMe
).default;

export type {NativeColorValue} from './StyleSheetTypes';
export type {
BoxShadowValue,
NativeColorValue,
FilterFunction,
} from './StyleSheetTypes';

/**
* This type should be used as the type for anything that is a color. It is
Expand All @@ -38,10 +44,21 @@ export type {NativeColorValue} from './StyleSheetTypes';
*/
export type ColorValue = ____ColorValue_Internal;

/**
* Expose the opaque type for NativeColorValue.
* @deprecated Use NativeColorValue instead.
*/
export type OpaqueColorValue = NativeColorValue;

/**
* This type is an object of the properties related to transforms.
*/
export type TransformStyle = ____TransformStyle_Internal;
export type TransformsStyle = ____TransformStyle_Internal;

/**
* This type holds possible values for the `fontVariant` style property.
*/
export type FontVariant = ____FontVariant_Internal;

/**
* This type should be used as the type for a prop that is passed through
Expand Down
20 changes: 18 additions & 2 deletions packages/react-native/Libraries/StyleSheet/StyleSheet.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,22 @@ import type {
____ColorValue_Internal,
____DangerouslyImpreciseStyle_Internal,
____DangerouslyImpreciseStyleProp_Internal,
____FontVariant_Internal,
____ImageStyle_Internal,
____ImageStyleProp_Internal,
____TextStyle_Internal,
____TextStyleProp_Internal,
____TransformStyle_Internal,
____ViewStyle_Internal,
____ViewStyleProp_Internal,
NativeColorValue,
} from './StyleSheetTypes';

export type {StyleProp} from './StyleSheetTypes';
export type {
StyleProp,
BoxShadowValue,
FilterFunction,
} from './StyleSheetTypes';

export type StyleSheetProperties = {
hairlineWidth: number,
Expand All @@ -41,10 +47,20 @@ export type {NativeColorValue} from './StyleSheetTypes';
*/
export type ColorValue = ____ColorValue_Internal;

/**
* Expose the opaque type for NativeColorValue.
*/
export type OpaqueColorValue = NativeColorValue;

/**
* This type is an object of the properties related to transforms.
*/
export type TransformStyle = ____TransformStyle_Internal;
export type TransformsStyle = ____TransformStyle_Internal;

/**
* This type holds possible values for the `fontVariant` style property.
*/
export type FontVariant = ____FontVariant_Internal;

/**
* This type should be used as the type for a prop that is passed through
Expand Down
8 changes: 5 additions & 3 deletions packages/react-native/Libraries/StyleSheet/StyleSheetTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ export type ____FontWeight_Internal =
| 'heavy'
| 'black';

export type ____FontVariantArray_Internal = $ReadOnlyArray<
export type ____FontVariant_Internal =
| 'small-caps'
| 'oldstyle-nums'
| 'lining-nums'
Expand Down Expand Up @@ -906,8 +906,10 @@ export type ____FontVariantArray_Internal = $ReadOnlyArray<
| 'stylistic-seventeen'
| 'stylistic-eighteen'
| 'stylistic-nineteen'
| 'stylistic-twenty',
>;
| 'stylistic-twenty';

export type ____FontVariantArray_Internal =
$ReadOnlyArray<____FontVariant_Internal>;

type ____TextStyle_InternalBase = $ReadOnly<{
color?: ____ColorValue_Internal,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ export type ____TransformStyle_Internal = $ReadOnly<{
| {+scale: number | AnimatedNode}
| {+scaleX: number | AnimatedNode}
| {+scaleY: number | AnimatedNode}
| {+translateX: number | AnimatedNode}
| {+translateY: number | AnimatedNode}
| {+translateX: number | string | AnimatedNode}
| {+translateY: number | string | AnimatedNode}
| {
+translate:
| [number | AnimatedNode, number | AnimatedNode]
| [number | string | AnimatedNode, number | string | AnimatedNode]
| AnimatedNode,
}
| {+skewX: string | AnimatedNode}
Expand Down
12 changes: 9 additions & 3 deletions packages/react-native/Libraries/Utilities/PlatformTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ export type PlatformOSType =
| 'web'
| 'native';

export type PlatformSelectSpec<T> = {
default?: T,
[PlatformOSType]: T,
type OptionalPlatformSelectSpec<T> = {
[_key in PlatformOSType]?: T,
};

export type PlatformSelectSpec<T> =
| {
...OptionalPlatformSelectSpec<T>,
default: T,
}
| OptionalPlatformSelectSpec<T>;

type IOSPlatform = {
__constants: null,
OS: 'ios',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7370,9 +7370,15 @@ declare export function normalizeRect(rectOrSize: ?RectOrSize): ?Rect;

exports[`public API should not change unintentionally Libraries/StyleSheet/StyleSheet.js 1`] = `
"declare const StyleSheet: StyleSheetExports;
export type { NativeColorValue } from \\"./StyleSheetTypes\\";
export type {
BoxShadowValue,
NativeColorValue,
FilterFunction,
} from \\"./StyleSheetTypes\\";
export type ColorValue = ____ColorValue_Internal;
export type TransformStyle = ____TransformStyle_Internal;
export type OpaqueColorValue = NativeColorValue;
export type TransformsStyle = ____TransformStyle_Internal;
export type FontVariant = ____FontVariant_Internal;
export type ViewStyleProp = ____ViewStyleProp_Internal;
export type TextStyleProp = ____TextStyleProp_Internal;
export type ImageStyleProp = ____ImageStyleProp_Internal;
Expand All @@ -7391,14 +7397,20 @@ declare export default typeof StyleSheet;

exports[`public API should not change unintentionally Libraries/StyleSheet/StyleSheet.js.flow 1`] = `
"export * as default from \\"./StyleSheetExports\\";
export type { StyleProp } from \\"./StyleSheetTypes\\";
export type {
StyleProp,
BoxShadowValue,
FilterFunction,
} from \\"./StyleSheetTypes\\";
export type StyleSheetProperties = {
hairlineWidth: number,
flatten<T: string>(style: T): T,
};
export type { NativeColorValue } from \\"./StyleSheetTypes\\";
export type ColorValue = ____ColorValue_Internal;
export type TransformStyle = ____TransformStyle_Internal;
export type OpaqueColorValue = NativeColorValue;
export type TransformsStyle = ____TransformStyle_Internal;
export type FontVariant = ____FontVariant_Internal;
export type ViewStyleProp = ____ViewStyleProp_Internal;
export type TextStyleProp = ____TextStyleProp_Internal;
export type ImageStyleProp = ____ImageStyleProp_Internal;
Expand Down Expand Up @@ -7741,7 +7753,7 @@ export type ____FontWeight_Internal =
| \\"condensed\\"
| \\"heavy\\"
| \\"black\\";
export type ____FontVariantArray_Internal = $ReadOnlyArray<
export type ____FontVariant_Internal =
| \\"small-caps\\"
| \\"oldstyle-nums\\"
| \\"lining-nums\\"
Expand Down Expand Up @@ -7774,8 +7786,9 @@ export type ____FontVariantArray_Internal = $ReadOnlyArray<
| \\"stylistic-seventeen\\"
| \\"stylistic-eighteen\\"
| \\"stylistic-nineteen\\"
| \\"stylistic-twenty\\",
>;
| \\"stylistic-twenty\\";
export type ____FontVariantArray_Internal =
$ReadOnlyArray<____FontVariant_Internal>;
type ____TextStyle_InternalBase = $ReadOnly<{
color?: ____ColorValue_Internal,
fontFamily?: string,
Expand Down Expand Up @@ -7918,11 +7931,11 @@ exports[`public API should not change unintentionally Libraries/StyleSheet/priva
| { +scale: number | AnimatedNode }
| { +scaleX: number | AnimatedNode }
| { +scaleY: number | AnimatedNode }
| { +translateX: number | AnimatedNode }
| { +translateY: number | AnimatedNode }
| { +translateX: number | string | AnimatedNode }
| { +translateY: number | string | AnimatedNode }
| {
+translate:
| [number | AnimatedNode, number | AnimatedNode]
| [number | string | AnimatedNode, number | string | AnimatedNode]
| AnimatedNode,
}
| { +skewX: string | AnimatedNode }
Expand Down Expand Up @@ -8676,10 +8689,15 @@ exports[`public API should not change unintentionally Libraries/Utilities/Platfo
| \\"windows\\"
| \\"web\\"
| \\"native\\";
export type PlatformSelectSpec<T> = {
default?: T,
[PlatformOSType]: T,
type OptionalPlatformSelectSpec<T> = {
[_key in PlatformOSType]?: T,
};
export type PlatformSelectSpec<T> =
| {
...OptionalPlatformSelectSpec<T>,
default: T,
}
| OptionalPlatformSelectSpec<T>;
type IOSPlatform = {
OS: \\"ios\\",
get Version(): string,
Expand Down
Loading