react-web-native-sketch
Version:
[TODO: We need an overview of how this can be used via npm vs as a local package]
40 lines • 1.69 kB
JavaScript
;
/**
* Created by alexbuicescu on 21 - Mar 2018.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var react_native_fbsdk_1 = require("react-native-fbsdk");
function fbComponentDidMount(props) {
}
exports.fbComponentDidMount = fbComponentDidMount;
function fbOnClick(props) {
// this is a hack because of
// https://github.com/joonhocho/react-native-google-sign-in/issues/33
// need to hide the modal and only open google login once hte modal is fully hidden
// hopefully users login so rarely that waiting a few millis on this won't be a big issue
// props.navigator && props.navigator.dismissModal();
// setTimeout(() => {
react_native_fbsdk_1.LoginManager.logInWithReadPermissions(['public_profile', 'email']).then(function (result) {
if (result.isCancelled) {
}
else {
react_native_fbsdk_1.AccessToken.getCurrentAccessToken().then(function (data) {
if (!data || !data.accessToken || !data.userID) {
alert('Login failed');
}
var socialLogin = props.socialLogin;
// let inviteCode = props.location && props.location.query.code;
socialLogin('url-here', 'post', 'facebook', data && data.accessToken && data.accessToken.toString(), data && data.userID && data.userID.toString(), null, null);
});
}
}, function (error) {
alert('Login failed with error: ' + error);
});
// }, 500);
}
exports.fbOnClick = fbOnClick;
function fbSignOut() {
react_native_fbsdk_1.LoginManager.logOut();
}
exports.fbSignOut = fbSignOut;
//# sourceMappingURL=utils.native.js.map