Skip to content

Instantly share code, notes, and snippets.

@mxmzb
Created October 7, 2018 15:02
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 mxmzb/d123ae7fd9ecb0fc1a1eef694d5a523f to your computer and use it in GitHub Desktop.
Save mxmzb/d123ae7fd9ecb0fc1a1eef694d5a523f to your computer and use it in GitHub Desktop.
A RN module
import React from "react";
import styled, { ThemeProvider } from "styled-components";
import config from "../../config";
const Background = styled.View`
width: ${props => props.width}px;
height: ${props => props.height}px;
background-color: ${props => props.background};
justify-content: flex-end;
`;
const Label = styled.Text`
margin-left: ${props => props.theme.position.listItem.leftRightPadding};
margin-bottom: 5px;
font-size: ${props => props.theme.fontSize.separator};
font-weight: 600;
color: ${props => props.theme.palette.text.secondary};
`;
export default ({
children,
background = "transparent",
width = 0,
height = 35,
toUpperCase = true,
}) => (
<ThemeProvider theme={config.getTheme()}>
<Background background={background} height={height} width={width}>
{children && <Label>{toUpperCase ? children.toUpperCase() : children}</Label>}
</Background>
</ThemeProvider>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment