Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 634 Bytes

appstate.md

File metadata and controls

38 lines (30 loc) · 634 Bytes
id appstate
title AppState
officialDoc https://reactnative.dev/docs/appstate

Types

type t = [#active | #background | #inactive | #unknown | #extension]

Values

AppState.currentState // t
AppState.isAvailable // bool

Methods

addEventListener

addEventListener: [
  | #change(t => unit)
  | #focus(unit => unit)
  | #blur(unit => unit)
  | #memoryWarning(unit => unit)
] => EventSubscription.t
React.useEffect0(() => {
  let sub = AppState.addEventListener(#change(next => Console.log(next)))
  Some(() => sub->EventSubscription.remove)
})