File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed
Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ export type Props = $RemoveChildren<typeof Surface> & {
9191 */
9292 extended : boolean ;
9393 /**
94- * @supported Available in v3 .x with theme version 3
94+ * @supported Available in v5 .x with theme version 3
9595 *
9696 * Color mappings variant for combinations of container and icon colors.
9797 */
Original file line number Diff line number Diff line change @@ -23,13 +23,25 @@ type FABSize = 'small' | 'medium' | 'large';
2323
2424type FABMode = 'flat' | 'elevated' ;
2525
26+ type IconOrLabel =
27+ | {
28+ icon : IconSource ;
29+ label ?: string ;
30+ }
31+ | {
32+ icon ?: IconSource ;
33+ label : string ;
34+ } ;
35+
2636export type Props = $RemoveChildren < typeof Surface > & {
37+ // For `icon` and `label` props their types are duplicated due to the generation of documentation.
38+ // Appropriate type for them is `IconOrLabel` contains the both union and intersection types.
2739 /**
28- * Icon to display for the `FAB`.
40+ * Icon to display for the `FAB`. It's optional only if `label` is defined.
2941 */
30- icon : IconSource ;
42+ icon ? : IconSource ;
3143 /**
32- * Optional label for extended `FAB`.
44+ * Optional label for extended `FAB`. It's optional only if `icon` is defined.
3345 */
3446 label ?: string ;
3547 /**
@@ -117,7 +129,7 @@ export type Props = $RemoveChildren<typeof Surface> & {
117129 theme ?: ThemeProp ;
118130 testID ?: string ;
119131 ref ?: React . RefObject < View > ;
120- } ;
132+ } & IconOrLabel ;
121133
122134/**
123135 * A floating action button represents the primary action in an application.
You can’t perform that action at this time.
0 commit comments