@livelike/react-native
Version:
LiveLike React Native package
49 lines • 1.22 kB
JavaScript
import React, { useCallback } from 'react';
import { StyleSheet, TouchableOpacity } from 'react-native';
import { useAnalytics, useStyles } from '../../hooks';
import { LLText } from '../LLText';
export function LLAlertWidgetLink(_ref) {
let {
label,
url,
onLinkPress,
styles: stylesProp
} = _ref;
const styles = useStyles({
componentStylesFn: getAlertWidgetLinkStyles,
stylesProp
});
const {
trackEvent
} = useAnalytics();
const handleLinkPress = useCallback(() => {
trackEvent('Alert Link Opened', {
url
});
onLinkPress === null || onLinkPress === void 0 || onLinkPress({
url
});
}, [url, trackEvent, onLinkPress]);
return /*#__PURE__*/React.createElement(TouchableOpacity, {
style: styles.container,
onPress: handleLinkPress
}, /*#__PURE__*/React.createElement(LLText, {
style: styles.text
}, label));
}
const getAlertWidgetLinkStyles = _ref2 => {
let {
theme
} = _ref2;
return StyleSheet.create({
container: {
marginTop: 10
},
text: {
fontSize: 12,
color: theme.primaryButtonBackground,
textDecorationLine: 'underline'
}
});
};
//# sourceMappingURL=LLAlertWidgetLink.js.map