Created
December 18, 2018 13:39
-
-
Save brunocarvalhodearaujo/ca9a5f3feea9f59cdcc074f4cafd5190 to your computer and use it in GitHub Desktop.
react styled component with flow typing
This file contains hidden or 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
/** | |
* Copyright 2018-present Bruno Carvalho de Araujo. | |
* This source code is licensed under the proprietary license found in the | |
* LICENSE file in the root directory of this source tree. | |
*/ | |
import React, { ComponentType, ReactNode } from 'react' | |
import PropTypes from 'prop-types' | |
import styled from 'styled-components' | |
type Props = { | |
fluid?: boolean, | |
children: ReactNode, | |
theme: { | |
color: string | |
} | |
} | |
const Container: ComponentType<Props> = styled.View` | |
flex: 1; | |
background-color: #ffffff; | |
align-items: center; | |
justify-content: center; | |
` | |
Container.defaultProps = { | |
fluid: false | |
} | |
Container.propTypes = { | |
fluid: PropTypes.bool, | |
children: PropTypes.element.isRequired, | |
theme: PropTypes.shape({ | |
color: PropTypes.string.isRequired | |
}).isRequired | |
} | |
export default Container |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment