简体   繁体   中英

How do I vertically align text in text input at React Native?

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' }} /> ) }

Pictures:

在此处输入图像描述

textAlignVertical is Android only.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM