From the course: Learning React Native
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Using RefreshControl
- So far, we broke ground on a new application using Expo Snack. This application loads information about a pet at random from the internet, and then renders that information on the screen. Right now our application is loading and displaying only one pet. In this lesson, we want to give our users the ability to refetch another pet. So let's get started. The first thing I'm going to do, is import an activity indicator to handle our latency a little bit better. So in the initial render, instead of rendering just no, I'm going to go ahead and render an activity indicator. So our users see a loading animation, which lets them know that we're requesting the initial data. Instead of using a button, we want users to be able to load another pet, simply by dragging the screen down. So I'm also going to include a component called refresh control. This component will indicate when we drag the screen down, and it will…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.