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

fix(suite-native): multiline input #10758

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions suite-native/atoms/src/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type InputLabelStyleProps = {

type InputStyleProps = {
isIconDisplayed: boolean;
isFocused: boolean;
};

const inputWrapperStyle = prepareNativeStyle<InputWrapperStyleProps>(
Expand Down Expand Up @@ -99,8 +100,11 @@ const inputWrapperStyle = prepareNativeStyle<InputWrapperStyleProps>(
}),
);

const inputStyle = prepareNativeStyle<InputStyleProps>((utils, { isIconDisplayed }) => ({
const inputStyle = prepareNativeStyle<InputStyleProps>((utils, { isIconDisplayed, isFocused }) => ({
...utils.typography.body,
// letterSpacing from `typography.body` is making strange layout jumps on Android while filling the input.
// This resets it to the default TextInput value.
letterSpacing: 0,
alignItems: 'center',
justifyContent: 'center',
minHeight: INPUT_TEXT_HEIGHT,
Expand All @@ -109,7 +113,7 @@ const inputStyle = prepareNativeStyle<InputStyleProps>((utils, { isIconDisplayed
borderWidth: 0,
flex: 1,
// Make the text input uniform on both platforms (https://stackoverflow.com/a/68458803/1281305)
paddingTop: 0,
paddingTop: isFocused ? utils.spacings.large : 0,
paddingBottom: utils.spacings.extraSmall,
}));

Expand Down Expand Up @@ -247,7 +251,7 @@ export const Input = forwardRef<TextInput, InputProps>(
<Box flexDirection="row" alignItems="center">
<TextInput
ref={ref}
style={applyStyle(inputStyle, { isIconDisplayed })}
style={applyStyle(inputStyle, { isIconDisplayed, isFocused })}
onFocus={handleOnFocus}
onBlur={handleOnBlur}
hitSlop={inputHitSlop}
Expand Down
Loading