@arpitbhalla/rneui-base-dev
Version:
Cross Platform React Native UI Toolkit
52 lines (51 loc) • 2.96 kB
JavaScript
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BottomSheet = void 0;
var react_1 = __importDefault(require("react"));
var react_native_1 = require("react-native");
var react_native_safe_area_context_1 = require("react-native-safe-area-context");
var BottomSheet = function (_a) {
var containerStyle = _a.containerStyle, backdropStyle = _a.backdropStyle, _b = _a.onBackdropPress, onBackdropPress = _b === void 0 ? function () { return null; } : _b, _c = _a.isVisible, isVisible = _c === void 0 ? false : _c, _d = _a.modalProps, modalProps = _d === void 0 ? {} : _d, children = _a.children, _e = _a.scrollViewProps, scrollViewProps = _e === void 0 ? {} : _e, rest = __rest(_a, ["containerStyle", "backdropStyle", "onBackdropPress", "isVisible", "modalProps", "children", "scrollViewProps"]);
return (react_1.default.createElement(react_native_1.Modal, __assign({ animationType: "slide", onRequestClose: onBackdropPress, transparent: true, visible: isVisible }, modalProps),
react_1.default.createElement(react_native_1.Pressable, { onPress: onBackdropPress, style: [react_native_1.StyleSheet.absoluteFill, backdropStyle], testID: "RNE__Overlay__backdrop" }),
react_1.default.createElement(react_native_safe_area_context_1.SafeAreaView, __assign({ style: react_native_1.StyleSheet.flatten([
styles.safeAreaView,
containerStyle && containerStyle,
]), pointerEvents: "box-none" }, rest),
react_1.default.createElement(react_native_1.View, null,
react_1.default.createElement(react_native_1.ScrollView, __assign({}, scrollViewProps), children)))));
};
exports.BottomSheet = BottomSheet;
var styles = react_native_1.StyleSheet.create({
safeAreaView: {
flex: 1,
backgroundColor: 'rgba(0,0,0,0.2)',
flexDirection: 'column-reverse',
},
});
exports.BottomSheet.displayName = 'BottomSheet';
;