UNPKG

rn-spacer

Version:

Component to add space between elements

34 lines (29 loc) 785 B
import React from "react"; import { View } from "react-native"; import PropTypes from 'prop-types'; const Spacer = ({ size, horizontal, bgcolor }) => { const initalValue = 'auto'; console.log("horizontal", horizontal); return ( <View style={{ width: horizontal ? size : initalValue, height: !horizontal ? size : initalValue, backgroundColor: bgcolor }} /> ); }; Spacer.propTypes = { size: PropTypes.oneOfType([ PropTypes.number, PropTypes.string ]).isRequired, horizontal: PropTypes.bool, color: PropTypes.string }; Spacer.defaultProps = { horizontal: false, bgcolor: '#ffffff' }; export default Spacer;