Created
September 26, 2018 21:21
-
-
Save jpgarcia/fac9471bbeec212a96346ee454ca15d7 to your computer and use it in GitHub Desktop.
Prueba integración de react-native-facebook-account-kit
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 { StyleSheet, View, Button } from 'react-native' | |
import RNAccountKit from 'react-native-facebook-account-kit' | |
export default class App extends Component { | |
componentDidMount() { | |
RNAccountKit.configure({ | |
responseType: 'code', | |
initialPhoneCountryPrefix: '+54', | |
defaultCountry: 'AR', | |
}) | |
} | |
handleLoginButtonPress = async () => { | |
try { | |
const payload = await RNAccountKit.loginWithPhone() | |
if (!payload) { | |
console.warn('Login cancelled', payload) | |
} else { | |
console.warn('Logged with phone. Payload:', payload) | |
} | |
} catch (err) { | |
console.warn('Error', err.message) | |
} | |
} | |
render() { | |
return ( | |
<View style={styles.container}> | |
<Button title="Login" onPress={this.handleLoginButtonPress} /> | |
</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