Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
React Native Blueprints

You're reading from   React Native Blueprints Create eight exciting native cross-platform mobile applications with JavaScript

Arrow left icon
Product type Paperback
Published in Nov 2017
Publisher Packt
ISBN-13 9781787288096
Length 346 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
 Martinez Martinez
Author Profile Icon Martinez
Martinez
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Title Page
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
1. Shopping List FREE CHAPTER 2. RSS Reader 3. Car Booking App 4. Image Sharing App 5. Guitar Tuner 6. Messaging App 7. Game 8. E-Commerce App

Building the FeedDetail screen


Let's recap what happened when the user tapped on one feed on the FeedsList screen:

 

_handleFeedPress(feed) {
  selectFeed(feed);
  this.props.navigation.navigate('FeedDetail', { feedUrl: feed.url });
}

The navigate method was called on the navigation property to open the FeedDetail screen. As a parameter, the _handleFeedPress function passed feedUrl, so it can retrieve the feed data and display it to the user. This is a necessary step since the data we have in our store for the selected feed can be obsolete. So, it's better to re-fetch that data before showing it to the user so we are sure it's 100% updated. We could also do a more complex check instead of retrieving the whole feed every time the user selects a feed, but we will stay with the given approach in order to keep simplicity in this app.

Let's start by retrieving the updated list of entries in the componentWillMount method:

 

/*** src/screens/FeedDetail.js ***/

import React from 'react';
import { observer...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images