import {Platform} from 'react-native';

style: {
  fontSize: 28,
  height: 40,
  textAlign: 'center',
  textAlignVertical: 'center',
  ...Platform.select({
      ios: { lineHeight: 40 },
      android: {}
  })
}

textAlignVertical: 'center'  垂直居中只对android生效

ios要使用 lineHeight: 40 但是这对android是无效的

Logo

开源鸿蒙跨平台开发社区汇聚开发者与厂商,共建“一次开发,多端部署”的开源生态,致力于降低跨端开发门槛,推动万物智联创新。

更多推荐