UNPKG

1.77 kBJavaScriptView Raw
1function _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); }
2
3import * as React from 'react';
4import color from 'color';
5import { StyleSheet, View } from 'react-native';
6import { withTheme } from '../core/theming';
7import { black, white } from '../styles/colors';
8
9/**
10 * A divider is a thin, lightweight separator that groups content in lists and page layouts.
11 *
12 * <div class="screenshots">
13 * <figure>
14 * <img class="medium" src="screenshots/divider.png" />
15 * </figure>
16 * </div>
17 *
18 * ## Usage
19 * ```js
20 * import * as React from 'react';
21 * import { View } from 'react-native';
22 * import { Divider, Text } from 'react-native-paper';
23 *
24 * const MyComponent = () => (
25 * <View>
26 * <Text>Lemon</Text>
27 * <Divider />
28 * <Text>Mango</Text>
29 * <Divider />
30 * </View>
31 * );
32 *
33 * export default MyComponent;
34 * ```
35 */
36const Divider = _ref => {
37 let {
38 inset,
39 style,
40 theme,
41 ...rest
42 } = _ref;
43 const {
44 dark: isDarkTheme
45 } = theme;
46 return /*#__PURE__*/React.createElement(View, _extends({}, rest, {
47 style: [isDarkTheme ? styles.dark : styles.light, inset && styles.inset, style]
48 }));
49};
50
51const styles = StyleSheet.create({
52 light: {
53 backgroundColor: color(black).alpha(0.12).rgb().string(),
54 height: StyleSheet.hairlineWidth
55 },
56 dark: {
57 backgroundColor: color(white).alpha(0.12).rgb().string(),
58 height: StyleSheet.hairlineWidth
59 },
60 inset: {
61 marginLeft: 72
62 }
63});
64export default withTheme(Divider);
65//# sourceMappingURL=Divider.js.map
\No newline at end of file