Skip to content

Commit

Permalink
Fixed rendering of BaseTextInput using autoGrow
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin Stringer authored and neg-0 committed Sep 19, 2023
1 parent b294af5 commit f5eb835
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/TextInput/BaseTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,13 @@ function BaseTextInput(props) {
This Text component is intentionally positioned out of the screen.
*/}
{(props.autoGrow || props.autoGrowHeight) && (
// Add +32 to width so that text is not cut off due to the cursor or when changing the value
// https://github.com/Expensify/App/issues/8158
// https://github.com/Expensify/App/issues/26628
<Text
style={[...props.inputStyle, props.autoGrowHeight && styles.autoGrowHeightHiddenInput(width, maxHeight), styles.hiddenElementOutsideOfWindow, styles.visibilityHidden]}
onLayout={(e) => {
setTextInputWidth(e.nativeEvent.layout.width);
setTextInputWidth(e.nativeEvent.layout.width + 32);
setTextInputHeight(e.nativeEvent.layout.height);
}}
>
Expand Down
3 changes: 3 additions & 0 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2680,6 +2680,9 @@ const styles = (theme) => ({
fontSize: variables.iouAmountTextSize,
color: theme.heading,
lineHeight: variables.inputHeight,
// This margin counteracts the additional size given to the autoGrow text in BaseTextInput.js
// It fixes issue https://github.com/Expensify/App/issues/26628
marginLeft: 32
},

iouAmountTextInput: addOutlineWidth(
Expand Down

0 comments on commit f5eb835

Please sign in to comment.