UNPKG

1.28 kBJavaScriptView Raw
1import * as React from 'react';
2import { View, StyleSheet } from 'react-native';
3import Icon from '../Icon';
4const ICON_SIZE = 24;
5/**
6 * A component to show an icon in a list item.
7 *
8 * <div class="screenshots">
9 * <figure>
10 * <img class="medium" src="screenshots/list-icon.png" />
11 * </figure>
12 * </div>
13 *
14 * ## Usage
15 * ```js
16 * import * as React from 'react';
17 * import { List, Colors } from 'react-native-paper';
18 *
19 * const MyComponent = () => (
20 * <>
21 * <List.Icon color={Colors.blue500} icon="folder" />
22 * <List.Icon color={Colors.blue500} icon="equal" />
23 * <List.Icon color={Colors.blue500} icon="calendar" />
24 * </>
25 * );
26 *
27 * export default MyComponent;
28 * ```
29 */
30
31const ListIcon = _ref => {
32 let {
33 icon,
34 color: iconColor,
35 style
36 } = _ref;
37 return /*#__PURE__*/React.createElement(View, {
38 style: [styles.item, style],
39 pointerEvents: "box-none"
40 }, /*#__PURE__*/React.createElement(Icon, {
41 source: icon,
42 size: ICON_SIZE,
43 color: iconColor
44 }));
45};
46
47const styles = StyleSheet.create({
48 item: {
49 margin: 8,
50 height: 40,
51 width: 40,
52 alignItems: 'center',
53 justifyContent: 'center'
54 }
55});
56ListIcon.displayName = 'List.Icon';
57export default ListIcon;
58//# sourceMappingURL=ListIcon.js.map
\No newline at end of file