Skip to content

Commit a4ed1c0

Browse files
docs(modal): update controller example for react (#3535)
* docs(modal): update controller example for react * chore: lint --------- Co-authored-by: Liam DeBeasi <[email protected]>
1 parent ac8a03f commit a4ed1c0

File tree

1 file changed

+4
-8
lines changed
  • static/usage/v8/modal/controller

1 file changed

+4
-8
lines changed

static/usage/v8/modal/controller/react.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,20 @@ import {
1414
} from '@ionic/react';
1515
import { OverlayEventDetail } from '@ionic/core/components';
1616

17-
const ModalExample = ({
18-
onDismiss,
19-
}: {
20-
onDismiss: (data?: string | null | undefined | number, role?: string) => void;
21-
}) => {
17+
const ModalExample = ({ dismiss }: { dismiss: (data?: string | null | undefined | number, role?: string) => void }) => {
2218
const inputRef = useRef<HTMLIonInputElement>(null);
2319
return (
2420
<IonPage>
2521
<IonHeader>
2622
<IonToolbar>
2723
<IonButtons slot="start">
28-
<IonButton color="medium" onClick={() => onDismiss(null, 'cancel')}>
24+
<IonButton color="medium" onClick={() => dismiss(null, 'cancel')}>
2925
Cancel
3026
</IonButton>
3127
</IonButtons>
3228
<IonTitle>Welcome</IonTitle>
3329
<IonButtons slot="end">
34-
<IonButton onClick={() => onDismiss(inputRef.current?.value, 'confirm')} strong={true}>
30+
<IonButton onClick={() => dismiss(inputRef.current?.value, 'confirm')} strong={true}>
3531
Confirm
3632
</IonButton>
3733
</IonButtons>
@@ -48,7 +44,7 @@ const ModalExample = ({
4844

4945
function Example() {
5046
const [present, dismiss] = useIonModal(ModalExample, {
51-
onDismiss: (data: string, role: string) => dismiss(data, role),
47+
dismiss: (data: string, role: string) => dismiss(data, role),
5248
});
5349
const [message, setMessage] = useState('This modal example uses the modalController to present and dismiss modals.');
5450

0 commit comments

Comments
 (0)