From the course: Learning React Native

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Creating style sheets

Creating style sheets

From the course: Learning React Native

Start my 1-month free trial

Creating style sheets

- [Instructor] React Native handles styling UI components with an abstraction that's based on CSS. Let's take a look. Currently we have a view and three text elements, and if we look in our simulator, we can see that the text is really small and everything's jammed way up here in the left corner, behind the clock. Let's add some styles to make this text readable and visible. First, I'm going to go ahead and import the style sheet object from React Native. And then I like to add my styles below the component. So down here, on line 14, I'm going to go ahead and create a new constant called styles and we'll use StyleSheet.create to create a new style sheet where we can add various styles. Let's create a style object for page that we'll add to the view and we'll add a margin top of 40 pixels. Doing this adds 40 pixels to the top of the view, which pushes our content down below the status bar on the clock. Notice…

Contents