1 | import * as React from 'react';
|
2 | import { View, StyleSheet } from 'react-native';
|
3 | import Icon from '../Icon';
|
4 | const 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 |
|
31 | const 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 |
|
47 | const styles = StyleSheet.create({
|
48 | item: {
|
49 | margin: 8,
|
50 | height: 40,
|
51 | width: 40,
|
52 | alignItems: 'center',
|
53 | justifyContent: 'center'
|
54 | }
|
55 | });
|
56 | ListIcon.displayName = 'List.Icon';
|
57 | export default ListIcon;
|
58 | //# sourceMappingURL=ListIcon.js.map |
\ | No newline at end of file |