O'Reilly logo

React Native By Example by Richard Kho

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 DrawerLayoutAndroid and ToolbarAndroid

Let's begin by adding Toolbar/Drawer-based navigation for the Android version of Friends. We will need to start by creating a component called Drawer, which performs the following functions:

  • This accepts an array of routes as a prop.
  • This returns a ListView containing each route as a row to render. Each row should contain a TouchableHighlight component that, when clicked on, will call a prop called navigateTo, which we will eventually pass into Drawer.

We should also break the row that is rendered by Drawer into its own component titled DrawerRow. This component should do the following things:

  • Accept the name of the row as a prop and render that name in a Text element
  • Call setNativeProps so ...

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