Skip to content

Commit

Permalink
Merge pull request #10455 from jayeshmangwani/white_gap_input_autofill
Browse files Browse the repository at this point in the history
added onLayout to textinput perent component & used dynamic height in…
  • Loading branch information
stitesExpensify authored Sep 7, 2022
2 parents 85172f7 + 0fc7250 commit b1625ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/components/TextInput/BaseTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import * as Expensicons from '../Icon/Expensicons';
import Text from '../Text';
import * as styleConst from './styleConst';
import * as StyleUtils from '../../styles/StyleUtils';
import variables from '../../styles/variables';
import Checkbox from '../Checkbox';
import getSecureEntryKeyboardType from '../../libs/getSecureEntryKeyboardType';
import CONST from '../../CONST';
Expand All @@ -33,6 +34,7 @@ class BaseTextInput extends Component {
textInputWidth: 0,
prefixWidth: 0,
selection: props.selection,
height: variables.componentSizeLarge,

// Value should be kept in state for the autoGrow feature to work - https://github.com/Expensify/App/pull/8232#issuecomment-1077282006
value,
Expand Down Expand Up @@ -217,6 +219,9 @@ class BaseTextInput extends Component {
>
<TouchableWithoutFeedback onPress={this.onPress} focusable={false}>
<View

// When multiline is not supplied, calculating textinput height using onLayout
onLayout={event => !this.props.multiline && this.setState({height: event.nativeEvent.layout.height})}
style={[
textInputContainerStyles,

Expand Down Expand Up @@ -268,6 +273,7 @@ class BaseTextInput extends Component {
!hasLabel && styles.pv0,
this.props.prefixCharacter && StyleUtils.getPaddingLeft(this.state.prefixWidth + styles.pl1.paddingLeft),
this.props.secureTextEntry && styles.secureInput,
!this.props.multiline && {height: this.state.height},
]}
multiline={this.props.multiline}
maxLength={this.props.maxLength}
Expand Down
1 change: 0 additions & 1 deletion src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,6 @@ const styles = {
paddingBottom: 8,
paddingHorizontal: 11,
borderWidth: 0,
borderRadius: variables.componentBorderRadiusNormal,
},

textInputMultiline: {
Expand Down

0 comments on commit b1625ec

Please sign in to comment.