@sendbird/uikit-react-native
Version:
Sendbird UIKit for React Native: A feature-rich and customizable chat UI kit with messaging, channel management, and user authentication.
54 lines • 2.28 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 { Text, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
import { RegexText, createStyleSheet } from '@sendbird/uikit-react-native-foundation';
import { urlRegexStrict } from '@sendbird/uikit-utils';
const ThreadParentMessageUser = props => {
var _props$renderRegexTex;
const userMessage = props.parentMessage;
if (!userMessage) return null;
const {
colors
} = useUIKitTheme();
return /*#__PURE__*/React.createElement(Text, {
body3: true,
color: colors.onBackground01,
suppressHighlighting: true
}, /*#__PURE__*/React.createElement(RegexText, {
body3: true,
color: colors.onBackground01,
patterns: [...(props.regexTextPatterns ?? []), {
regex: urlRegexStrict,
replacer(_ref) {
let {
match,
parentProps,
keyPrefix,
index
} = _ref;
return /*#__PURE__*/React.createElement(Text, _extends({}, parentProps, {
key: `${keyPrefix}-${index}`,
onPress: () => {
var _props$onPressURL;
return (_props$onPressURL = props.onPressURL) === null || _props$onPressURL === void 0 ? void 0 : _props$onPressURL.call(props, match);
},
style: [parentProps === null || parentProps === void 0 ? void 0 : parentProps.style, styles.urlText]
}), match);
}
}]
}, (_props$renderRegexTex = props.renderRegexTextChildren) === null || _props$renderRegexTex === void 0 ? void 0 : _props$renderRegexTex.call(props, userMessage)), Boolean(userMessage.updatedAt) && /*#__PURE__*/React.createElement(Text, {
body3: true,
color: colors.onBackground02
}, ' (edited)'));
};
const styles = createStyleSheet({
bubble: {
paddingHorizontal: 12,
paddingVertical: 6
},
urlText: {
textDecorationLine: 'underline'
}
});
export default ThreadParentMessageUser;
//# sourceMappingURL=ThreadParentMessage.user.js.map