1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00
Files
tooot/src/components/Icon.tsx
xmflsct 9d9c16df06 Bump packages
And deprecate react-native-feather
2023-01-25 00:15:46 +01:00

56 lines
1.2 KiB
TypeScript

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'
import { AccessibilityProps, StyleProp, View, ViewStyle } from 'react-native'
export type IconName = keyof typeof FeatherNames
export interface Props {
accessibilityLabel?: AccessibilityProps['accessibilityLabel']
name: IconName
size: number
color: string
style?: StyleProp<ViewStyle>
crossOut?: boolean
}
const Icon: React.FC<Props> = ({
accessibilityLabel,
name,
size,
color,
style,
crossOut = false
}) => {
return (
<View
accessibilityLabel={accessibilityLabel}
style={[
style,
{
width: size,
height: size,
justifyContent: 'center',
alignItems: 'center'
}
]}
>
<Feather name={name} size={size} color={color} />
{crossOut ? (
<View
style={{
position: 'absolute',
transform: [{ rotate: '45deg' }],
width: size * 1.35,
borderBottomColor: color,
borderBottomWidth: 2
}}
/>
) : null}
</View>
)
}
export default Icon