Created
January 13, 2017 06:54
-
-
Save auser/b5793733426c74a4d1ef71556370f103 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
/** | |
* Sample React Native App | |
* https://github.com/facebook/react-native | |
* @flow | |
*/ | |
import React, { Component } from 'react'; | |
import { | |
AppRegistry, | |
StyleSheet, | |
Text, | |
View, | |
Button | |
} from 'react-native'; | |
import OAuthManager from 'react-native-oauth'; | |
const manager = new OAuthManager('fruity'); | |
manager.configure({ | |
facebook: { | |
client_id: 'CLIENT_ID', | |
client_secret: 'CLIENT_SECRET' | |
}, | |
}); | |
export default class fruity extends Component { | |
login() { | |
manager.authorize('facebook') | |
.then(resp => { | |
console.log('resp ->', resp); | |
}); | |
} | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Text style={styles.welcome}> | |
Welcome to React Native! | |
</Text> | |
<Button title="Login with Facebook" onPress={this.login.bind(this)} /> | |
<Text style={styles.instructions}> | |
To get started, edit index.android.js | |
</Text> | |
<Text style={styles.instructions}> | |
Double tap R on your keyboard to reload,{'\n'} | |
Shake or press menu button for dev menu | |
</Text> | |
</View> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', | |
backgroundColor: '#F5FCFF', | |
}, | |
welcome: { | |
fontSize: 20, | |
textAlign: 'center', | |
margin: 10, | |
}, | |
instructions: { | |
textAlign: 'center', | |
color: '#333333', | |
marginBottom: 5, | |
}, | |
}); | |
AppRegistry.registerComponent('fruity', () => fruity); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment