react-native-privacy-snapshot/index.js
2020-03-31 17:25:32 -05:00

17 lines
537 B
JavaScript

import { useEffect } from "react";
import { NativeModules, Platform } from "react-native";
let { PrivacySnapshot } = NativeModules;
const show = () => Platform.OS === "ios" && PrivacySnapshot._show(true);
const hide = () => Platform.OS === "ios" && PrivacySnapshot._show(false);
const enabled = enable =>
Platform.OS === "ios" && PrivacySnapshot.enabled(enable);
const usePrivacySnapshot = () => {
useEffect(() => {
show();
return () => {
hide();
};
}, []);
};
export { show, hide, enabled, usePrivacySnapshot };