如何在 react-native 中实现刮刮卡/视图? [英] How to implement a scratch card / view in react-native?

查看:100
本文介绍了如何在 react-native 中实现刮刮卡/视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个包来在 react-native 中实现刮刮卡.我找到了这个库 https://github.com/thebylito/react-native-scratch-card 但问题是它只适用于 android.是否有适用于 iOS 和 android 的库,或者我可以在纯 JavaScript 中实现它吗?

I'm looking for a package to implement a scratch card in react-native. I have found this library https://github.com/thebylito/react-native-scratch-card but the problem is that it works only on android. Is there a library that works on both iOS and android, or can I implement this in pure javascript?

推荐答案

你可以使用我制作的一个库:react-native-scratch

You can use a library I made: react-native-scratch

npm install react-native-scratch --save

该库支持 Android 和 iOS,并允许您在应用中使用多个草稿视图,例如 - 带有刮刮卡的 FlatList.

This library supports both Android and iOS and enables you to use multiple scratch views in your app, for example - a FlatList with scratch cards.

其他功能包括:

  • 自动填充包含视图以覆盖其内容直到您刮擦
  • 加载图像时使用的用户定义的背景颜色
  • 您可以从 url 或应用程序中的资源文件设置图像(或不设置图像)
  • 支持图像大小调整模式(拉伸/覆盖/包含)
  • 用户定义的画笔大小和划痕阈值
  • 触摸事件(用于阻止 ScrollView/FlatList 在抓取时滚动)
  • 抓挠时的进度报告
  • 当草稿视图到达其时淡入淡出动画(可选)划痕阈值

这篇关于如何在 react-native 中实现刮刮卡/视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆