Skip to content

Commit 9161219

Browse files
authored
Fix useAppState to workaround unknown state
@see facebook/react-native#18836
1 parent cd2e45b commit 9161219

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/useAppState.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React, { useEffect, useState } from 'react'
22
import { AppState } from 'react-native'
33

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

99
function onChange (newState) {
@@ -19,4 +19,4 @@ export default () => {
1919
})
2020

2121
return appState
22-
}
22+
}

0 commit comments

Comments
 (0)