I am using the react-native-highlight-words package to highlight the matching search result, when I encounter words with apostrophe eg: l’areal, mommy’s etc, these are not getting highlighted. words with other special characters are getting highlighted.
type here<Highlighter
style={styles.searchResultTxt}
highlightStyle={styles.highlightedStyle}
searchWords={[searchParam, 'Doctor', "'"]}
textToHighlight={renderDisplayText(data)}
ellipsizeMode={'tail'}
numberOfLines={1}
autoEscape={true}
/>
const renderDisplayText = item => {
let txtDisplay = item?.title || '';
if (item?.subTitle !== null && item.subTitle !== '') {
txtDisplay += ' in ' + item.subTitle;
}
return txtDisplay;
};
I tried adding apostrophe in the searchWords array, but it is highlighting only the apostrophe.
Couldn’t find enough resources to find a similar issue. Can someone help me find a fix to highlight words with apostrophe?
sankeerthan-v-r is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.