How to do it...

  1. Let's start with building the App. We'll start that by adding the dependencies we need to App.js:
import React from 'react';import {  StyleSheet,  Text,  View,  TextInput,  Modal,  TouchableOpacity} from 'react-native';import { Permissions, Notifications } from 'expo';
  1. We're going to declare two constants for the API endpoints on our server, but the url will be generated by ngrok when we run the server later in the recipe, so we'll update the value of these constants at that point:
const PUSH_REGISTRATION_ENDPOINT = 'http://generated-ngrok-url/token';const MESSAGE_ENPOINT = 'http://generated-ngrok-url/message';
  1. Let's create the App component and initialize the state object. We'll need a notification property to hold notifications ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.