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

7470 - added onLayout to textinput perent component & used dynamic he… #9294

Merged
4 changes: 4 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 getSecureEntryKeyboardType from '../../libs/getSecureEntryKeyboardType';

class BaseTextInput extends Component {
Expand All @@ -30,6 +31,7 @@ class BaseTextInput extends Component {
passwordHidden: props.secureTextEntry,
textInputWidth: 0,
prefixWidth: 0,
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 @@ -212,6 +214,7 @@ class BaseTextInput extends Component {
>
<TouchableWithoutFeedback onPress={this.onPress} focusable={false}>
<View
onLayout={event => this.setState({height: event.nativeEvent.layout.height})}
style={[
textInputContainerStyles,

Expand Down Expand Up @@ -264,6 +267,7 @@ class BaseTextInput extends Component {
!hasLabel && styles.pv0,
this.props.prefixCharacter && StyleUtils.getPaddingLeft(this.state.prefixWidth + styles.pl1.paddingLeft),
this.props.secureTextEntry && styles.secureInput,
{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 @@ -726,7 +726,6 @@ const styles = {
paddingBottom: 8,
paddingHorizontal: 11,
borderWidth: 0,
borderRadius: variables.componentBorderRadiusNormal,
},

textInputMultiline: {
Expand Down