Skip to content

Commit

Permalink
Merge pull request #5959 from AlfredoAlc/alfredo-fix-textinput-area
Browse files Browse the repository at this point in the history
(cherry picked from commit 04e2d12)
  • Loading branch information
roryabraham authored and OSBotify committed Oct 20, 2021
1 parent 211be07 commit 8d01a65
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/components/ExpensiTextInput/BaseExpensiTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,21 @@ class BaseExpensiTextInput extends Component {
]}
>
{hasLabel ? (
<ExpensiTextInputLabel
label={label}
labelTranslateX={
ignoreLabelTranslateX
? new Animated.Value(0)
: this.state.labelTranslateX
}
labelTranslateY={this.state.labelTranslateY}
labelScale={this.state.labelScale}
/>
<>
{/* Adding this background to the label only for multiline text input,
to prevent text overlaping with label when scrolling */}
{multiline && <View style={styles.expensiTextInputLabelBackground} />}
<ExpensiTextInputLabel
label={label}
labelTranslateX={
ignoreLabelTranslateX
? new Animated.Value(0)
: this.state.labelTranslateX
}
labelTranslateY={this.state.labelTranslateY}
labelScale={this.state.labelScale}
/>
</>
) : null}
<TextInput
ref={(ref) => {
Expand Down
11 changes: 11 additions & 0 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ const styles = {
justifyContent: 'center',
height: '100%',
backgroundColor: themeColors.componentBG,
overflow: 'hidden',
},
expensiTextInputLabel: {
position: 'absolute',
Expand All @@ -538,6 +539,15 @@ const styles = {
fontFamily: fontFamily.GTA,
width: '100%',
},
expensiTextInputLabelBackground: {
position: 'absolute',
top: 0,
width: '100%',
height: 25,
backgroundColor: themeColors.componentBG,
borderTopRightRadius: variables.componentBorderRadiusNormal,
borderTopLeftRadius: variables.componentBorderRadiusNormal,
},
expensiTextInputLabelDesktop: {
transformOrigin: 'left center',
},
Expand All @@ -557,6 +567,7 @@ const styles = {
paddingBottom: 8,
paddingHorizontal: 11.5,
borderRadius: variables.componentBorderRadiusNormal,
zIndex: -1,
},
expensiTextInputDesktop: addOutlineWidth({}, 0),
expensiTextInputAndroid: left => ({
Expand Down

0 comments on commit 8d01a65

Please sign in to comment.