How to do it...

  1. Let's start this recipe by adding all the imports we'll need in the App.js file in the root of the project. One of these imports is a Menu component, which we'll create in a later step:
import React from 'react';import { StyleSheet, Text, View, TouchableOpacity } from 'react-native';import SideMenu from 'react-native-side-menu';import Menu from './components/Menu';
  1. Next, let's define the App class and the initial state. state only needs two properties in this app: an isOpen Boolean to keep track of when the side menu should be open, and a selectedBackgroundColor property whose value is a string representing the currently selected background color, as follows:
export default class App extends React.Component { state = { ...

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.