How to do it...

  1. Let's start by opening up App.js and adding the dependencies we'll need:
import React, { Component } from 'react';import { Audio } from 'expo';import { Feather } from '@expo/vector-icons';import {  StyleSheet,  Text,  TouchableOpacity,  View,  Dimensions} from 'react-native';
  1. An audio player needs audio to play. We'll create a playlist array to hold the audio tracks. Each track is represented by an object with a title, artist, album, and uri:
const playlist = [  {    title: 'People Watching',    artist: 'Keller Williams',    album: 'Keller Williams Live at The Westcott Theater on 2012-09-22',    uri: 'https://ia800308.us.archive.org/7/items/kwilliams2012-09-22.at853.flac16/kwilliams2012-09-22at853.t16.mp3'  },  { title: 'Hunted By A Freak', ...

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.