xref: /MusicFree/src/components/dialogs/index.tsx (revision b882a19d884fffa32f7c8cef31652b909dceaa0f)
1import React from 'react';
2import {Portal} from 'react-native-paper';
3import components from './components';
4import useDialog from './useDialog';
5
6export default function () {
7    const {dialogName, hideDialog, payload} = useDialog();
8
9    return (
10        <Portal>
11            {components.map(([key, DialogComponent]) => (
12                <DialogComponent
13                    key={key}
14                    visible={dialogName === key}
15                    hideDialog={hideDialog}
16                    {...(payload ?? {})}
17                />
18            ))}
19        </Portal>
20    );
21}
22