Expo app that renders trending tracks from Audius. Use this as a reference for:
- SDK setup in React Native / Expo (singleton, polyfills)
- Fetching trending via
sdk.tracks.getTrendingTracks() - React Query for caching and loading state
Setup mirrors mobile-devkit (template-expo, examples-expo): polyfills in index.js, singleton SDK in src/sdk.ts, and a small UI that lists tracks.
This example is standalone (not in the repo workspaces) so the main mobile app's Metro won't try to load it.
-
From the apps repo root, install and build the SDK if needed:
npm install npm run build -w @audius/sdk
-
Install the example's dependencies and start Expo:
cd packages/mobile/examples/trending npm install npx expo startOr from repo root:
npm run mobile:example:trending(runnpm installin the example dir first). -
Press
ifor iOS simulator orafor Android emulator (or scan the QR code with Expo Go).
Note: The example uses the local SDK via file:../../../sdk. If the SDK native build is missing, run npm run build -w @audius/sdk from repo root.
| File | Purpose |
|---|---|
index.js |
Entry: polyfills (Buffer, process, events, etc.) before any SDK import, then register App. Required for @audius/sdk in RN. |
src/sdk.ts |
Singleton getSDK() — creates sdk({ appName: 'AudiusMobileExample' }). Single place to configure endpoints or options. |
src/hooks/useTrendingTracks.ts |
React Query hook that calls getSDK().tracks.getTrendingTracks({ limit, offset, time }). |
App.tsx |
Renders trending list (or loading/error). Wraps app in QueryClientProvider. |
SDK setup, Expo, React Native, trending tracks, getTrendingTracks, Audius SDK, mobile example, polyfills, Buffer process events, singleton SDK, React Query.
- SDK factory:
packages/sdk/src/sdk/sdk.ts—sdk(config)withappName(and optionalservices,apiKey, etc.). - Tracks API:
packages/sdk/src/sdk/api/tracks/TracksApi.ts(extends generated) andpackages/sdk/src/sdk/api/generated/default/apis/TracksApi.ts—getTrendingTracks(params). - Devkit reference: mobile-devkit/apps/template-expo, mobile-devkit/apps/examples-expo for Expo + polyfills + SDK usage.