0
Fork 0
mirror of https://github.com/TanStack/query.git synced 2026-11-16 22:50:20 +00:00
query/examples/react/react-native
Wonsuk Choi cb62f4f2ed
chore(*): adopt '@tanstack/oxlint-config' and '@tanstack/oxfmt-config', and fix the newly reported lint errors (#12555)
* chore(*): adopt '@tanstack/oxlint-config' and '@tanstack/oxfmt-config', and fix the newly reported lint errors

* chore(pnpm-lock.yaml): run 'pnpm dedupe'

* chore(scripts): move 'oxlint/plugin.ts' to 'oxlint-plugin.ts' to match the flat layout of 'scripts'

* chore(pnpm-workspace.yaml): update '@typescript-eslint/parser' and '@typescript-eslint/rule-tester' to '^8.72.1' to match the deduped '@typescript-eslint/utils'
History 2026-11-16 22:25:25 +09:00
..
assets v4 release (#3842) 2022-07-18 12:08:12 -06:00
src chore(*): adopt '@tanstack/oxlint-config' and '@tanstack/oxfmt-config', and fix the newly reported lint errors (#12555) 2026-11-16 22:25:25 +09:00
.gitignore docs(examples): use each framework's template '.gitignore' in every example (#12592) 2026-11-13 10:57:29 +09:00
app.json docs(examples): unify page titles to 'TanStack <Framework> Query <Name> Example' and remove scaffold leftovers (#12580) 2026-11-12 14:54:59 +09:00
App.tsx chore(*): adopt '@tanstack/oxlint-config' and '@tanstack/oxfmt-config', and fix the newly reported lint errors (#12555) 2026-11-16 22:25:25 +09:00
babel.config.js feat: beta release (#5771) 2023-07-24 11:59:07 +02:00
eslint.config.mjs chore(*): adopt '@tanstack/oxlint-config' and '@tanstack/oxfmt-config', and fix the newly reported lint errors (#12555) 2026-11-16 22:25:25 +09:00
package.json ci: Version Packages (#12543) 2026-11-07 00:00:45 +01:00
README.md docs(examples): rewrite the READMEs, add the framework or router to example titles, and rename examples to '<feature>-<framework>' (#12583) 2026-11-12 16:58:15 +09:00
tsconfig.json feat: beta release (#5771) 2023-07-24 11:59:07 +02:00

TanStack React Query React Native Example

A movies app for React Native (Expo). Queries refetch when the app comes to the foreground and when the network reconnects, through focusManager and onlineManager, and support pull to refresh.

Built with Expo.

How it works

  • src/services/movies/queries.ts defines moviesQueries.list() and moviesQueries.detail(title) with queryOptions. src/services/movies/api.ts reads src/data/movies.json after a random delay of up to about 2 seconds.
  • App.tsx calls focusManager.setFocused from the AppState listener in src/hooks/useAppState.ts, and src/hooks/useOnlineManager.ts feeds NetInfo's connection state into onlineManager.setEventListener. Both are skipped on web, where the browser events already cover this.
  • src/screens/MoviesListScreen.tsx reads useQuery(moviesQueries.list()), supports pull to refresh through src/hooks/useRefreshByUser.ts, and uses src/hooks/useRefreshOnFocus.ts to call queryClient.refetchQueries({ stale: true, type: 'active' }) when the screen regains navigation focus.
  • src/screens/MovieDetailsScreen.tsx reads the detail query with a placeholderData function that takes the matching movie from the cached list via queryClient.getQueryData(moviesQueries.list().queryKey), so the title and year show while the full details load.

To run this example:

  • npm install
  • npm start