Basic Usage
After the initial setup, you only need to focus on two functions responsible for your styles:
-
createStyleSheet
which replacesStyleSheet.create
-
useStyles
which parses your styles and ensures TypeScript compatibility with media queries and breakpointsSimple example with theming import React from 'react'import { View, Text } from 'react-native'import { createStyleSheet, useStyles } from 'react-native-unistyles'export const ExampleUnistyles = () => {const { styles } = useStyles(stylesheet)return (<View style={styles.container}><Text style={styles.text}>Unistyles example</Text></View>)}const stylesheet = createStyleSheet(theme => ({container: {flex: 1,justifyContent: 'center',alignItems: 'center',backgroundColor: theme.colors.background},text: {color: theme.colors.typography}}))