We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support 100% of Yoga CSS API.
Support styled-system aliases with proposed system:
styled-system
const useStyles = (styles) => { return useMemo(() => { const parsedStyles = parseStyles(styles); return StyleSheet.create(parsedStyles); }, styles); }; const filterStyles = props => props.filter(prop => ['backgroundColor, 'color, 'fontSize'].includes(prop); const filterProps = props => props.filter(prop => !['backgroundColor, 'color, 'fontSize'].includes(prop); const Box = (props) => { const styles = filterStyles(props); const style = useStyles(styles); return <View style={style} {...filterProps(props)} />; };
const mapping = { bg: backgroundColor, p: padding, pt: paddingTop, pb: paddingBottom, pl: paddingLeft, pr: paddingRight, m: margin, mt: marginTop, mb: marginBottom // ... }; const parseStylesheet = (styles) => { const parsedStyles = {}; Object.entries(styles).forEach(([att, val]) => { if (mapping[att]) { parsedStyles[mapping[att]] = val; } }); return parsedStyles; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Support 100% of Yoga CSS API.
Support
styled-system
aliases with proposed system:The text was updated successfully, but these errors were encountered: