Skip to content

Instantly share code, notes, and snippets.

@brunocarvalhodearaujo
Created December 18, 2018 13:39
Show Gist options
  • Save brunocarvalhodearaujo/ca9a5f3feea9f59cdcc074f4cafd5190 to your computer and use it in GitHub Desktop.
Save brunocarvalhodearaujo/ca9a5f3feea9f59cdcc074f4cafd5190 to your computer and use it in GitHub Desktop.
react styled component with flow typing
/**
* 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