Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update height for text container #19653

Merged
merged 5 commits into from
May 30, 2023
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
10 changes: 9 additions & 1 deletion src/components/MagicCodeInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {StyleSheet, View} from 'react-native';
import PropTypes from 'prop-types';
import _ from 'underscore';
import styles from '../styles/styles';
import * as StyleUtils from '../styles/StyleUtils';
import * as ValidationUtils from '../libs/ValidationUtils';
import CONST from '../CONST';
import Text from './Text';
Expand Down Expand Up @@ -293,7 +294,14 @@ function MagicCodeInput(props) {
key={index}
style={[styles.w15]}
>
<View style={[styles.textInputContainer, focusedIndex === index ? styles.borderColorFocus : {}, props.hasError || props.errorText ? styles.borderColorDanger : {}]}>
<View
style={[
styles.textInputContainer,
StyleUtils.getHeightOfMagicCodeInput(),
focusedIndex === index ? styles.borderColorFocus : {},
props.hasError || props.errorText ? styles.borderColorDanger : {},
]}
>
<Text style={[styles.magicCodeInput, styles.textAlignCenter]}>{decomposeString(props.value, props.maxLength)[index] || ''}</Text>
</View>
<View style={[StyleSheet.absoluteFillObject, styles.w100, isMobileSafari ? styles.bgTransparent : styles.opacity0]}>
Expand Down
10 changes: 10 additions & 0 deletions src/styles/StyleUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ function getAvatarSize(size) {
return avatarSizes[size];
}

/**
* Return the height of magic code input container
*
* @returns {Object}
*/
function getHeightOfMagicCodeInput() {
return {height: styles.magicCodeInputContainer.minHeight - styles.textInputContainer.borderBottomWidth};
}

/**
* Return the style from an empty avatar size constant
*
Expand Down Expand Up @@ -1202,4 +1211,5 @@ export {
getGoogleListViewStyle,
getMentionStyle,
getMentionTextColor,
getHeightOfMagicCodeInput,
};