react-native - 带有可折叠按钮徽章的 Fab 拨号按钮
问题描述
我制作了原生 Fab 的 Fab 组件。我想显示可折叠按钮的徽章。我的解决方案在 iOS 上运行良好,但在徽章没有溢出按钮并因此仅部分显示的 Android 上却不行。
<Fab
active={isFabActive}
direction="up"
containerStyle={{}}
style={styles.fab}
position="bottomRight"
onPress={() => onPressFn || this.setState( { isFabActive: !isFabActive } )}>
<Icon type={iconFont} name={iconName}/>
{
!onPressFn && buttons && buttons.map( ( i, index ) => (
<Button iconCenter
style={{ backgroundColor: "#3B5998" }}
onPress={ i.onPressFn }
key={index}>
<Icon type={ i.iconFont || 'FontAwesome' } name={i.iconName}/>
{
i.badgeText !== undefined && <Badge style={styles.fabBadge}><Text>{i.badgeText}</Text></Badge>
}
</Button>
))
}
</Fab>
const styles = StyleSheet.create( {
fab: {
backgroundColor: COLOR_PRIMARY
},
fabBadge: {
position: 'absolute',
right: -10,
top: -10,
}
} )
解决方案
在 androidoverflow: visible
上尚不支持,如果您想让它可见,请在父视图 ( <Fab />
) 中添加填充以使其更大,这样徽章就不会被剪切。
推荐阅读
- swift - Swift package created by SPM doesn't have access to full Foundation?
- python - 我正在尝试从不和谐频道接收最后一条消息,但我遇到了“正在运行的事件循环”问题,有人可以帮助查看我的代码吗?
- python - 如何为seaborn histplot绘制奇数个子图
- python - python / pandas中多列的百分位数范围输出
- api - Flutter/Dart 如何使用 Flutter 从 Woocommerce API 访问订单?
- c++ - 我是推动解决方案还是只是我改变了什么?
- python - 计算YOLOv4坐标画错注释
- arduino - 如何从 SIM800l 中删除所有短信?
- javascript - 必须定义不能识别值的打字稿类型推断
- javascript - 想要获取文本(内容)的开始和结束索引