react-native-scratch-card (Android Only)
https://github.com/D-clock/ScratchView/
Thanks for
Installation
react-native >= 0.60.0
1 - Install the package:
$ yarn add react-native-scratch-card
or
$ npm install react-native-scratch-card --save
"AndroidManifest.xml"
in "android/app/src/main/"
2 - Edit yout ... >
and
...
That's is all!
react-native
1 - Install the package:
Mostly automatic installation$ yarn add react-native-scratch-card
$ react-native link react-native-scratch-card
or
$ npm install react-native-scratch-card --save
$ react-native link react-native-scratch-card
"AndroidManifest.xml"
in "android/app/src/main/"
2 - Edit yout ... >
and ...
Manual installation
Android
- Open up
android/app/src/main/java/[...]/MainApplication.java
- Add
import com.thebylito.RNScratchCardPackage;
to the imports at the top of the file
- Add
new RNScratchCardPackage()
to the list returned by the getPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-scratch-card'
project(':react-native-scratch-card').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-scratch-card/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
: compile project(':react-native-scratch-card')
$ yarn add react-native-scratch-card
$ react-native link react-native-scratch-card
$ npm install react-native-scratch-card --save
$ react-native link react-native-scratch-card
"AndroidManifest.xml"
in "android/app/src/main/"
... >
...
android/app/src/main/java/[...]/MainApplication.java
import com.thebylito.RNScratchCardPackage;
to the imports at the top of the filenew RNScratchCardPackage()
to the list returned by the getPackages()
methodandroid/settings.gradle
:include ':react-native-scratch-card'
project(':react-native-scratch-card').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-scratch-card/android')
android/app/build.gradle
: compile project(':react-native-scratch-card')
Example
;;; state = color: "red" status: 0 ; { return <View style=stylescontainer> <Text>thisstatestatus</Text> <ScratchCard brushSize=125 getPercent= { this; } onEnd= { Alert; } maxPercent=50 style= justifyContent: "center" alignItems: "center" width: 400 height: 400 color="gray" > <Text style= fontSize: 20 >Hello World!!!</Text> </ScratchCard> </View> ; } const styles = StyleSheet;