本篇文章主要介绍了react native悬浮按钮组件的示例代码,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面来一起看看吧。
React Native悬浮按钮组件:react-native-action-button,纯JS组件,支持安卓和IOS双平台,支持设置子按钮,支持自定义位置和样式和图标。
效果图

安装方法
npm i react-native-action-button --save react-native link react-native-vector-icons
因为用到了react-native-vector-icons图标组件,需要做下link。如果你项目中已经使用了react-native-vector-icons,那就不需要这步了。
示例代码
<view>
<text>
悬浮按钮组件示例
</text>
<actionbutton>
<actionbutton.item> console.log("notes tapped!")}>
<icon></icon>
</actionbutton.item>
<actionbutton.item> {}}>
<icon></icon>
</actionbutton.item>
<actionbutton.item> {}}>
<icon></icon>
</actionbutton.item>
</actionbutton>
<actionbutton> { alert('你点了我!')}}
renderIcon={() => (<view><icon></icon>
<text>新增</text>
</view>)}
/>
</actionbutton></view>
主要参数说明
ActionButton
size:按钮的大小,默认为56
active:是否显示按钮
position:按钮的位置,可以为left center right
offsetX:X轴上的偏移位置
offsetY:Y轴上的偏移位置
onPress:点击事件
-
onLongPress:长按事件
Build React agent chat interfaces with assistant-ui下载使用 assistant-ui 构建具有可重用线程、运行时、消息组件和模型/提供者适配器的生产级 React 聊天界面。
buttonText:按钮标题
verticalOrientation:弹出按钮的方向,up 或者 down
renderIcon:可以自定义按钮显示的样式,默认是一个加号
ActionButton.Item
size:按钮的大小,默认为56
title:按钮标题
buttonColor:按钮颜色
onPress:点击事件
上面是我整理给大家的,希望今后会对大家有帮助。
相关文章:
Ajax获取到数据放入echarts里不显示的原因分析及解决办法
基于iframe实现ajax跨域请求 获取网页中ajax数据










