Collecting text input
Collecting text input seems like something that should be super easy to implement, even in React Native. It's easy, but there's a lot to think about when implementing text inputs. For example, should it have placeholder text? Is this sensitive data that shouldn't be displayed on screen? Should we process text as it's entered, or when the user moves to another field? The list goes on, and I only have so much room in this book.
What's markedly different about mobile text input versus traditional web text input is that the former has its own built-in virtual keyboard that we can configure and respond to. So without further delay, let's get coding. We'll render several instances of the <TextInput>
component:
import React, { Component, PropTypes } from 'react'; import { AppRegistry, Text, TextInput, View, } from 'react-native'; import { fromJS } from 'immutable'; import styles from ...