Created
February 23, 2018 23:05
-
-
Save iwilsonq/5eb16fc25dd4cad54d559957851e5da1 to your computer and use it in GitHub Desktop.
This file contains 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 YelpService from './app/services/yelp' | |
export default App extends Component { | |
/* ... */ | |
getCoffeeShops = async () => { | |
const { latitude, longitude } = this.state.region; | |
const userLocation = { latitude, longitude }; | |
const coffeeShops = await YelpService.getCoffeeShops(userLocation); | |
this.setState({ coffeeShops }); | |
}; | |
getLocationAsync = async () => { | |
/* ... */ | |
// Add this line! | |
await this.getCoffeeShops(); | |
} | |
render() { | |
const { region, coffeeShops } = this.state; | |
return ( | |
<SafeAreaView style={styles.container}> | |
<Map region={region} places={coffeeShops} /> | |
</SafeAreaView> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment