Skip to content

Commit

Permalink
Merge pull request #18635 from Ollyws/fix3-17202
Browse files Browse the repository at this point in the history
Further changes for #17202
  • Loading branch information
techievivek authored May 11, 2023
2 parents 1ee8cf8 + ec40e8e commit 2fca384
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/TextInput/BaseTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,12 @@ class BaseTextInput extends Component {
{(this.props.autoGrow || this.props.autoGrowHeight) && (
// Add +2 to width so that the first digit of amount do not cut off on mWeb - https://github.com/Expensify/App/issues/8158.
<Text
style={[...this.props.inputStyle, this.props.autoGrowHeight ? {maxWidth: this.state.width} : {}, styles.hiddenElementOutsideOfWindow, styles.visibilityHidden]}
style={[
...this.props.inputStyle,
this.props.autoGrowHeight && styles.autoGrowHeightHiddenInput(this.state.width, maxHeight),
styles.hiddenElementOutsideOfWindow,
styles.visibilityHidden,
]}
onLayout={(e) => this.setState({textInputWidth: e.nativeEvent.layout.width + 2, textInputHeight: e.nativeEvent.layout.height})}
>
{this.state.value || this.props.placeholder}
Expand Down
6 changes: 6 additions & 0 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,12 @@ const styles = {
minHeight: variables.componentSizeLarge,
}),

autoGrowHeightHiddenInput: (maxWidth, maxHeight) => ({
maxWidth,
maxHeight: maxHeight && maxHeight + 1,
overflow: 'hidden',
}),

textInputContainer: {
flex: 1,
justifyContent: 'center',
Expand Down

0 comments on commit 2fca384

Please sign in to comment.