mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-08 23:58:13 +08:00
docs(loading): show how to use dismiss method returns from useIonLoading for react (#23537)
This commit is contained in:
@ -139,17 +139,23 @@ import { IonButton, IonContent, IonPage, useIonLoading } from '@ionic/react';
|
||||
interface LoadingProps {}
|
||||
|
||||
const LoadingExample: React.FC<LoadingProps> = () => {
|
||||
const [present] = useIonLoading();
|
||||
const [present, dismiss] = useIonLoading();
|
||||
/**
|
||||
* The recommended way of dismissing is to use the `dismiss` property
|
||||
* on `IonLoading`, but the `dismiss` method returned from `useIonLoading`
|
||||
* can be used for more complex scenarios.
|
||||
*/
|
||||
return (
|
||||
<IonPage>
|
||||
<IonContent>
|
||||
<IonButton
|
||||
expand="block"
|
||||
onClick={() =>
|
||||
onClick={() => {
|
||||
present({
|
||||
duration: 3000,
|
||||
message: 'Loading...',
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}}
|
||||
>
|
||||
Show Loading
|
||||
</IonButton>
|
||||
|
||||
@ -7,17 +7,23 @@ import { IonButton, IonContent, IonPage, useIonLoading } from '@ionic/react';
|
||||
interface LoadingProps {}
|
||||
|
||||
const LoadingExample: React.FC<LoadingProps> = () => {
|
||||
const [present] = useIonLoading();
|
||||
const [present, dismiss] = useIonLoading();
|
||||
/**
|
||||
* The recommended way of dismissing is to use the `dismiss` property
|
||||
* on `IonLoading`, but the `dismiss` method returned from `useIonLoading`
|
||||
* can be used for more complex scenarios.
|
||||
*/
|
||||
return (
|
||||
<IonPage>
|
||||
<IonContent>
|
||||
<IonButton
|
||||
expand="block"
|
||||
onClick={() =>
|
||||
onClick={() => {
|
||||
present({
|
||||
duration: 3000,
|
||||
message: 'Loading...',
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
}}
|
||||
>
|
||||
Show Loading
|
||||
</IonButton>
|
||||
|
||||
Reference in New Issue
Block a user