@janiscommerce/ui-native
Version:
components library for Janis app
24 lines (23 loc) • 735 B
JavaScript
import React from 'react';
import { Modal, Pressable, StyleSheet, View } from 'react-native';
const Dropdown = ({ show, setShow, children, measures }) => {
const styles = StyleSheet.create({
background: {
width: '100%',
height: '100%',
},
dropdown: {
position: 'absolute',
height: '100%',
width: measures.width,
top: measures.pageY,
left: measures.pageX,
},
});
return (<Modal animationType="fade" transparent visible={show}>
<Pressable style={styles.background} onPress={() => setShow(false)}>
<View style={styles.dropdown}>{children}</View>
</Pressable>
</Modal>);
};
export default Dropdown;