UNPKG

1.54 kBJavaScriptView Raw
1var __rest = (this && this.__rest) || function (s, e) {
2 var t = {};
3 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4 t[p] = s[p];
5 if (s != null && typeof Object.getOwnPropertySymbols === "function")
6 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8 t[p[i]] = s[p[i]];
9 }
10 return t;
11};
12import React from 'react';
13import { Modal, View, StyleSheet, ScrollView, } from 'react-native';
14import { SafeAreaView } from 'react-native-safe-area-context';
15import { withTheme } from '../config';
16const BottomSheet = (_a) => {
17 var { containerStyle, isVisible = false, modalProps = {}, children } = _a, props = __rest(_a, ["containerStyle", "isVisible", "modalProps", "children"]);
18 return (<Modal animationType="slide" transparent={true} visible={isVisible} {...modalProps}>
19 <SafeAreaView style={StyleSheet.flatten([
20 styles.safeAreaView,
21 containerStyle && containerStyle,
22 ])} {...props}>
23 <View>
24 <ScrollView>{children}</ScrollView>
25 </View>
26 </SafeAreaView>
27 </Modal>);
28};
29const styles = StyleSheet.create({
30 safeAreaView: {
31 flex: 1,
32 backgroundColor: 'rgba(0,0,0,0.2)',
33 flexDirection: 'column-reverse',
34 },
35 listContainer: { backgroundColor: 'white' },
36});
37export { BottomSheet };
38export default withTheme(BottomSheet, 'BottomSheet');