How to do it...

  1. Let's start by opening App.js and adding our imports. The imports include the UserForm component that we'll be building out in a later step:
import React from 'react';import { Alert, StyleSheet, ScrollView, SafeAreaView, Text, TextInput,} from 'react-native';import UserForm from './UserForm';
  1. Since this component is going to be very simple, we are going to create a stateless component for our App. We will only render a top toolbar inside a ScrollView for the UserForm component:
const App = () => (  <SafeAreaView style={styles.main}>    <Text style={styles.toolbar}>Fitness App</Text>    <ScrollView style={styles.content}>      <UserForm />    </ScrollView>  </SafeAreaView>);
const styles = StyleSheet.create({ // Defined in a later step ...

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.