From 0208efeeadafbb86b9b372ec32facc571be42f19 Mon Sep 17 00:00:00 2001 From: kbieganowski Date: Thu, 16 May 2024 14:05:49 +0200 Subject: [PATCH] rebase wip --- src/components/Composer/index.native.tsx | 3 ++- src/components/InlineCodeBlock/WrappedText.tsx | 3 ++- src/components/TextInput/BaseTextInput/index.tsx | 2 +- src/hooks/useMarkdownStyle.ts | 6 +++--- src/libs/EmojiUtils.ts | 6 ++++-- src/libs/ValidationUtils.ts | 7 +++++-- .../home/report/comment/TextWithEmojiFragment.tsx | 14 +++++++++++--- src/styles/variables.ts | 3 +++ 8 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/components/Composer/index.native.tsx b/src/components/Composer/index.native.tsx index 22255e5ce92c..b1a60e7ec201 100644 --- a/src/components/Composer/index.native.tsx +++ b/src/components/Composer/index.native.tsx @@ -11,6 +11,7 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import updateIsFullComposerAvailable from '@libs/ComposerUtils/updateIsFullComposerAvailable'; import {containsOnlyEmojis} from '@libs/EmojiUtils'; +import variables from '@styles/variables'; import type {ComposerProps} from './types'; function Composer( @@ -68,7 +69,7 @@ function Composer( }, [shouldClear, onClear]); const maxHeightStyle = useMemo(() => StyleUtils.getComposerMaxHeightStyle(maxLines, isComposerFullSize), [StyleUtils, isComposerFullSize, maxLines]); - const composerStyle = useMemo(() => StyleSheet.flatten([style, textContainsOnlyEmojis ? {lineHeight: 32} : null]), [style, textContainsOnlyEmojis]); + const composerStyle = useMemo(() => StyleSheet.flatten([style, textContainsOnlyEmojis ? {lineHeight: variables.lineHeightEmojisOnlyComposer} : null]), [style, textContainsOnlyEmojis]); return ( = []): MarkdownStyle { +function useMarkdownStyle(inputContainsOnlyEmojis?: boolean, excludeStyles: Array = []): MarkdownStyle { const theme = useTheme(); // this map is used to reset the styles that are not needed - passing undefined value can break the native side @@ -32,7 +32,7 @@ function useMarkdownStyle(containsEmojisOnly?: boolean, excludeStyles: Array; + /** Additional styles to add after local styles. */ + passedStyles?: StyleProp; + /** Should this message fragment be styled as deleted? */ styleAsDeleted?: boolean; + /** Should this message fragment be styled as muted? */ styleAsMuted?: boolean; + /** Is message displayed on narrow screen? */ isSmallScreenWidth?: boolean; + /** Should "(edited)" suffix be rendered? */ isEdited?: boolean; + /** Does message contain only emojis? */ emojisOnly?: boolean; }; -function TextWithEmojiFragment({message, passedStyles, styleAsDeleted, styleAsMuted, isSmallScreenWidth, isEdited, emojisOnly}: ComponentProps) { + +function TextWithEmojiFragment({message, passedStyles, styleAsDeleted, styleAsMuted, isSmallScreenWidth, isEdited, emojisOnly}: TextWithEmojiFragmentProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); const theme = useTheme(); diff --git a/src/styles/variables.ts b/src/styles/variables.ts index 87581057a5c1..eb5747e8ad50 100644 --- a/src/styles/variables.ts +++ b/src/styles/variables.ts @@ -51,6 +51,7 @@ export default { fontSizeOnlyEmojis: 30, fontSizeOnlyEmojisHeight: 35, fontSizeEmojisWithinText: 19, + fontSizeEmojisOnlyComposer: 27, fontSizeSmall: getValueUsingPixelRatio(11, 17), fontSizeExtraSmall: 9, fontSizeLabel: getValueUsingPixelRatio(13, 19), @@ -115,6 +116,8 @@ export default { lineHeightSizeh2: getValueUsingPixelRatio(24, 28), lineHeightSignInHeroXSmall: getValueUsingPixelRatio(32, 37), lineHeightComment: 23, + lineHeightMarkdownEnabledInput: 18, + lineHeightEmojisOnlyComposer: 32, inputHeight: getValueUsingPixelRatio(52, 72), inputHeightSmall: 28, formErrorLineHeight: getValueUsingPixelRatio(18, 23),