Skip to content

Commit 37bf285

Browse files
tjzelmeta-codesync[bot]
authored andcommitted
fix: add missing experimental_ types in manual .d.ts (#54797)
Summary: - `experimental_backgroundSize` - `experimental_backgroundPosition` - `experimental_backgroundRepeat` types are missing in the manually written .d.ts file but are available in `react-native-strict-api` ## Changelog: [GENERAL] [FIXED] - Added missing `experimental_backgroundSize`, `experimental_backgroundPosition`, `experimental_backgroundRepeat` to manually written types. Pull Request resolved: #54797 Test Plan: CI Reviewed By: cortinico Differential Revision: D88483858 Pulled By: javache fbshipit-source-id: 4fa42aab42a7be529c292d1b807ee46417756bca
1 parent 6bf4840 commit 37bf285

1 file changed

Lines changed: 97 additions & 2 deletions

File tree

packages/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts

Lines changed: 97 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ export type BlendMode =
367367
| 'color'
368368
| 'luminosity';
369369

370-
export type GradientValue = {
370+
export type LinearGradientValue = {
371371
type: 'linear-gradient';
372372
// Angle or direction enums
373373
direction?: string | undefined;
@@ -377,6 +377,89 @@ export type GradientValue = {
377377
}>;
378378
};
379379

380+
export type GradientValue = LinearGradientValue;
381+
382+
type RadialExtent =
383+
| 'closest-corner'
384+
| 'closest-side'
385+
| 'farthest-corner'
386+
| 'farthest-side';
387+
export type RadialGradientPosition =
388+
| {
389+
top: number | string;
390+
left: number | string;
391+
}
392+
| {
393+
top: number | string;
394+
right: number | string;
395+
}
396+
| {
397+
bottom: number | string;
398+
left: number | string;
399+
}
400+
| {
401+
bottom: number | string;
402+
right: number | string;
403+
};
404+
405+
export type RadialGradientShape = 'circle' | 'ellipse';
406+
export type RadialGradientSize =
407+
| RadialExtent
408+
| {
409+
x: string | number;
410+
y: string | number;
411+
};
412+
413+
type RadialGradientValue = {
414+
type: 'radial-gradient';
415+
shape: RadialGradientShape;
416+
size: RadialGradientSize;
417+
position: RadialGradientPosition;
418+
colorStops: ReadonlyArray<{
419+
color: ColorValue | null;
420+
positions?: ReadonlyArray<string> | undefined;
421+
}>;
422+
};
423+
424+
export type BackgroundImageValue = LinearGradientValue | RadialGradientValue;
425+
426+
export type BackgroundSizeValue =
427+
| {
428+
x: string | number;
429+
y: string | number;
430+
}
431+
| 'cover'
432+
| 'contain';
433+
434+
export type BackgroundRepeatKeyword =
435+
| 'repeat'
436+
| 'space'
437+
| 'round'
438+
| 'no-repeat';
439+
440+
export type BackgroundPositionValue =
441+
| {
442+
top: number | string;
443+
left: number | string;
444+
}
445+
| {
446+
top: number | string;
447+
right: number | string;
448+
}
449+
| {
450+
bottom: number | string;
451+
left: number | string;
452+
}
453+
| {
454+
bottom: number | string;
455+
right: number | string;
456+
};
457+
458+
export type BackgroundRepeatValue = {
459+
x: BackgroundRepeatKeyword;
460+
y: BackgroundRepeatKeyword;
461+
};
462+
380463
/**
381464
* @see https://reactnative.dev/docs/view#style
382465
*/
@@ -437,7 +520,19 @@ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
437520

438521
mixBlendMode?: BlendMode | undefined;
439522
experimental_backgroundImage?:
440-
| ReadonlyArray<GradientValue>
523+
| ReadonlyArray<BackgroundImageValue>
524+
| string
525+
| undefined;
526+
experimental_backgroundSize?:
527+
| ReadonlyArray<BackgroundSizeValue>
528+
| string
529+
| undefined;
530+
experimental_backgroundPosition?:
531+
| ReadonlyArray<BackgroundPositionValue>
532+
| string
533+
| undefined;
534+
experimental_backgroundRepeat?:
535+
| ReadonlyArray<BackgroundRepeatValue>
441536
| string
442537
| undefined;
443538
}

0 commit comments

Comments
 (0)