Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/components/InlineCodeBlock/WrappedText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ function getTextMatrix(text: string): string[][] {
return text.split('\n').map((row) => row.split(CONST.REGEX.SPACE_OR_EMOJI).filter((value) => value !== ''));
}

/**
* Validates if the text contains any emoji
*/
function containsEmoji(text: string): boolean {
return CONST.REGEX.EMOJI.test(text);
}

function WrappedText({children, wordStyles, textStyles}: WrappedTextProps) {
const styles = useThemeStyles();

Expand All @@ -53,7 +60,7 @@ function WrappedText({children, wordStyles, textStyles}: WrappedTextProps) {
style={styles.codeWordWrapper}
>
<View style={[wordStyles, colIndex === 0 && styles.codeFirstWordStyle, colIndex === rowText.length - 1 && styles.codeLastWordStyle]}>
<Text style={textStyles}>{colText}</Text>
<Text style={[textStyles, !containsEmoji(colText) && styles.codePlainTextStyle]}>{colText}</Text>
</View>
</View>
))}
Expand Down
4 changes: 4 additions & 0 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2762,6 +2762,10 @@ const styles = (theme: ThemeColors) =>
paddingRight: 5,
},

codePlainTextStyle: {
...codeStyles.codePlainTextStyle,
},

fullScreenLoading: {
backgroundColor: theme.componentBG,
opacity: 0.8,
Expand Down
6 changes: 5 additions & 1 deletion src/styles/utils/codeStyles/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ const codeTextStyle: CodeTextStyles = {
lineHeight: 15,
};

export default {codeWordWrapper, codeWordStyle, codeTextStyle};
const codePlainTextStyle: CodeTextStyles = {
lineHeight: 14.5,
};

export default {codeWordWrapper, codeWordStyle, codeTextStyle, codePlainTextStyle};
6 changes: 5 additions & 1 deletion src/styles/utils/codeStyles/index.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ const codeTextStyle: CodeTextStyles = {
lineHeight: 18,
};

export default {codeWordWrapper, codeWordStyle, codeTextStyle};
const codePlainTextStyle: CodeTextStyles = {
lineHeight: 15,
};

export default {codeWordWrapper, codeWordStyle, codeTextStyle, codePlainTextStyle};
3 changes: 2 additions & 1 deletion src/styles/utils/codeStyles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ import {CodeTextStyles, CodeWordStyles, CodeWordWrapperStyles} from './types';
const codeWordWrapper: CodeWordWrapperStyles = {};
const codeWordStyle: CodeWordStyles = {};
const codeTextStyle: CodeTextStyles = {};
export default {codeWordWrapper, codeWordStyle, codeTextStyle};
const codePlainTextStyle: CodeTextStyles = {};
export default {codeWordWrapper, codeWordStyle, codeTextStyle, codePlainTextStyle};