Created
August 31, 2016 19:17
-
-
Save yogieputra8/3558791ba2ab50bf71e7839eb3677a7e 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 { | |
Text, | |
View, | |
StyleSheet, | |
} from 'react-native'; | |
const API_KEY = 'Your-personal-OAuth-token'; | |
const ROOT_URL = 'https://www.eventbriteapi.com/v3/events/search/'; | |
module.exports = React.createClass({ | |
componentDidMount(){ | |
this.searchEvents('hackathon', 'San Fransisco'); | |
}, | |
searchEvents(category, city){ | |
const FETCH_URL = ROOT_URL + '?token=' + API_KEY + '&q=' + category + '&location.address=' + city + '/'; | |
return fetch(FETCH_URL, { | |
method: 'GET' | |
}) | |
.then((response) => response.json()) | |
.then((responseJSON) => { | |
console.log('responseJSON', responseJSON); | |
}) | |
.catch((error) => { | |
console.error(error); | |
}); | |
}, | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Text> | |
Event Expert | |
</Text> | |
</View> | |
) | |
} | |
}) | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center' | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment