UNPKG

@livelike/react-native

Version:

LiveLike React Native package

58 lines 1.46 kB
import React from 'react'; import { StyleSheet, View } from 'react-native'; import { useStyles, useWidget } from '../../hooks'; import { LLAlertWidgetDetail } from './LLAlertWidgetDetail'; import { LLAlertWidgetLink } from './LLAlertWidgetLink'; export function LLAlertWidgetBody(_ref) { let { widgetId, onLinkPress, DetailComponent = LLAlertWidgetDetail, LinkComponent = LLAlertWidgetLink, DetailComponentStyles, LinkComponentStyles, styles: stylesProp } = _ref; const styles = useStyles({ componentStylesFn: getAlertWidgetBodyStyles, stylesProp }); const widget = useWidget({ widgetId }); if (!widget) { return undefined; } const { text, image_url, link_label, link_url } = widget; return /*#__PURE__*/React.createElement(View, { style: styles.container }, /*#__PURE__*/React.createElement(DetailComponent, { text: text, imageUrl: image_url, styles: DetailComponentStyles }), !!link_label && !!link_url && /*#__PURE__*/React.createElement(LinkComponent, { label: link_label, url: link_url, onLinkPress: onLinkPress, styles: LinkComponentStyles })); } const getAlertWidgetBodyStyles = _ref2 => { let { theme } = _ref2; return StyleSheet.create({ container: { display: 'flex', flexDirection: 'column', marginBottom: 16, paddingHorizontal: 16 } }); }; //# sourceMappingURL=LLAlertWidgetBody.js.map