/
githubmirror
/
ionic-framework
Обзор
Документация
Войти
/
githubmirror
/
ionic-framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/react/test/base/src/pages/overlay-components/KeepContentsMounted.tsx
38 строк
1 KB
Liam DeBeasi
test(react): migrate to builder architecture (#26959)
17 мар 2023, 23:21
Не верифицирован
17 мар 2023, 23:21
e3a1d7b
Код
Авторство
О чём код?
import React, { useState } from 'react'; import { IonButton, IonContent, IonPage, IonModal, IonPopover, } from '@ionic/react'; const KeepContentsMounted: React.FC = () => { const [showModal, setShowModal] = useState(false); const [showPopover, setShowPopover] = useState(false); return ( <IonPage> <IonContent fullscreen> <IonButton id="open-modal" onClick={() => setShowModal(true)}>Open Modal</IonButton> <IonButton id="open-popover" onClick={() => setShowPopover(true)}>Open Popover</IonButton> <IonModal keepContentsMounted={true} id="default-modal" isOpen={showModal} onDidDismiss={() => setShowModal(false)}> <IonContent> <IonButton onClick={() => setShowModal(false)}>Dismiss</IonButton> Modal Content </IonContent> </IonModal> <IonPopover keepContentsMounted={true} isOpen={showPopover} onDidDismiss={() => setShowPopover(false)}> <IonContent> <IonButton onClick={() => setShowPopover(false)}>Dismiss</IonButton> Popover Content </IonContent> </IonPopover> </IonContent> </IonPage> ); }; export default KeepContentsMounted;