我正在使用 Expo 51,并且在使用 React Native 的 TextInput 时遇到问题。 使用自定义字体时,文本下方似乎有一些不需要的空格。字体本身来自 Expo 的 Google Fonts (Poppins)。
我尝试使用
textAlignVertical
属性并将值设置为 bottom
,但它仍然是相同的。我期待它看起来像这样(这是使用默认的 fontFamily)。
<RNTextInput
style={{
width: 200,
fontFamily: 'Poppins_400Regular',
fontSize: 30,
backgroundColor: "rgb(245 245 245)"
}}
textAlignVertical={'bottom'}
multiline={false}
/>
只是为了澄清 RNTextInput
不是自定义组件,它只是从
TextInput
重命名为
react-native
。
includeFontPadding: false
添加到您的样式中可以解决此问题。