Skip to content

Instantly share code, notes, and snippets.

@auser
Created January 13, 2017 06:54
Show Gist options
  • Save auser/b5793733426c74a4d1ef71556370f103 to your computer and use it in GitHub Desktop.
Save auser/b5793733426c74a4d1ef71556370f103 to your computer and use it in GitHub Desktop.
/**
* 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