Created
December 8, 2019 23:38
-
-
Save huang47/7c819614e24ff52c30da5ed06ebb1582 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import React from 'react'; | |
import { View, Text } from 'react-native'; | |
import IconRenderer from './IconRenderer'; | |
import type { TIcon, TColor } from '../type'; | |
import { Size, type TSize, type TSizeLookup } from './size'; | |
export type Props = { | |
backgroundColor: TColor, | |
color: TColor, | |
icon: TIcon, | |
label: string, | |
size: TSize, | |
}; | |
export default function TextRenderer(props: Props) { | |
const { backgroundColor, color, icon, label, size = Size.M } = props; | |
return ( | |
<View | |
style={{ | |
alignItems: 'center', | |
backgroundColor, | |
flexDirection: 'row', | |
height: LabelHeight[size], | |
justifyContent: 'center', | |
}} | |
> | |
<IconRenderer backgroundColor={backgroundColor} color={color} icon={icon} size={size} /> | |
<Text | |
style={{ | |
paddingLeft: LabelPadding[size], | |
color, | |
fontSize: LabelFontSize[size], | |
}} | |
> | |
{label} | |
</Text> | |
</View> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment