Update StyleSheet and Platform exports (#50169)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50169

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D71548325

fbshipit-source-id: b0c6cc0dc3b15757f0630d7ef8398161a46c51a8
This commit is contained in:
Jakub Piasecki
2025-03-25 10:28:13 -07:00
committed by Facebook GitHub Bot
parent 3bb86b0ecf
commit e27c97bc56
6 changed files with 85 additions and 26 deletions
+19 -2
View File
@@ -15,6 +15,7 @@ import type {
____ColorValue_Internal,
____DangerouslyImpreciseStyle_Internal,
____DangerouslyImpreciseStyleProp_Internal,
____FontVariant_Internal,
____ImageStyle_Internal,
____ImageStyleProp_Internal,
____TextStyle_Internal,
@@ -22,12 +23,17 @@ import type {
____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
@@ -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
@@ -14,6 +14,7 @@ import type {
____ColorValue_Internal,
____DangerouslyImpreciseStyle_Internal,
____DangerouslyImpreciseStyleProp_Internal,
____FontVariant_Internal,
____ImageStyle_Internal,
____ImageStyleProp_Internal,
____TextStyle_Internal,
@@ -21,9 +22,14 @@ import type {
____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,
@@ -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
@@ -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'
@@ -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,
@@ -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}
+9 -3
View File
@@ -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',
@@ -7402,9 +7402,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;
@@ -7423,14 +7429,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;
@@ -7773,7 +7785,7 @@ export type ____FontWeight_Internal =
| \\"condensed\\"
| \\"heavy\\"
| \\"black\\";
export type ____FontVariantArray_Internal = $ReadOnlyArray<
export type ____FontVariant_Internal =
| \\"small-caps\\"
| \\"oldstyle-nums\\"
| \\"lining-nums\\"
@@ -7806,8 +7818,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,
@@ -7950,11 +7963,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 }
@@ -8708,10 +8721,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,