Home > Software design >  How do I vertically align text in text input at React Native?
How do I vertically align text in text input at React Native?

Time:11-26

I am new to React Native. Text in text input looks different on android and iOS. How do I vertically align text in text input?

My codes:

import React from "react"
import { TextInput } from "react-native"


export default function Signup() {

    return (
        <TextInput
            style={{ backgroundColor: 'red', height: 30, textAlignVertical: 'top' }}
        />
    )
}
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

Pictures:

enter image description here

CodePudding user response:

textAlignVertical is Android only.

Looks you problem may be solved with paddingBottom: <number>, or try setting lineHeight equal to fontSize.

  • Related