O'Reilly logo

React Native Cookbook by Crysfel Villa, Stan Bershadskiy

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

Adding styles to text and containers

We have several components at our disposal, but containers and texts are the most common and useful components to create layouts or other components. In this recipe, we will see how to use containers and text, but most importantly we will see how styles work in React Native.

We will create a UI for a simple music player; we won't be using icons for now, but we will add them later.

Getting ready

Please follow the instructions in the introduction in order to create a new app with the name ContainersText.

How to do it...

  1. Let's start by creating an src folder in the root of the project. This is where all our JavaScript code will be placed.
  2. Create a new JavaScript called MainApp.js:

  3. In the MainApp.js file, we are going ...

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