UNPKG

@livelike/react-native

Version:

LiveLike React Native package

63 lines (62 loc) 2.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LLTextAskWidgetActionInfo = LLTextAskWidgetActionInfo; var _react = _interopRequireDefault(require("react")); var _reactNative = require("react-native"); var _hooks = require("../../hooks"); var _LLWidgetFooter = require("../LLWidgetFooter"); var _LLTextAskWidgetSubmitButton = require("./LLTextAskWidgetSubmitButton"); var _LLText = require("../LLText/LLText"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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); } function LLTextAskWidgetActionInfo(_ref) { let { widgetId, styles: stylesProp, ActionInfoComponent = _LLWidgetFooter.LLWidgetActionInfo, ActionInfoComponentStyles, ...props } = _ref; const styles = (0, _hooks.useStyles)({ componentStylesFn: getTextAskWidgetActionInfoStyles, stylesProp }); const widget = (0, _hooks.useWidget)({ widgetId }); const widgetInteractions = (0, _hooks.useWidgetInteractions)({ widgetId }); const widgetInteraction = widgetInteractions === null || widgetInteractions === void 0 ? void 0 : widgetInteractions[0]; return /*#__PURE__*/_react.default.createElement(_reactNative.View, { style: styles.container }, /*#__PURE__*/_react.default.createElement(ActionInfoComponent, _extends({}, props, { widgetId: widgetId, SubmitButtonComponent: _LLTextAskWidgetSubmitButton.LLTextAskWidgetSubmitButton, styles: ActionInfoComponentStyles })), widgetInteraction && !!widget.confirmation_message && /*#__PURE__*/_react.default.createElement(_LLText.LLText, { style: styles.confirmMessageText }, widget.confirmation_message)); } const getTextAskWidgetActionInfoStyles = _ref2 => { let { theme } = _ref2; return _reactNative.StyleSheet.create({ container: { display: 'flex', flexDirection: 'column', justifyContent: 'flex-start' }, confirmMessageText: { paddingLeft: 16, fontSize: 12, lineHeight: 12, marginBottom: 8, color: theme.text } }); }; //# sourceMappingURL=LLTextAskWidgetActionInfo.js.map