Skip to content

[Android > TextInput]: Render Multiline Text at start instead of center? #13897

Closed
@joncursi

Description

@joncursi

If you assign a height style to TextInput, on iOS the placeholder & actual text will render at the start of the container. However on Android, the placeholder & text will render at the center.

Code:

<TextInput
  ...
  style={{ height: 100 }}
  ...
/>

Result:

screen_shot_2017-05-10_at_10_08_55_am

I'd like to get Android to render at the start, but applying flex / alignItems / justifyContent styles don't seem to have any effect.

Activity

fagerbua

fagerbua commented on May 11, 2017

@fagerbua

On Android, you need to set textAlignVertical: "top" in the style prop to TextInput. Not well documented.

joncursi

joncursi commented on May 11, 2017

@joncursi
ContributorAuthor

Thank you @fagerbua !

pandiaraj44

pandiaraj44 commented on Jul 31, 2017

@pandiaraj44
Contributor

Thanks, @fagerbua,

I have tried with align-items, justify-content and text align but nothing worked. After adding textAlignVertical: "top", It's worked.

Really, Awesome.

luck2011

luck2011 commented on Sep 29, 2017

@luck2011

Thanks! Saved my day @fagerbua

yanhaijing

yanhaijing commented on Oct 13, 2017

@yanhaijing

thanks

iamtekeste

iamtekeste commented on Oct 20, 2017

@iamtekeste

Thanks @fagerbua !!! I spent almost half a day trying to figure it out!

fagerbua

fagerbua commented on Oct 25, 2017

@fagerbua

Issue closed, but should the default behavior on Android and iOS differ like this? If not, perhaps this should be re-opened as a bug report?

mattyclarkson

mattyclarkson commented on May 17, 2018

@mattyclarkson

It's also really annoying that you cannot do the opposite on iOS, i.e put textAlignVertical: 'center' and get the Android behaviour. It's supported by the native widget

locked as resolved and limited conversation to collaborators on May 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @luck2011@mattyclarkson@iamtekeste@fagerbua@yanhaijing

        Issue actions

          [Android > TextInput]: Render Multiline Text at start instead of center? · Issue #13897 · facebook/react-native