Created
September 30, 2017 09:02
-
-
Save hanipcode/79c6d545d5ca586828604e29df87d832 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import { | |
| View, | |
| Text, | |
| FlatList, | |
| StyleSheet, | |
| TouchableHighlight | |
| } from 'react-native'; | |
| // .. rest of code | |
| class AutoCompleteResultList extends Component { | |
| // .. rest of code | |
| renderItem({ item }) { | |
| return ( | |
| <TouchableHighlight | |
| underlayColor="#dddddd" | |
| onPress={() => this._onItemClick(item.geometry)} | |
| > | |
| <View style={styles.AutoCompleteResultItem}> | |
| <Text style={styles.titleText}>{item.name}</Text> | |
| <Text style={styles.text}>{item.formatted_address}</Text> | |
| </View> | |
| </TouchableHighlight> | |
| ); | |
| } | |
| _onItemClick(geometry) { | |
| this.props.onItemClick(geometry); | |
| } | |
| // .. rest of code | |
| render() { | |
| return ( | |
| <View> | |
| {this.props.data.length > 0 && ( | |
| <FlatList | |
| {...this.props} | |
| contentContainerStyle={styles.AutoCompleteResultList} | |
| renderItem={itemValue => this.renderItem(itemValue)} | |
| /> | |
| )} | |
| </View> | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment