Skip to content

Instantly share code, notes, and snippets.

@huang47
Created December 8, 2019 23:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huang47/7c819614e24ff52c30da5ed06ebb1582 to your computer and use it in GitHub Desktop.
Save huang47/7c819614e24ff52c30da5ed06ebb1582 to your computer and use it in GitHub Desktop.
// @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