Created
December 29, 2018 05:34
-
-
Save radinreth/8982a2c24cecb36b3e047c869f4ff9a3 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 React, {Component} from 'react'; | |
import {Platform, StyleSheet, Text, View} from 'react-native'; | |
import { LoginButton, AccessToken } from 'react-native-fbsdk'; | |
const instructions = Platform.select({ | |
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu', | |
android: | |
'Double tap R on your keyboard to reload,\n' + | |
'Shake or press menu button for dev menu', | |
}); | |
export default class App extends Component { | |
render() { | |
return ( | |
<View style={styles.container}> | |
<LoginButton | |
onLoginFinished={ | |
(error, result) => { | |
if (error) { | |
console.log("login has error: " + result.error); | |
} else if (result.isCancelled) { | |
console.log("login is cancelled."); | |
} else { | |
AccessToken.getCurrentAccessToken().then( | |
(data) => { | |
console.log(data.accessToken.toString()) | |
} | |
) | |
} | |
} | |
} | |
onLogoutFinished={() => console.log("logout.")}/> | |
</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, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment