Skip to content

Commit b7315dc

Browse files
authored
Merge branch 'main' into angular-inject-queries
2 parents 1df454b + 102b6a8 commit b7315dc

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

docs/framework/react/react-native.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ onlineManager.setEventListener((setOnline) => {
2929
})
3030
```
3131

32+
or
33+
34+
```tsx
35+
import { onlineManager } from '@tanstack/react-query'
36+
import * as Network from 'expo-network'
37+
38+
onlineManager.setEventListener((setOnline) => {
39+
return Network.addNetworkStateListener((state) => {
40+
setOnline(state.isConnected)
41+
})
42+
})
43+
```
44+
3245
## Refetch on App focus
3346

3447
Instead of event listeners on `window`, React Native provides focus information through the [`AppState` module](https://reactnative.dev/docs/appstate#app-states). You can use the `AppState` "change" event to trigger an update when the app state changes to "active":

0 commit comments

Comments
 (0)