LocationSearch

This should be a simple textbox displaying the human-readable name of the location in which the map is centered. Let's take a look at the code:

/*** src/components/LocationSearch.js ** */ import React from 'react'; import { View, Text, TextInput, ActivityIndicator, StyleSheet, } from 'react-native'; export default class LocationSearch extends React.Component { render() { return ( <View style={styles.container}> <Text style={styles.title}>PICKUP LOCATION</Text> {this.props.value && ( <TextInput style={styles.location} value={this.props.value} /> )} {!this.props.value && <ActivityIndicator style={styles.spinner} />} </View> ); } } const styles = StyleSheet.create({ container: { backgroundColor: 'white', margin: 20, marginTop: 40, height: ...

Get React: Cross-Platform Application Development with React Native 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.