react-native-screen-tool
v0.0.5
Published
`$ npm install react-native-screen-tool --save`
Downloads
15
Readme
react-native-screen-tool
Getting started
$ npm install react-native-screen-tool --save
Mostly automatic installation
$ react-native link react-native-screen-tool
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-screen-tool
and addRNScreenTool.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNScreenTool.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.bybon.ScreenTool.RNScreenToolPackage;
to the imports at the top of the file - Add
new RNScreenToolPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-screen-tool' project(':react-native-screen-tool').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-screen-tool/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-screen-tool')
Usage
import RNScreenTool from 'react-native-screen-tool';
import {NativeModules} from 'react-native';
this.listenerScreen = new NativeEventEmitter(NativeModules.RNTEventEmitter);
RNScreenTool.startListeningScreenshot()
this.listenerScreen.addListener('UserDidTakeScreenshot', (e) => {
//user did take screenshot
//Add text on the screenshot
RNScreenTool.setImageText('text')
})
RNScreenTool.startMonitoringScreenRecording()
this.listenerScreen.addListener('ScreenCapturedDidChange', (e) => {
if (e == 1) {
//screen is being captured
} else {
//screen is not being captured
}
})