Skip to content

Commit

Permalink
Merge pull request #23054 from ahmdshrif/fix/input-flickers
Browse files Browse the repository at this point in the history
 fix: text below the input flickers in ios.
  • Loading branch information
roryabraham authored Jul 20, 2023
2 parents d34fffa + 6c3ad47 commit 391c412
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/components/TextInput/BaseTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,11 @@ function BaseTextInput(props) {
onPress={onPress}
focusable={false}
accessibilityLabel={props.label}
style={[props.autoGrowHeight && styles.autoGrowHeightInputContainer(textInputHeight, maxHeight), !isMultiline && styles.componentHeightLarge, ...props.containerStyles]}
style={[
props.autoGrowHeight && styles.autoGrowHeightInputContainer(textInputHeight, variables.componentSizeLarge, maxHeight),
!isMultiline && styles.componentHeightLarge,
...props.containerStyles,
]}
>
<View
// When autoGrowHeight is true we calculate the width for the textInput, so it will break lines properly
Expand Down
13 changes: 10 additions & 3 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {defaultStyles as defaultPickerStyles} from 'react-native-picker-select/src/styles';
import lodashClamp from 'lodash/clamp';
import fontFamily from './fontFamily';
import addOutlineWidth from './addOutlineWidth';
import themeColors from './themes/default';
Expand Down Expand Up @@ -855,9 +856,15 @@ const styles = {
backgroundColor: themeColors.buttonDefaultBG,
},

autoGrowHeightInputContainer: (textInputHeight, maxHeight) => ({
height: textInputHeight >= maxHeight ? maxHeight : textInputHeight,
minHeight: variables.componentSizeLarge,
/**
* @param {number} textInputHeight
* @param {number} minHeight
* @param {number} maxHeight
* @returns {object}
*/
autoGrowHeightInputContainer: (textInputHeight, minHeight, maxHeight) => ({
height: lodashClamp(textInputHeight, minHeight, maxHeight),
minHeight,
}),

autoGrowHeightHiddenInput: (maxWidth, maxHeight) => ({
Expand Down

0 comments on commit 391c412

Please sign in to comment.