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