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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.