@livelike/react-native
Version:
LiveLike React Native package
56 lines • 2.1 kB
JavaScript
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); }
import React from 'react';
import { StyleSheet, View } from 'react-native';
import { useStyles, useWidget, useWidgetInteractions } from '../../hooks';
import { LLWidgetActionInfo } from '../LLWidgetFooter';
import { LLTextAskWidgetSubmitButton } from './LLTextAskWidgetSubmitButton';
import { LLText } from '../LLText/LLText';
export function LLTextAskWidgetActionInfo(_ref) {
let {
widgetId,
styles: stylesProp,
ActionInfoComponent = LLWidgetActionInfo,
ActionInfoComponentStyles,
...props
} = _ref;
const styles = useStyles({
componentStylesFn: getTextAskWidgetActionInfoStyles,
stylesProp
});
const widget = useWidget({
widgetId
});
const widgetInteractions = useWidgetInteractions({
widgetId
});
const widgetInteraction = widgetInteractions === null || widgetInteractions === void 0 ? void 0 : widgetInteractions[0];
return /*#__PURE__*/React.createElement(View, {
style: styles.container
}, /*#__PURE__*/React.createElement(ActionInfoComponent, _extends({}, props, {
widgetId: widgetId,
SubmitButtonComponent: LLTextAskWidgetSubmitButton,
styles: ActionInfoComponentStyles
})), widgetInteraction && !!widget.confirmation_message && /*#__PURE__*/React.createElement(LLText, {
style: styles.confirmMessageText
}, widget.confirmation_message));
}
const getTextAskWidgetActionInfoStyles = _ref2 => {
let {
theme
} = _ref2;
return 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