Skip to content

Commit

Permalink
Merge pull request Expensify#41027 from software-mansion-labs/@robert…
Browse files Browse the repository at this point in the history
…Kozik/emoji-line-height-fix

Change line height based on composer emoji value
  • Loading branch information
nkuoch authored Apr 30, 2024
2 parents 2a1c2cb + 4e8fd36 commit b62bbbb
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import willBlurTextInputOnTapOutsideFunc from '@libs/willBlurTextInputOnTapOutsi
import type {ComposerRef, SuggestionsRef} from '@pages/home/report/ReportActionCompose/ReportActionCompose';
import SilentCommentUpdater from '@pages/home/report/ReportActionCompose/SilentCommentUpdater';
import Suggestions from '@pages/home/report/ReportActionCompose/Suggestions';
import variables from '@styles/variables';
import * as EmojiPickerActions from '@userActions/EmojiPickerAction';
import * as InputFocus from '@userActions/InputFocus';
import * as Report from '@userActions/Report';
Expand Down Expand Up @@ -713,6 +714,11 @@ function ComposerWithSuggestions(
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const isOnlyEmojiLineHeight = useMemo(() => {
const isOnlyEmoji = EmojiUtils.containsOnlyEmojis(value);
return isOnlyEmoji ? {lineHeight: variables.fontSizeOnlyEmojisHeight} : {};
}, [value]);

return (
<>
<View style={[StyleUtils.getContainerComposeStyles(), styles.textInputComposeBorder]}>
Expand All @@ -726,7 +732,7 @@ function ComposerWithSuggestions(
onChangeText={onChangeText}
onKeyPress={triggerHotkeyActions}
textAlignVertical="top"
style={[styles.textInputCompose, isComposerFullSize ? styles.textInputFullCompose : styles.textInputCollapseCompose]}
style={[styles.textInputCompose, isComposerFullSize ? styles.textInputFullCompose : styles.textInputCollapseCompose, isOnlyEmojiLineHeight]}
maxLines={maxComposerLines}
onFocus={onFocus}
onBlur={onBlur}
Expand Down

0 comments on commit b62bbbb

Please sign in to comment.