Skip to content

Instantly share code, notes, and snippets.

@jpgarcia
Created September 26, 2018 21:21
Show Gist options
  • Save jpgarcia/fac9471bbeec212a96346ee454ca15d7 to your computer and use it in GitHub Desktop.
Save jpgarcia/fac9471bbeec212a96346ee454ca15d7 to your computer and use it in GitHub Desktop.
Prueba integración de react-native-facebook-account-kit
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