- Registration screens stubbing and partial buildouts
This commit is contained in:
41
app/components/FacebookLogin/FacebookLogin.js
Normal file
41
app/components/FacebookLogin/FacebookLogin.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { View } from 'react-native';
|
||||
import { LoginButton } from 'react-native-fbsdk';
|
||||
|
||||
import { PERMISSIONS } from '../../constants/constants.js';
|
||||
|
||||
export default function FacebookLogin({
|
||||
doCancelAction,
|
||||
doErrorAction,
|
||||
doLogoutAction,
|
||||
doSuccessAction,
|
||||
}) {
|
||||
|
||||
return (
|
||||
<View>
|
||||
<LoginButton
|
||||
publishPermissions={PERMISSIONS.FACEBOOK}
|
||||
onLoginFinished={
|
||||
(error, result) => {
|
||||
if (error) {
|
||||
doErrorAction(error);
|
||||
} else if (result.isCancelled) {
|
||||
doCancelAction();
|
||||
} else {
|
||||
doSuccessAction(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
onLogoutFinished={doLogoutAction}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
FacebookLogin.propTypes = {
|
||||
doCancelAction: PropTypes.func.isRequired,
|
||||
doErrorAction: PropTypes.func.isRequired,
|
||||
doLogoutAction: PropTypes.func.isRequired,
|
||||
doSuccessAction: PropTypes.func.isRequired,
|
||||
};
|
||||
Reference in New Issue
Block a user