Skip to content

Commit

Permalink
Merge branch 'main' into feature/staleTime-on-query
Browse files Browse the repository at this point in the history
  • Loading branch information
TkDodo authored Nov 23, 2024
2 parents 6529df2 + 102b6a8 commit ce2847c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/framework/react/react-native.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ onlineManager.setEventListener((setOnline) => {
})
```

or

```tsx
import { onlineManager } from '@tanstack/react-query'
import * as Network from 'expo-network'

onlineManager.setEventListener((setOnline) => {
return Network.addNetworkStateListener((state) => {
setOnline(state.isConnected)
})
})
```

## Refetch on App focus

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":
Expand Down

0 comments on commit ce2847c

Please sign in to comment.