| ios | ||
| .gitignore | ||
| index.js | ||
| package.json | ||
| readme.md | ||
| RNPrivacySnapshot.podspec | ||
| screenshot1.png | ||
| screenshot2.png | ||
| yarn.lock | ||
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 app’s 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)
PrivacySnapshot.enabled(true)
Installation iOS
- Run
npm install react-native-privacy-snapshot --savein your project directory - 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();

