簡體   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