1 | var __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 | };
|
12 | var _a, _b;
|
13 | import React from 'react';
|
14 | import { View, StyleSheet, Text, } from 'react-native';
|
15 | import { withTheme } from '../config';
|
16 | import Theme from '../config/theme';
|
17 | const Divider = (_a) => {
|
18 | var { color, inset = false, insetType = 'left', orientation = 'horizontal', style, subHeader, subHeaderStyle, theme, width } = _a, rest = __rest(_a, ["color", "inset", "insetType", "orientation", "style", "subHeader", "subHeaderStyle", "theme", "width"]);
|
19 | return (<>
|
20 | <View style={StyleSheet.flatten([
|
21 | styles.divider,
|
22 | style,
|
23 | inset &&
|
24 | (insetType === 'left'
|
25 | ? styles.leftInset
|
26 | : insetType === 'right'
|
27 | ? styles.rightInset
|
28 | : Object.assign(Object.assign({}, styles.leftInset), styles.rightInset)),
|
29 | orientation === 'vertical' && styles.vertical,
|
30 | width &&
|
31 | (orientation === 'horizontal'
|
32 | ? { borderBottomWidth: width }
|
33 | : { borderRightWidth: width }),
|
34 | color &&
|
35 | (orientation === 'horizontal'
|
36 | ? { borderBottomColor: color }
|
37 | : { borderRightColor: color }),
|
38 | ])} {...rest}/>
|
39 | {subHeader && orientation === 'horizontal' ? (<Text style={StyleSheet.flatten([
|
40 | styles.subHeader,
|
41 | subHeaderStyle,
|
42 | inset && styles.leftInset,
|
43 | ])}>
|
44 | {subHeader}
|
45 | </Text>) : null}
|
46 | </>);
|
47 | };
|
48 | const styles = StyleSheet.create({
|
49 | divider: {
|
50 | borderBottomWidth: StyleSheet.hairlineWidth,
|
51 | borderBottomColor: (_a = Theme === null || Theme === void 0 ? void 0 : Theme.colors) === null || _a === void 0 ? void 0 : _a.divider,
|
52 | },
|
53 | leftInset: {
|
54 | marginLeft: 72,
|
55 | },
|
56 | rightInset: {
|
57 | marginRight: 72,
|
58 | },
|
59 | vertical: {
|
60 | borderRightWidth: StyleSheet.hairlineWidth,
|
61 | borderRightColor: (_b = Theme === null || Theme === void 0 ? void 0 : Theme.colors) === null || _b === void 0 ? void 0 : _b.divider,
|
62 | height: 'auto',
|
63 | alignSelf: 'stretch',
|
64 | },
|
65 | subHeader: {
|
66 | includeFontPadding: false,
|
67 | },
|
68 | });
|
69 | export { Divider };
|
70 | export default withTheme(Divider, 'Divider');
|