How to do it...

  1. We are going to display a timeline with images in the App class. Let's import all of the dependencies, including the two other components we'll build out in later steps, as follows:
import React, { Component } from 'react';import {  Dimensions,  Image,  Text,  ScrollView,  StyleSheet,  SafeAreaView,} from 'react-native';import PostContainer from './PostContainer';import PhotoViewer from './PhotoViewer';
  1. In this step, we'll define the data that we are going to render. It's just a simple array of objects containing title and image, as follows:
const image1 = require('./images/01.jpg');const image2 = require('./images/02.jpg');const image3 = require('./images/03.jpg');const image4 = require('./images/04.jpg');const timeline = [ ...

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.