You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
This commit is contained in:
32
packages/app-mobile/components/Modal.tsx
Normal file
32
packages/app-mobile/components/Modal.tsx
Normal file
@ -0,0 +1,32 @@
|
||||
import * as React from 'react';
|
||||
import { Modal, ModalProps, StyleSheet, View, ViewStyle } from 'react-native';
|
||||
import { hasNotch } from 'react-native-device-info';
|
||||
|
||||
interface ModalElementProps extends ModalProps {
|
||||
children: React.ReactNode;
|
||||
containerStyle?: ViewStyle;
|
||||
elevation?: Number;
|
||||
}
|
||||
|
||||
const ModalElement: React.FC<ModalElementProps> = ({
|
||||
children,
|
||||
containerStyle,
|
||||
...modalProps
|
||||
}) => {
|
||||
return (
|
||||
<Modal {...modalProps}>
|
||||
<View style={[styleSheet.modalContainer, containerStyle ? containerStyle : null]}>
|
||||
{children}
|
||||
</View>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
const styleSheet = StyleSheet.create({
|
||||
modalContainer: {
|
||||
marginTop: hasNotch() ? 65 : 15,
|
||||
marginBottom: hasNotch() ? 35 : 15,
|
||||
},
|
||||
});
|
||||
|
||||
export default ModalElement;
|
Reference in New Issue
Block a user