2023-01-25 00:15:46 +01:00
|
|
|
import FeatherNames from '@expo/vector-icons/build/vendor/react-native-vector-icons/glyphmaps/Feather.json'
|
|
|
|
import Feather from '@expo/vector-icons/Feather'
|
|
|
|
import React from 'react'
|
2021-04-09 21:43:12 +02:00
|
|
|
import { AccessibilityProps, StyleProp, View, ViewStyle } from 'react-native'
|
2023-01-25 00:15:46 +01:00
|
|
|
|
|
|
|
export type IconName = keyof typeof FeatherNames
|
2021-01-03 02:00:26 +01:00
|
|
|
|
|
|
|
export interface Props {
|
2021-04-09 21:43:12 +02:00
|
|
|
accessibilityLabel?: AccessibilityProps['accessibilityLabel']
|
|
|
|
|
2023-01-25 00:15:46 +01:00
|
|
|
name: IconName
|
2021-01-03 02:00:26 +01:00
|
|
|
size: number
|
|
|
|
color: string
|
|
|
|
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,
|
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
|
|
|
}
|
|
|
|
]}
|
|
|
|
>
|
2023-01-25 00:15:46 +01:00
|
|
|
<Feather name={name} size={size} color={color} />
|
2022-12-14 23:37:41 +01:00
|
|
|
{crossOut ? (
|
|
|
|
<View
|
|
|
|
style={{
|
|
|
|
position: 'absolute',
|
|
|
|
transform: [{ rotate: '45deg' }],
|
|
|
|
width: size * 1.35,
|
|
|
|
borderBottomColor: color,
|
2023-01-25 00:15:46 +01:00
|
|
|
borderBottomWidth: 2
|
2022-12-14 23:37:41 +01:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
) : null}
|
2021-01-03 02:00:26 +01:00
|
|
|
</View>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Icon
|