[BREAKGLASS] Obscure passwords and other sensitive personal information when a react-native app transitions to the background
Go to file
2020-03-31 17:25:39 -05:00
ios Moving to UIBlur, removing the setup warning, and adding support for manual show/hide 2020-03-31 17:10:41 -05:00
.gitignore Ignore node_modules 2020-03-31 17:25:11 -05:00
index.js Adding usePrivacySnapshot hook 2020-03-31 17:25:32 -05:00
package.json Filling out peerdependencies 2020-03-31 17:25:01 -05:00
readme.md Adding docs for API 2020-03-31 17:25:39 -05:00
RNPrivacySnapshot.podspec Adding podspec 2020-03-31 16:11:41 -05:00
screenshot1.png base with blur. 2015-10-07 15:26:42 +11:00
screenshot2.png base with blur. 2015-10-07 15:26:42 +11:00
yarn.lock Yarn lock for dev 2020-03-31 17:25:23 -05:00

Enable privacy snapshot for React Native

In the App Programming Guide for iOS, Apple says:

When an app transitions to the background, the system takes a snapshot of the apps main window, which it then presents briefly when transitioning your app back to the foreground. Before returning from your applicationDidEnterBackground: method, you should hide or obscure passwords and other sensitive personal information that might be captured as part of the snapshot.

This react-native module obscure passwords and other sensitive personal information when an app transitions to the background.

PrivacySnapshot.enabled(false)

Screenshot of the multi-tasking screen

PrivacySnapshot.enabled(true)

Screenshot of the multi-tasking screen with privacy screenshot

Installation iOS

  1. Run npm install react-native-privacy-snapshot --save in your project directory
  2. Run (cd ios && pod install) to trigger react-native autolinking

Easy Usage

import { usePrivacySnapshot} from 'react-native-privacy-snapshot';

...

  usePrivacySnapshot()


API

The following functions are exported:

usePrivacySnapshot

Hook to apply the privacy snapshot when app goes to background. This will apply as long as this component is mounted

Usage

import { usePrivacySnapshot } from "react-native-privacy-snapshot";

const MyComponent = () => {
  usePrivacySnapshot();
  return <View>...</View>;
};

enabled(doEnable: boolean)

Enable the privacy screen to trigger when app goes to background.

Usage

import { enabled } from "react-native-privacy-snapshot";
enabled(true);
//Later...
enabled(false);

show

Show the privacy screen right now

Usage

import { show } from "react-native-privacy-snapshot";
show();

show

Hide the privacy screen right now

Usage

import { show, hide } from "react-native-privacy-snapshot";
show();
//Later
hide();