繁体   English   中英

React Native:通知文本未显示在android中

[英]React Native: Notification text not showing up in android

我有一个带有以下文字的通知徽章:

<View style={styles.notificationBadge}>
  <Text style={styles.notificationText}>
    notification
  </Text>
</View>

当我在iOS中对此进行测试时,它可以正常工作并显示文本。 但是,当我在Android中进行测试时,什么也没出现。 像这样:

在此处输入图片说明

这是通知徽章和文本的样式:

  notificationBadge: {
    backgroundColor: '#23CCA3',
    borderRadius: 15,
    justifyContent: 'center',
    alignContent: 'center',
    padding: 0,
    marginBottom: 3,
    alignSelf: 'center',
    width: 24,
    height: 24
  },
  notificationText: {
    alignSelf: 'center',
    textAlign: 'center',
    fontSize: 12,
    fontWeight: 'bold',
    lineHeight: 0,
    color: '#fff',
    marginTop: 0
  }

让我知道您是否对解决此问题有任何想法。

由于lineHeight为零,因此未显示该文本。 试试这种风格:

notificationText: {
    alignSelf: 'center',
    textAlign: 'center',
    fontSize: 12,
    fontWeight: 'bold',
    color: '#fff',
    marginTop: 0
  }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM