我遇到了一个问题,就是垂直居中按钮文本时,它始终比确切的中心低一些。我在文档中找到了
includeFontPadding
,其中提到了一些与第三方字体不一致的问题。
在iOS设备中,字体看起来很正常,但在Android中无法正确居中。
https://facebook.github.io/react-native/docs/text-style-props#includefontpadding
设置为false以删除额外的字体填充,以便为某些上升/下降部分留出空间。对于某些字体,这种填充会使文本在垂直居中时看起来稍微有些不对齐。为了获得最佳效果,请将textAlignVertical也设置为center。默认值为true。<Button
style={[style.button]} block >
<Text>Setup Now</Text>
</Button>
export default {
button: {
elevation: null,
shadowColor: null,
shadowOffset: null,
shadowOpacity: null,
shadowRadius: null
}
}