Skip to content

Instantly share code, notes, and snippets.

@limianwang
Created July 20, 2018 18:50
Show Gist options
  • Save limianwang/9322ce039cabbe0b0a33ee319ba5db68 to your computer and use it in GitHub Desktop.
Save limianwang/9322ce039cabbe0b0a33ee319ba5db68 to your computer and use it in GitHub Desktop.
const View = styled.View`
padding-top: ${({ top }) => (top || 5)}px;
padding-bottom: ${({ bottom }) => (bottom || 5)}px;
padding-right: ${({ right }) => (right || 5)}px;
padding-left: ${({ left}) => (left || 5)}px;
background-color: ${props => props.transparent ? 'black' : '#ffffff'};
margin-right: 0px;
margin-left: 0px;
margin-top: 0px;
margin-bottom: 0px;
`;
const Box = styled.View`
${props => props.size && `min-height: ${props.size}px;`}
padding-top: ${({ top }) => (top || 10)}px;
padding-bottom: ${({ bottom }) => (bottom || 10)}px;
padding-right: ${({ right }) => (right || 10)}px;
padding-left: ${({ left}) => (left || 10)}px;
`;
render() {
return (
<View left={10} transparent>
<Box size={200}>
<Text>This is a test message</Text>
</Box>
</View>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment