2021-01-03 02:00:26 +01:00
|
|
|
import React, { createElement } from 'react'
|
2021-04-09 21:43:12 +02:00
|
|
|
import { AccessibilityProps, StyleProp, View, ViewStyle } from 'react-native'
|
2021-01-03 02:00:26 +01:00
|
|
|
import * as FeatherIcon from 'react-native-feather'
|
|
|
|
|
|
|
|
export interface Props {
|
2021-04-09 21:43:12 +02:00
|
|
|
accessibilityLabel?: AccessibilityProps['accessibilityLabel']
|
|
|
|
|
2021-01-03 02:00:26 +01:00
|
|
|
name: string
|
|
|
|
size: number
|
|
|
|
color: string
|
2021-01-04 10:50:24 +01:00
|
|
|
fill?: string
|
2021-01-03 02:00:26 +01:00
|
|
|
strokeWidth?: number
|
|
|
|
style?: StyleProp<ViewStyle>
|
2022-12-14 23:37:41 +01:00
|
|
|
crossOut?: boolean
|
2021-01-03 02:00:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
const Icon: React.FC<Props> = ({
|
2021-04-09 21:43:12 +02:00
|
|
|
accessibilityLabel,
|
2021-01-03 02:00:26 +01:00
|
|
|
name,
|
|
|
|
size,
|
|
|
|
color,
|
2021-01-04 10:50:24 +01:00
|
|
|
fill,
|
2021-01-03 02:00:26 +01:00
|
|
|
strokeWidth = 2,
|
2022-12-14 23:37:41 +01:00
|
|
|
style,
|
|
|
|
crossOut = false
|
2021-01-03 02:00:26 +01:00
|
|
|
}) => {
|
|
|
|
return (
|
|
|
|
<View
|
2021-04-09 21:43:12 +02:00
|
|
|
accessibilityLabel={accessibilityLabel}
|
2021-01-03 02:00:26 +01:00
|
|
|
style={[
|
|
|
|
style,
|
|
|
|
{
|
|
|
|
width: size,
|
|
|
|
height: size,
|
|
|
|
justifyContent: 'center',
|
2021-01-04 14:55:34 +01:00
|
|
|
alignItems: 'center'
|
2021-01-03 02:00:26 +01:00
|
|
|
}
|
|
|
|
]}
|
|
|
|
>
|
|
|
|
{createElement(FeatherIcon[name], {
|
|
|
|
width: size,
|
|
|
|
height: size,
|
|
|
|
color,
|
2021-01-04 10:50:24 +01:00
|
|
|
fill,
|
2021-01-03 02:00:26 +01:00
|
|
|
strokeWidth
|
|
|
|
})}
|
2022-12-14 23:37:41 +01:00
|
|
|
{crossOut ? (
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
position: 'absolute',
|
|
|
|
transform: [{ rotate: '45deg' }],
|
|
|
|
width: size * 1.35,
|
|
|
|
borderBottomColor: color,
|
|
|
|
borderBottomWidth: strokeWidth
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : null}
|
2021-01-03 02:00:26 +01:00
|
|
|
</View>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Icon
|