Skip to main content

Basics

Styling with Skyle is extremely easy.

  1. Add the @styled above the component.
  2. Add styles = styles at the top of the component.
  3. Import/create a StyleSheet from 'skyle'.
  4. Use this.styles to style your components!
import { View } from 'react-native';
import { styled, StyleSheet } from 'skyle';
@styled
class App extends Component {
styles = styles;
render() {
return <View style={this.styles.view} />;
}
}
// Same as StyleSheet but with more customization!
const styles = StyleSheet.create((o) => ({
view: {
backgroundColor: o.theme.colors.primary,
transition: ['backgroundColor', 500],
},
}));
export default App;

If you don't have decorators enabled, you can also pass the component through a function:

import { View } from 'react-native';
import { styled, StyleSheet } from 'skyle';
class App extends Component {
styles = styles;
render() {
return <View style={this.styles.view} />;
}
}
// Same as StyleSheet but with more customization!
const styles = StyleSheet.create((o) => ({
view: {
backgroundColor: o.theme.colors.primary,
transition: ['backgroundColor', 500],
},
}));
export default styled(App);