react-native-fbsdk-next
Version:
Facebook SDK support for React Native apps.
68 lines (67 loc) • 3.56 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
* copy, modify, and distribute this software in source code or binary form for use
* in connection with the web services and APIs provided by Facebook.
*
* As with any software that integrates with the Facebook platform, your use of
* this software is subject to the Facebook Developer Principles and Policies
* [http://developers.facebook.com/policy/]. This copyright notice shall be
* included in all copies or substantial portions of the software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @format
*/
/**
* A button that initiates a log in or log out flow upon tapping.
*/
class LoginButton extends React.Component {
_eventHandler(event) {
if (typeof event !== 'object' || !event || !event.nativeEvent) {
return;
}
const eventDict = event.nativeEvent;
if (eventDict.type === 'loginFinished') {
if (this.props.onLoginFinished) {
this.props.onLoginFinished(eventDict.error, eventDict.result);
}
} else if (eventDict.type === 'logoutFinished') {
if (this.props.onLogoutFinished) {
this.props.onLogoutFinished();
}
}
}
render() {
return /*#__PURE__*/React.createElement(RCTFBLoginButton, _extends({}, this.props, {
onChange: this._eventHandler.bind(this)
}));
}
}
const styles = _reactNative.StyleSheet.create({
defaultButtonStyle: {
height: 30,
width: 190
}
});
LoginButton.defaultProps = {
style: styles.defaultButtonStyle
};
const RCTFBLoginButton = (0, _reactNative.requireNativeComponent)('RCTFBLoginButton');
var _default = exports.default = LoginButton;
//# sourceMappingURL=FBLoginButton.js.map