How to do it...

  1. Let's open App.js and import the dependencies we'll need in this app, as well as our data.json file we created in the previous Getting ready section. We'll also import a Device utility from ./utils/Device, which we will build in a later step:
import React, { Component } from 'react';
import { StyleSheet, View, Text } from 'react-native';
import Device from './utils/Device';

import data from './data.json';
  1. Here, we're going to create the main App component and its basic layout. This top-level component will decide whether to render the phone or tablet UI. We are only rendering two Text elements. The renderDetail text should be displayed on tablets only and the renderMaster text should be displayed on phones and tablets: ...

Get React Native Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.