Skip to content
Open
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
97 changes: 96 additions & 1 deletion packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ export type BlendMode =
| 'color'
| 'luminosity';

export type GradientValue = {
export type LinearGradientValue = {
type: 'linear-gradient';
// Angle or direction enums
direction?: string | undefined;
Expand All @@ -377,6 +377,89 @@ export type GradientValue = {
}>;
};

export type GradientValue = LinearGradientValue;

type RadialExtent =
| 'closest-corner'
| 'closest-side'
| 'farthest-corner'
| 'farthest-side';
export type RadialGradientPosition =
| {
top: number | string;
left: number | string;
}
| {
top: number | string;
right: number | string;
}
| {
bottom: number | string;
left: number | string;
}
| {
bottom: number | string;
right: number | string;
};

export type RadialGradientShape = 'circle' | 'ellipse';
export type RadialGradientSize =
| RadialExtent
| {
x: string | number;
y: string | number;
};

type RadialGradientValue = {
type: 'radial-gradient';
shape: RadialGradientShape;
size: RadialGradientSize;
position: RadialGradientPosition;
colorStops: ReadonlyArray<{
color: ColorValue | null;
positions?: ReadonlyArray<string> | undefined;
}>;
};

export type BackgroundImageValue = LinearGradientValue | RadialGradientValue;

export type BackgroundSizeValue =
| {
x: string | number;
y: string | number;
}
| 'cover'
| 'contain';

export type BackgroundRepeatKeyword =
| 'repeat'
| 'space'
| 'round'
| 'no-repeat';

export type BackgroundPositionValue =
| {
top: number | string;
left: number | string;
}
| {
top: number | string;
right: number | string;
}
| {
bottom: number | string;
left: number | string;
}
| {
bottom: number | string;
right: number | string;
};

export type BackgroundRepeatValue = {
x: BackgroundRepeatKeyword;
y: BackgroundRepeatKeyword;
};

/**
* @see https://reactnative.dev/docs/view#style
*/
Expand Down Expand Up @@ -440,6 +523,18 @@ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
| ReadonlyArray<GradientValue>
| string
| undefined;
experimental_backgroundSize?:
| ReadonlyArray<BackgroundSizeValue>
| string
| undefined;
experimental_backgroundPosition?:
| ReadonlyArray<BackgroundPositionValue>
| string
| undefined;
experimental_backgroundRepeat?:
| ReadonlyArray<BackgroundRepeatValue>
| string
| undefined;
}

export type FontVariant =
Expand Down
Loading