"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = require("react");
var _reactNativeCaptureProtection = require("react-native-capture-protection");
/**
 * Prevents screenshots when component is mounted. When unmounted, allows them again
 *
 * @param {boolean} [active=true] - If `false`, hook does nothing
 * @remarks
 * - If `active` param is `true`, it prevents screenshots when the
 * component is mounted
 * - On unmount, or when `active` is changed to false, it restores
 * the ability to take screenshots
 * - Should be used at the screen level only
 *
 * @example
 * ```tsx
 * import usePreventScreenCapture from './hooks/screen-capture';
 *
 * const MyScreen = () => {
 *   usePreventScreenCapture();
 *   return <View><Text>Secure Content</Text></View>;
 * };
 * ```
 *
 * @returns {void}
 */
const usePreventScreenCapture = (active = true) => {
  (0, _react.useEffect)(() => {
    if (!active) return;
    _reactNativeCaptureProtection.CaptureProtection.preventScreenshot();
    return () => {
      _reactNativeCaptureProtection.CaptureProtection.allowScreenshot(true);
    };
  }, [active]);
};
var _default = exports.default = usePreventScreenCapture;
//# sourceMappingURL=screen-capture.js.map