Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { PureComponent } from 'react';
- import { withNavigation } from 'react-navigation';
- import { View, Alert, Text, StyleSheet, TouchableOpacity } from 'react-native';
- class LocationItem extends React.Component {
- constructor(props) {
- super(props)
- this.state = {status: 'initial'}
- this._handlePress = this._handlePress.bind(this);
- this.navigateNow = this.navigateNow.bind(this);
- //this.changeState = this.changeState.bind(this)
- }
- _handlePress = async ({navigation}) => {
- //const { navigation } = this.props;
- const { setFieldGrupo, setFieldPartida, fetchDetails, onPress, isPartida, isSearching } = this.props;
- const res = await this.props.fetchDetails(this.props.place_id)
- console.log('result', res.geometry.location.lat)
- //const { navigation } = this.props;
- this.props.navigation.navigate("Home", {selectedLocation: res.geometry.location});
- //this.navigateNow(res);
- }
- navigateNow = res => e =>{
- console.log("Resolution", res);
- this.props.navigate("Home", {selectedLocation: res.geometry.location});
- }
- render() {
- return (
- <TouchableOpacity style={styles.root} onPress={this._handlePress}>
- <Text>{this.props.description}</Text>
- </TouchableOpacity>
- );
- }
- }
- const styles = StyleSheet.create({
- root: {
- height: 40,
- borderBottomWidth: StyleSheet.hairlineWidth,
- justifyContent: 'center'
- }
- })
- export default LocationItem;
Add Comment
Please, Sign In to add comment