UNPKG

react-native-unit-components

Version:

Unit React Native components

27 lines (21 loc) 888 B
import { TurboModule, TurboModuleRegistry } from 'react-native'; interface Spec extends TurboModule { setSecureFlags(): void configureSnapshotProtectionStrategy(shouldProtectFromSnapshot: boolean, style: string): void } const SnapshotProtectionModule = TurboModuleRegistry.getEnforcing<Spec>('UNComponentsSnapshotProtectionModule'); class UNSnapshotProtectionHelper { static setAndroidSecurity() { /** * Set secure flag on the activity's window (if it doesn't exist) */ SnapshotProtectionModule.setSecureFlags(); } static setIosSecurity(shouldProtectFromSnapshot: boolean, style: string) { /** * Activate a Global native service for managing the snapshotProtection by the given arguments. */ SnapshotProtectionModule.configureSnapshotProtectionStrategy(shouldProtectFromSnapshot, style); } } export default UNSnapshotProtectionHelper;