O'Reilly logo

React and React Native by Adam Boduch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Introducing React Native styles

It's time to implement your first React Native app, beyond the boilerplate that's generated by react-native init. I want to make sure that you feel comfortable using React Native stylesheets before you start implementing flexbox layouts in the next section. Here's what a React Native stylesheet looks like:

import { StyleSheet } from 'react-native'; // Exports a "stylesheet" that can be used // by React Native components. The structure is // familiar for CSS authors. const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: 'ghostwhite', }, box: { width: 100, height: 100, justifyContent: 'center', alignItems: 'center', backgroundColor: 'lightgray', }, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required