forked from callstack/react-native-paper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathListIcon.tsx
54 lines (49 loc) · 1.08 KB
/
ListIcon.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import * as React from 'react';
import { View, ViewStyle, StyleSheet, StyleProp } from 'react-native';
import Icon, { IconSource } from '../Icon';
type Props = {
/**
* Icon to show.
*/
icon: IconSource;
/**
* Color for the icon.
*/
color?: string;
style?: StyleProp<ViewStyle>;
};
/**
* A component to show an icon in a list item.
*
* ## Usage
* ```js
* import * as React from 'react';
* import { List, Colors } from 'react-native-paper';
*
* const MyComponent = () => (
* <List.Icon color={Colors.blue500} icon="folder" />
* );
*
* export default MyComponent;
* ```
*/
export default class ListIcon extends React.Component<Props> {
static displayName = 'List.Icon';
render() {
const { icon, color: iconColor, style } = this.props;
return (
<View style={[styles.item, style]} pointerEvents="box-none">
<Icon source={icon} size={24} color={iconColor} />
</View>
);
}
}
const styles = StyleSheet.create({
item: {
margin: 8,
height: 40,
width: 40,
alignItems: 'center',
justifyContent: 'center',
},
});