react-native-protected-data-ios

Subscribe to ProtectedWillBeAvailable e.t.c


Keywords
react-native, react native, protected-data, protected data, application protected data, ios
License
MIT
Install
npm install react-native-protected-data-ios@0.0.4

Documentation

ProtectedDataIOS

React Native module for subscribing to the iOS Application Protected Data event lifecycle.

1. Installation

$ ~ yarn add react-native-protected-data-ios
$ ~ cd ios && pod install

2. Usage

import { ProtectedDataIOS } from 'react-native-protected-data-ios'

const willBecomeUnavailable = () => {
  // Suspend i/o before device is locked!
}

const didBecomeAvailable = () => {
  // Resume i/o when device is unlocked and protected 
  // data becomes available.
}

useEffect(() => {
  const removeWillBecomeUnavailable: EmitterSubscription = ProtectedDataIOS.addListener('willBecomeUnavailable', willBecomeUnavailable)
  const removeDidBecomeAvailable: EmitterSubscription = ProtectedDataIOS.addListener('didBecomeAvailable', didBecomeAvailable)

  return () => {
    removeWillBecomeUnavailable.remove()
    removeDidBecomeAvailable.remove()
  }
}, [])