TextInput 中自定义字体出现不需要的间距

问题描述 投票:0回答:1

我正在使用 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

react-native expo
1个回答
0
投票
在 Android 中,某些字体有自己的填充。将

includeFontPadding: false

 添加到您的样式中可以解决此问题。

© www.soinside.com 2019 - 2024. All rights reserved.