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