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
Zhiyuan Zheng e9ea0ed71e Updates
1. Added more notification types
2. Use `react-native-reanimated` v2
2021-01-04 10:50:24 +01:00

49 lines
932 B
TypeScript

import React, { createElement } from 'react'
import { StyleProp, View, ViewStyle } from 'react-native'
import * as FeatherIcon from 'react-native-feather'
export interface Props {
name: string
size: number
color: string
fill?: string
strokeWidth?: number
inline?: boolean // When used in line of text, need to drag it down
style?: StyleProp<ViewStyle>
}
const Icon: React.FC<Props> = ({
name,
size,
color,
fill,
strokeWidth = 2,
inline = false,
style
}) => {
return (
<View
style={[
style,
{
width: size,
height: size,
justifyContent: 'center',
alignItems: 'center',
marginBottom: inline ? -size * 0.125 : undefined
}
]}
>
{createElement(FeatherIcon[name], {
width: size,
height: size,
color,
fill,
strokeWidth
})}
</View>
)
}
export default Icon