react-native 获取系统截屏通知并获取图片/截取当前屏幕
yarn add react-native-lewin-screen-capture
import ScreenCaptureUtil from 'react-native-lewin-screen-capture'
// 开始监听
ScreenCaptureUtil.startListener(res=>{
console.log(res)
// this.setState({uri:'data:image/png;base64,' + res.base64})
this.setState({uri: res.uri})
}, '截屏,screen')
// 停止监听
ScreenCaptureUtil.stopListener()
// 截取当前屏幕
ScreenCaptureUtil.screenCapture((res)=>{
console.log(res)
this.setState({uri: res.uri})
})
// 清理缓存
ScreenCaptureUtil.clearCache()