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?
How to implement a scratch card / view in react-native?
6k Views Asked by Ahmad S. Sadek At
3
There are 3 best solutions below
2

You can use this https://github.com/romangua/react-native-scratch-view library to implement the scratch card for both iOS and android.
Install it by running
npm install react-native-scratch-view --save
After that link it
react-native link react-native-scratch-view
In case if you get 404 not Found error in your terminal after running the install command. You can do this:
1- Open your package.json file
2- In your dependencies do something like this:
"dependencies":{
"react-native-scratch-view": "romangua/react-native-scratch-view",
}
3- Run npm install
after this and you can use it directly in your project by using import ScratchImageView from 'react-native-scratch-view';
I am using the same library for both Android and iOS and it's working on both.
Hope this helps!!
0

UPD 2022 Try this library https://www.npmjs.com/package/rn-scratch-card
It's implemented for Android and iOS.
You can use a library I made: react-native-scratch
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.
Other functionality includes: