0.0.8 • Published 5 years ago

react-native-protected-data-ios v0.0.8

Weekly downloads
20
License
MIT
Repository
-
Last release
5 years ago

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()
  }
}, [])