UNPKG

@livelike/react-native

Version:

LiveLike React Native package

65 lines (64 loc) 1.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LLAlertWidgetBody = LLAlertWidgetBody; var _react = _interopRequireDefault(require("react")); var _reactNative = require("react-native"); var _hooks = require("../../hooks"); var _LLAlertWidgetDetail = require("./LLAlertWidgetDetail"); var _LLAlertWidgetLink = require("./LLAlertWidgetLink"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function LLAlertWidgetBody(_ref) { let { widgetId, onLinkPress, DetailComponent = _LLAlertWidgetDetail.LLAlertWidgetDetail, LinkComponent = _LLAlertWidgetLink.LLAlertWidgetLink, DetailComponentStyles, LinkComponentStyles, styles: stylesProp } = _ref; const styles = (0, _hooks.useStyles)({ componentStylesFn: getAlertWidgetBodyStyles, stylesProp }); const widget = (0, _hooks.useWidget)({ widgetId }); if (!widget) { return undefined; } const { text, image_url, link_label, link_url } = widget; return /*#__PURE__*/_react.default.createElement(_reactNative.View, { style: styles.container }, /*#__PURE__*/_react.default.createElement(DetailComponent, { text: text, imageUrl: image_url, styles: DetailComponentStyles }), !!link_label && !!link_url && /*#__PURE__*/_react.default.createElement(LinkComponent, { label: link_label, url: link_url, onLinkPress: onLinkPress, styles: LinkComponentStyles })); } const getAlertWidgetBodyStyles = _ref2 => { let { theme } = _ref2; return _reactNative.StyleSheet.create({ container: { display: 'flex', flexDirection: 'column', marginBottom: 16, paddingHorizontal: 16 } }); }; //# sourceMappingURL=LLAlertWidgetBody.js.map