0

我正在使用 React Native Paper 库,并且我有一个模态和对话框,我想对话框出现在模态的前面......有没有办法做到这一点?

如果没有办法,我将不得不使用 Modal 自己编写对话框的结构,我宁愿不这样做......

谢谢

4

1 回答 1

1

我有同样的问题,我通过使用react-native-paperreact-native的模态来解决它。

  • react-native: 0.63.2
  • react-native-paper: 2.16.0

import {Modal as RNModal} from 'react-native';
import {Modal, Portal} from 'react-native-paper';

return (
<Portal>
   <Modal>
      <View>
        ...content for the view
      </View>
      <RNModal visible={props.visible} transparent={true}>
        <Dialog visible={props.visible} onDismiss={props.onDismiss}>
        ...content for dialog
        </Dialog>
      <RNModal>
   </Modal>
</Portal>
);

RNModal导致内部对话框始终位于顶部。

于 2020-10-08T21:46:00.697 回答