Guest User

Untitled

a guest
Mar 6th, 2020
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { PureComponent } from 'react';
  2. import { withNavigation } from 'react-navigation';
  3. import { View, Alert, Text, StyleSheet, TouchableOpacity } from 'react-native';
  4.  
  5. class LocationItem extends React.Component {
  6.   constructor(props) {
  7.     super(props)
  8.     this.state = {status: 'initial'}
  9.     this._handlePress = this._handlePress.bind(this);
  10.     this.navigateNow = this.navigateNow.bind(this);
  11.     //this.changeState = this.changeState.bind(this)
  12.   }
  13.  
  14.   _handlePress = async ({navigation}) => {
  15.     //const { navigation } = this.props;
  16.     const { setFieldGrupo, setFieldPartida, fetchDetails, onPress, isPartida, isSearching } = this.props;
  17.     const res = await this.props.fetchDetails(this.props.place_id)
  18.     console.log('result', res.geometry.location.lat)
  19.     //const { navigation } = this.props;
  20.     this.props.navigation.navigate("Home", {selectedLocation: res.geometry.location});
  21.     //this.navigateNow(res);
  22.    
  23.   }
  24.   navigateNow = res => e =>{
  25.     console.log("Resolution", res);
  26.     this.props.navigate("Home", {selectedLocation: res.geometry.location});
  27.   }
  28.   render() {
  29.     return (
  30.       <TouchableOpacity style={styles.root} onPress={this._handlePress}>
  31.         <Text>{this.props.description}</Text>
  32.       </TouchableOpacity>
  33.     );
  34.   }
  35. }
  36.  
  37. const styles = StyleSheet.create({
  38.   root: {
  39.     height: 40,
  40.     borderBottomWidth: StyleSheet.hairlineWidth,
  41.     justifyContent: 'center'
  42.   }
  43. })
  44.  
  45. export default LocationItem;
Add Comment
Please, Sign In to add comment