Skip to content

Commit

Permalink
Fix useAppState to workaround unknown state
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyxiao committed Jun 23, 2019
1 parent cd2e45b commit 9161219
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/useAppState.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useEffect, useState } from 'react'
import { AppState } from 'react-native'

const currentState = AppState.currentState

// https://github.com/facebook/react-native/issues/18836
export default () => {
const currentState = AppState.currentState
const [appState, setAppState] = useState(currentState)

function onChange (newState) {
Expand All @@ -19,4 +19,4 @@ export default () => {
})

return appState
}
}

0 comments on commit 9161219

Please sign in to comment.