UnistylesRegistry can be easily replaced with StyleSheet.configure as it follows the same syntax.
Themes and Breakpoints work exactly the same.
For Settings we removed 4 out of 6 options:
Import StyleSheet from react-native-unistyles:
Replace createStyleSheet with StyleSheet.create:
Remove all occurrences of useStyles hook:
Rename your stylesheet to styles:
If you used useInitialTheme, remove it and set initial theme in StyleSheet.configure:
If you need to access your theme in component, refactor it to use withUnistyles:
If you want to speed up the migration process, but keep your views re-rendered, use useUnistyles hook:
If you need to access breakpoint to show/hide your components use Display and Hide components instead:
If you used UnistylesProvider, remove it as it has no effect anymore:
If you want to move your component based on keyboard position, use ime inset:
Some UnistylesRuntime methods have been renamed. Follow TypeScript types to use new names.
Some UnistylesRuntime methods have been removed:
UnistylesRuntime methods that accepted color and alpha have been changed to accept color only. Each method supports any color that is respected by React Native:
hairlineWidth has been moved from UnistylesRuntime to StyleSheet. Use StyleSheet.hairlineWidth instead:
If your app used variants, move config to styles.useVariants instead:
Style is not bound! error or Unistyles: we detected style object with N unistyles styles. (...) warning
If you encountered this warning or error, it means that you’re spreading your styles. This is not possible in Unistyles 3.0 anymore as spreading will remove C++ state:
Instead, use array syntax provided by React Native:
By using array syntax, we know the order of merging that is necessary to resolve styles correctly.