This diff adds chat mention rule to markdown rules file. Raw chat mentions should be replaced with MarkdownChatMention component.
Depends on D8874.
Differential D8849
[native] Add chat mention rule to text message rules • patryk on Aug 17 2023, 6:50 AM. Authored by Tags None Referenced Files
Details This diff adds chat mention rule to markdown rules file. Raw chat mentions should be replaced with MarkdownChatMention component. Depends on D8874.
Diff Detail
Event Timeline
Comment Actions Just a suggestion inline (not blocking the diff). Only thing blocking is the CI issue - not not sure what's going on with the CI failure, looks like it's a problem with useTextMessageRulesFunc only having one being passed one argument but requiring two
Comment Actions Probably it failed because of D8873 previous diff -> I forgot to add messageKey argument. Comment Actions I think I misunderstood your feedback @rohan, did you mean that it's better to use styles inside a MarkdownChatMention component (use const styles = getMarkdownStyles(useDarkStyle ? 'dark' : 'light') inside the component and not passing styles as a prop)? Comment Actions Oh I personally just felt like there's no need to pass in the actual style object since it looks like you're just using bold. My suggestion was to handle the style in the component with an unboundStyles object like in most native components. Something like: function MarkdownChatMention(props: Props): React.Node { const { threadInfo, hasAccessToChat, ...rest } = props; const { shouldBePressable, onLongPressHandler } = useMarkdownOnPressUtils( !hasAccessToChat, ); const styles = useStyles(unboundStyles); return ( <Text onLongPress={shouldBePressable ? onLongPressHandler : null} style={styles.mention} {...rest} /> ); const unboundStyles = { mention: { fontWeight: 'bold', } } This would also make it easier if the styles for this component get more complicated down the line for some reason since they'd all be defined in an object in the component file. Though I see it's also a common pattern with some of the components in the file to just pass it in as a TextProp so I don't think it's too big of a deal and you could leave it as is Comment Actions Note that you don't need useStyles for something that doesn't use colors. In that case you could use StyleSheet.create directly Comment Actions Render Text component directly in markdown rules to avoid a bug where |