diff --git a/core/src/components/toast/readme.md b/core/src/components/toast/readme.md index 857980d95d..ca6fd572d2 100644 --- a/core/src/components/toast/readme.md +++ b/core/src/components/toast/readme.md @@ -117,6 +117,7 @@ async function presentToastWithOptions() { ```tsx import React, { useState } from 'react'; import { IonToast, IonContent, IonButton } from '@ionic/react'; +import { star } from 'ionicons/icons'; export const ToastExample: React.FC = () => { const [showToast1, setShowToast1] = useState(false); @@ -141,7 +142,7 @@ export const ToastExample: React.FC = () => { buttons={[ { side: 'start', - icon: 'star', + icon: star, text: 'Favorite', handler: () => { console.log('Favorite clicked'); diff --git a/packages/react/src/components/IonActionSheet.tsx b/packages/react/src/components/IonActionSheet.tsx index 6a2e489f27..00635f6739 100644 --- a/packages/react/src/components/IonActionSheet.tsx +++ b/packages/react/src/components/IonActionSheet.tsx @@ -1,5 +1,22 @@ -import { ActionSheetOptions, actionSheetController } from '@ionic/core'; +import { ActionSheetButton as ActionSheetButtonCore, ActionSheetOptions as ActionSheetOptionsCore, actionSheetController as actionSheetControllerCore } from '@ionic/core'; import { createOverlayComponent } from './createOverlayComponent'; +export interface ActionSheetButton extends Omit { + icon?: { + ios: string; + md: string; + }; +} + +export interface ActionSheetOptions extends Omit { + buttons?: (ActionSheetButton | string)[]; +} + +const actionSheetController = { + create: (options: ActionSheetOptions) => actionSheetControllerCore.create(options as any), + dismiss: (data?: any, role?: string | undefined, id?: string | undefined) => actionSheetControllerCore.dismiss(data, role, id), + getTop: () => actionSheetControllerCore.getTop() +}; + export const IonActionSheet = /*@__PURE__*/createOverlayComponent('IonActionSheet', actionSheetController); diff --git a/packages/react/src/components/IonToast.tsx b/packages/react/src/components/IonToast.tsx index 6c0b572b7f..82486edf55 100644 --- a/packages/react/src/components/IonToast.tsx +++ b/packages/react/src/components/IonToast.tsx @@ -1,5 +1,22 @@ -import { ToastOptions, toastController } from '@ionic/core'; +import { ToastButton as ToastButtonCore, ToastOptions as ToastOptionsCore, toastController as toastControllerCore } from '@ionic/core'; import { createControllerComponent } from './createControllerComponent'; +export interface ToastButton extends Omit { + icon?: { + ios: string; + md: string; + }; +} + +export interface ToastOptions extends Omit { + buttons?: (ToastButton | string)[]; +} + +const toastController = { + create: (options: ToastOptions) => toastControllerCore.create(options as any), + dismiss: (data?: any, role?: string | undefined, id?: string | undefined) => toastControllerCore.dismiss(data, role, id), + getTop: () => toastControllerCore.getTop() +}; + export const IonToast = /*@__PURE__*/createControllerComponent('IonToast', toastController);