Skip to main content

Chatroom Highlighter

Overview

The Highlighter component is designed to highlight specific text within a larger body of text. It takes in a string of text and a list of keywords, dynamically rendering the keywords in a highlighted format while keeping the surrounding text in a normal style. This is particularly useful for enhancing readability and drawing attention to important terms or phrases in chat or document contexts.

LMFeedMediaPreviewScreen

Customisation

The highlighter can be customised using the searchedHighlightedTextStyle and searchedNonHighlightedTextStyle

Props

PropertyTypeDescriptionRequired
autoEscapebooleanSpecifies whether to auto escape the text.
highlightStyleTextStyle[] or nullDefines the style to apply to highlighted text.
searchWordsstring[]An array of words to search and highlight in the text.✔️
textToHighlightstringThe text that will be highlighted.✔️
sanitizeFunctionA function to sanitize the text before highlighting.
styleTextStyle[] or nullSpecifies the style of the text.