0.0.5 ā€¢ Published 2 years ago

@dyst/native v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

šŸƒā€ā™€ Dynamic Styles


Create dynamic stylesheets and link them to functional components using the React hook pattern.

  • āœ… Build on top of @emotion/react: As fast and lightweight as emotion
  • āœ… Supports all emotion features: dynamic theming, etc.
  • āœ… Fully featured TypeScript support
  • šŸŸØ Well tested (working on it)
// Create dynamic stylesheet that has access to the previously specified theme and parameters
const useStyles = styleSheet.create(({theme, params}) => ({
    root: /* Dynamic Styles */,
    button: /* Dynamic Styles */,
    text: /* Dynamic Styles */,
}));

const MyComponent = (props) => {
    // Access dynamic styles as class names using the created 'useStyles()' hook 
    // and specify the corresponding parameters
    const { styles } = useStyles({ color: props.color, fontSize: 10 });
    
    return (
      <div style={styles.root}>
          {/* */}
      </div>
    );
}

šŸ’» Installation

$ yarn add @dyst/native @emotion/react @emotion/native
# or
$ npm install @dyst/native @emotion/react @emotion/native

ā›³ļø Code Sandbox

šŸŖ Basic usage

Learn more here