我有简单的 footerTab,如果有通知,我想在其中显示徽章。
<Button active={ this.props.ui.selectedTab === 'notifications' ? true : false }
onPress={ () => this.selectedTab('notifications') }
{ ...this.props.ui.notifications ? badge : null }
>
{ this.props.ui.notifications ?
<Badge><Text style={{ color:'white' }}>{this.props.ui.notifications}</Text></Badge> : null
}
<Icon name='md-notifications' />
</Button>
使用此代码,我得到“未定义徽章”
如何为 Button 传递该徽章属性?