React Native and Flutter UI Recipes
Mobile development with AI tools is tricky because platform-specific behavior matters. A component that works in a web preview will crash on a real device if it uses unsupported APIs. These recipes produce code that accounts for iOS/Android differences, handles safe areas, respects platform conventions, and uses native modules correctly.
What You Will Walk Away With
Section titled “What You Will Walk Away With”- React Native component recipes with platform-specific handling
- Flutter widget recipes with Material and Cupertino design
- Navigation patterns for both frameworks with deep linking
- Performance recipes for lists, animations, and image loading
Recipe 1: Platform-Adaptive Navigation (React Native)
Section titled “Recipe 1: Platform-Adaptive Navigation (React Native)”Scenario: Your app needs tab navigation on iOS and drawer navigation on Android, following each platform’s conventions.
Navigation scaffolding touches many files at once — the navigator, every screen, the param types, and the deep-link config — so the tool you reach for changes how you drive it.
Open the navigation folder and use agent mode so it edits RootNavigator.tsx, the screen files, and linking.ts in one pass. Drop a checkpoint before accepting — platform-split navigators are the classic case where the AI gets the iOS branch right and silently breaks the Android headerShown defaults, and you want a one-click rollback.
Run headless so it writes the navigator, screens, and RootStackParamList in a single turn: claude -p "build the platform-adaptive navigator described in linking.ts and wire all four screens". Add a PostToolUse hook on *.tsx that runs tsc --noEmit so a missed param type fails immediately instead of at runtime.
Spin up a worktree so the navigation rewrite stays isolated from the rest of the app while you review the iOS-vs-Android split. Once the diff is clean, push the branch and let the Cloud reviewer check the deep-link map before you merge.
Expected output: Root navigator, iOS tabs, Android drawer, deep linking config, typed params, and tests.
Recipe 2: Responsive Layout System (React Native)
Section titled “Recipe 2: Responsive Layout System (React Native)”Scenario: Your app must work on phones, tablets, and foldables with different layouts at each breakpoint.
Expected output: useResponsive hook, three layout components, useScaledSize hook, and tests.
Recipe 3: Custom Widget Library (Flutter)
Section titled “Recipe 3: Custom Widget Library (Flutter)”Scenario: Your Flutter app needs a branded design system working across iOS and Android.
Expected output: Five widget files, theme class, widget book, and widget tests.
Recipe 4: Performant Feed List (React Native)
Section titled “Recipe 4: Performant Feed List (React Native)”Scenario: Your feed screen shows 1000+ items with images and stutters when scrolling. Pull-to-refresh feels laggy.
Expected output: Feed screen with FlashList, memoized FeedItem, FastImage loading, and performance test.
Recipe 5: Offline-First Architecture (React Native)
Section titled “Recipe 5: Offline-First Architecture (React Native)”Scenario: Your field service app must work without connectivity. Users enter data offline and it syncs when connected.
A sync engine spans models, an adapter, hooks, and UI — and the tricky part is the last-write-wins conflict logic, which is easy to get subtly wrong. How you supervise that differs by tool.
Build it in agent mode across the model and adapter files, but checkpoint right before the sync-adapter step and review that diff on its own — conflict resolution is where the AI quietly drops the syncStatus reconciliation. The inline diff view makes the timestamp-comparison logic easy to scan line by line.
Generate the models and adapter headless, then make the sync logic provable: claude -p "write WatermelonDB sync tests: create offline, go online, assert last-write-wins" and add a PostToolUse hook running the offline-then-online test on every edit to sync/*.ts. You want the conflict path covered by a test, not by hope.
Use a worktree to develop the sync engine in isolation, then push and let the Cloud reviewer focus on the conflict-resolution path specifically — a fresh reviewer catches the dropped-write edge case that the author (human or AI) glossed over.
Expected output: WatermelonDB models, sync engine, network hooks, offline banner, and sync tests.
Recipe 6: State Management with Riverpod (Flutter)
Section titled “Recipe 6: State Management with Riverpod (Flutter)”Scenario: Your Flutter app uses Provider everywhere. Migrate to Riverpod for testability and type safety.
Expected output: Three provider files, widget tree integration, and widget tests with mock overrides.
Recipe 7: Native Module Integration (React Native)
Section titled “Recipe 7: Native Module Integration (React Native)”Scenario: You need NFC tag reading not covered by existing libraries.
Use agent mode so it generates NativeNfc.ts, the Swift class, and the Kotlin class in one edit, then keep the iOS Simulator and an Android emulator in split panes to eyeball both bridges. Because native changes do not hot-reload, accept the checkpoint and trigger a full rebuild rather than expecting Fast Refresh to pick them up.
Generate .swift, .kt, and .ts in a single headless pass, then wire the rebuild into a hook so you never test stale binaries: add a PostToolUse hook matching *.swift and *.kt that runs npx expo prebuild --clean (or cd ios && pod install for bare RN). The terminal-first flow means the native rebuild is one command away from the edit.
Open a worktree so the Swift and Kotlin work stays isolated from your JS feature branch — native module edits often need an Xcode/Gradle sync that you do not want polluting the main checkout. Review the TurboModule spec diff in the Codex IDE extension before syncing the native projects.
Expected output: TurboModule spec, iOS Swift, Android Kotlin, useNfc hook, and tests.
Recipe 8: Card Swipe Animations (React Native)
Section titled “Recipe 8: Card Swipe Animations (React Native)”Scenario: You need smooth 60fps animations for a swipeable card stack.
Expected output: SwipeableCard, CardStack, undo logic, haptic integration, and gesture tests.
Recipe 9: Platform-Adaptive Design (Flutter)
Section titled “Recipe 9: Platform-Adaptive Design (Flutter)”Scenario: Your Flutter app looks identical on iOS and Android. Users expect platform-native patterns.
Expected output: Six adaptive widgets, PlatformHelper, base page class, and cross-platform tests.
Recipe 10: Push Notifications (React Native)
Section titled “Recipe 10: Push Notifications (React Native)”Scenario: Your app needs push notifications on both platforms with deep linking to specific screens.
Expected output: Firebase config, setup, handlers, deep link parser, hook, and tests.
Recipe 11: GoRouter Navigation (Flutter)
Section titled “Recipe 11: GoRouter Navigation (Flutter)”Scenario: Your navigation is scattered Navigator.push calls with no type safety. You need declarative routing.
Expected output: Router config, typed helpers, deep link config, guards, and navigation tests.
Recipe 12: App Store Submission Preparation
Section titled “Recipe 12: App Store Submission Preparation”Scenario: Your app is feature-complete. Prepare for App Store and Play Store submission.
Submission prep is mostly config edits plus a verification script, so this is the recipe where a scripted, repeatable run pays off most.
Let agent mode edit Info.plist and build.gradle together, then run the build-verification script from the integrated terminal. The visual diff is handy for catching a wrong versionCode or a stray debug entitlement before you ship.
This is the strongest fit for headless scripting: have it generate a prepare-release.sh that bumps versions, builds both platforms, and greps the release bundle for console.log and debug deps — then run it in CI so every release candidate is verified the same way. The build-verification step is exactly the kind of repeatable gate the CLI was built for.
Kick the release prep off as a Cloud task from a fresh worktree and have it open a PR with the config changes plus RELEASE_CHECKLIST.md. A reviewer signs off on the version bumps and signing config on the PR before anything reaches the stores.
Expected output: Updated native configs, icon script, build verification script, and release checklist.
When Recipes Break
Section titled “When Recipes Break”What Is Next
Section titled “What Is Next”- Expo recipes for managed workflow patterns
- Flutter recipes for deeper Flutter workflows
- React Native recipes for advanced React Native patterns