How to create a form component

Every application requires a way to input data, whether it's a simple registration and login form or a more complex component with many input fields and controls.

In this recipe, we will create a form component to handle text inputs. We will collect data using different keyboards and show an alert message with the resulting information.

Getting ready

We need to create an empty app using the React Native CLI, and we will name it FormComponents.

How to do it...

  1. We will start by bootstrapping our app. Let's open the index.ios.js and files and add the following code:
            import React from 'react';        import MainApp from './src/MainApp';        import { AppRegistry } from 'react-native';        AppRegistry.registerComponent('FormComponents', ...

Get React Native Cookbook now with O’Reilly online learning.

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