@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.
61 lines • 2.44 kB
JavaScript
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
import React from 'react';
import { Box, 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(Box, {
flex: 1,
alignItems: 'flex-start'
}, /*#__PURE__*/React.createElement(Text, {
body3: true,
color: colors.onBackground01,
suppressHighlighting: true,
supportRTLAlign: true,
originalText: userMessage.message
}, /*#__PURE__*/React.createElement(RegexText, {
body3: true,
suppressHighlighting: true,
supportRTLAlign: true,
originalText: userMessage.message,
color: colors.onBackground01,
patterns: [...(props.regexTextPatterns ?? []), {
regex: urlRegexStrict,
replacer({
match,
parentProps,
keyPrefix,
index
}) {
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