[BREAKGLASS] Append-only mirror of github.com/bluewallet/react-native-obscure
Go to file
Diego Francisco Hernandez Guevara d604ee1b33
Fixed typo on notice
2019-01-08 21:04:37 -06:00
android Updated buildToolsVersion to last version. 2018-01-19 01:19:32 -06:00
.gitattributes Initial commit. 2017-12-18 03:17:59 -06:00
.gitignore Updated package.json 2017-12-18 04:00:16 -06:00
index.js Fixed name error 2017-12-18 04:29:48 -06:00
LICENSE Initial commit 2017-12-18 03:18:38 -06:00
package.json Fixed name error 2017-12-18 04:29:48 -06:00
README.md Fixed typo on notice 2019-01-08 21:04:37 -06:00

react-native-obscure

NOTICE

This repository will not longer be maintained, because I don't use React Native anymore. Feel free to fork it and continue to develop/maintain it.


A react native android module for obscuring applications when switching applications and preventing taking screenshots of the application.

Getting started

NPM

$ npm install react-native-obscure --save

Yarn

$ yarn add react-native-obscure

Installation

Mostly automatic installation

$ react-native link react-native-obscure

Manual installation

Android

  1. Open up android/app/src/main/java/[...]/MainApplication.java
  • Add import com.diegofhg.obscure.ObscurePackage; to the imports at the top of the file
  • Add new ObscurePackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-obscure'
    project(':react-native-obscure').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-obscure/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-obscure')
    

Usage

You can use it programmatically for activating/deactivating the obscuring at any time, use it app-wide or per component.

activateObscure: Activates the obscuring.

deactivateObscure: Deactivate the obscuring.

import React, { Component } from 'react';
import { View, Text } from 'react-native';

import Obscure from 'react-native-obscure';

export default class App extends Component {
  componentWillMount() {
    Obscure.activateObscure();
  }

  componentWillUnmount() {
    Obscure.deactivateObscure();
  }

  render() {
    return(
      <View>
        <Text>This text will be obscured when changing apps</Text>
      </View>
    );
  }
}

TODOs

  • Add iOS support.