我是React Native的新手。在文本输入框中,Android和iOS上的文本看起来不同。如何在文本输入框中垂直对齐文本?我的代码: import React from "react" import { TextInput } from "react-native" export default function Signup() { return ( <TextInput style={{ backgroundColor: 'red', height: 30, textAlignVertical: 'top' }} /> ) } 图片:
textAlignVertical 仅适用于 Android。 看起来您的问题可以通过设置 paddingBottom: <number> 来解决,或者尝试将 lineHeight 设置为 fontSize。