React-native-paper: Question/feature : control of textAlignVertical for TextInput (multiline)

Created on 13 Jan 2020  路  13Comments  路  Source: callstack/react-native-paper

Hi,
I'm currently working with react-native-paper for both classical TextInput and multiline TextInput.
Currently i have a style problem :
Capture d鈥檈虂cran 2020-01-13 a虁 13 29 21
Capture d鈥檈虂cran 2020-01-13 a虁 13 29 33

The distance between the label and the first line of TextInput value is different for multiline and !multiline TextInput.
This is due to the property textAlignVertical which is set as "top" for !multiline fields and "center" for multiline.
It is partially related to https://github.com/callstack/react-native-paper/pull/1020

Here is the code responsible of this behaviour : https://github.com/callstack/react-native-paper/blob/master/src/components/TextInput/TextInputFlat.tsx
Line 267

textAlignVertical: multiline ? 'top' : 'center',

(and of course same for TextInputOutlined
https://github.com/callstack/react-native-paper/blob/master/src/components/TextInput/TextInputOutlined.tsx

Is there a way to customize this style ?
It seems there is not a lot of style going that far from style props to TextInput, they are intercepted by the line76 in TextInputFlat

    const {
      fontSize: fontSizeStyle,
      fontWeight,
      height,
      paddingHorizontal,
      ...viewStyle
    } = (StyleSheet.flatten(style) || {}) as TextStyle;
Stale question

Most helpful comment

a fix by using native text input in the render prop https://github.com/callstack/react-native-paper/issues/1810#issuecomment-616817037

All 13 comments

Same problem here for me, I've already passed 1/2 day on it, with no way to make something clean.
It would be great to have more control on style with optional style props.

Any news for this ?
Do not hesitate if you need more informations.

I have the same problem, any news for it?

@firede Should i try to submit a PR for this ?

Hi, @amauryVedana
I'm just a contributor on this project, maybe you should ask the owners.

@firede Oh okay sorry^^
@satya164 ?

Still no response ?

Hi folks, I just opened #1824 which adds an ad-hoc fix for this issue ;)

Hi @Huxpro thanks for this, i'm watching out when this will be merged

Hello 馃憢, this issue has been open for more than 2 months with no activity on it. If the issue is still present in the latest version, please leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution on workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix the issue.

No information on this ?

a fix by using native text input in the render prop https://github.com/callstack/react-native-paper/issues/1810#issuecomment-616817037

@AwabIjaz thank you, it did the trick!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zachariahtimothy picture zachariahtimothy  路  3Comments

sritharanpalani picture sritharanpalani  路  4Comments

satya164 picture satya164  路  4Comments

tonyxiao picture tonyxiao  路  3Comments

mihaidaviddev picture mihaidaviddev  路  3Comments