https://github.com/react-native-studio/react-native-android-danmaku
react native弹幕插件(android)基于哔哩哔哩弹幕插件
https://github.com/react-native-studio/react-native-android-danmaku
Last synced: 10 months ago
JSON representation
react native弹幕插件(android)基于哔哩哔哩弹幕插件
- Host: GitHub
- URL: https://github.com/react-native-studio/react-native-android-danmaku
- Owner: react-native-studio
- Created: 2018-01-17T04:00:27.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-02T02:46:08.000Z (almost 8 years ago)
- Last Synced: 2025-04-21T01:19:21.193Z (10 months ago)
- Language: Java
- Homepage: https://github.com/2534290808/DanmakuFlameMaster
- Size: 101 KB
- Stars: 20
- Watchers: 0
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## react-native-android-danmaku [](https://badge.fury.io/js/react-native-android-danmaku)
## 第一步
工程目录下运行 npm install --save react-native-android-danmaku 或者 yarn add react-native-android-danmaku(已经安装了yarn)
### 注意:
version 0.1.1适用于大于等于rn0.44和小于0.47
version 0.2.1适用于rn0.47及以上
## 第二步
运行 react-native link react-native-android-danmaku
## 第三部使用
在工程中导入:
```bash
import DanmakuView from 'react-native-android-danmaku';
this.danmaView=ref}/>
this.danmakuView.pause(); //暂停弹幕
this.danmakuView.resume(); //重启弹幕
this.danmakuView.hide(); //隐藏弹幕
this.danmakuView.show(); //显示弹幕
this.danmakuView.addDanmaku({text:'000000',color:'red',padding:2,isLive:true,time:2000,fontSize:36})
//发送弹幕
```
注意在使用中时应设置组件的宽高;
## 属性:
1 speed 弹幕的速度
2 maxLines 弹幕的最大行数
## 方法
pause()暂停弹幕
resume() 重启弹幕
hide() 隐藏弹幕
show() 显示弹幕
addDanmaku(params) 发送弹幕
params为:`{text,
isLive,
fontSize,
padding,
color,
time}`
text:弹幕内容,
isLive:是否为直播,
fontSize:弹幕字体大小,
padding:弹幕的内边距,
color:弹幕颜色,
time:弹幕出现时间,
## 示例