UNPKG

3.15 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = void 0;
7
8var React = _interopRequireWildcard(require("react"));
9
10var _reactNative = require("react-native");
11
12function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
13
14function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
16function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
17
18/**
19 * A component to show a scrollable content in a Dialog. The component only provides appropriate styling.
20 * For the scrollable content you can use `ScrollView`, `FlatList` etc. depending on your requirement.
21 *
22 * <div class="screenshots">
23 * <figure>
24 * <img class="medium" src="screenshots/dialog-scroll-area.gif" />
25 * </figure>
26 * </div>
27 *
28 * ## Usage
29 * ```js
30 * import * as React from 'react';
31 * import { ScrollView } from 'react-native';
32 * import { Dialog, Portal, Text } from 'react-native-paper';
33 *
34 * const MyComponent = () => {
35 * const [visible, setVisible] = React.useState(false);
36 *
37 * const hideDialog = () => setVisible(false);
38 *
39 * return (
40 * <Portal>
41 * <Dialog visible={visible} onDismiss={hideDialog}>
42 * <Dialog.ScrollArea>
43 * <ScrollView contentContainerStyle={{paddingHorizontal: 24}}>
44 * <Text>This is a scrollable area</Text>
45 * </ScrollView>
46 * </Dialog.ScrollArea>
47 * </Dialog>
48 * </Portal>
49 * );
50 * };
51 *
52 * export default MyComponent;
53 * ```
54 */
55const DialogScrollArea = props => /*#__PURE__*/React.createElement(_reactNative.View, _extends({}, props, {
56 style: [styles.container, props.style]
57}), props.children);
58
59DialogScrollArea.displayName = 'Dialog.ScrollArea';
60
61const styles = _reactNative.StyleSheet.create({
62 container: {
63 borderColor: 'rgba(0, 0, 0, .12)',
64 borderTopWidth: _reactNative.StyleSheet.hairlineWidth,
65 borderBottomWidth: _reactNative.StyleSheet.hairlineWidth,
66 paddingHorizontal: 24,
67 flexGrow: 1,
68 flexShrink: 1
69 }
70});
71
72var _default = DialogScrollArea;
73exports.default = _default;
74//# sourceMappingURL=DialogScrollArea.js.map
\No newline at end of file