15 Battle-Tested Prompts for React Native: Components, Navigation, and API Integration

Introduction

As a mobile developer in 2026, React Native remains one of the most efficient frameworks for building cross-platform apps. But even experienced engineers spend hours on repetitive tasks: styling a button, setting up a stack navigator, or parsing a REST response. AI assistants like ChatGPT, Claude, or Copilot can cut that time in half — if you know the right prompts.

I’ve compiled 15 prompts I actually use in my daily workflow, organized into three categories: UI components, navigation, and API integration. Each prompt is battle-tested, working, and includes a real usage example. No fluff — just practical value.

UI Components: From Layouts to Animations

1. Generate a reusable button component with variants

Create a reusable React Native button component named 'AppButton'. 
It should accept props: title (string), onPress (function), variant ('primary' | 'secondary' | 'danger'), disabled (boolean).
Use StyleSheet for styling, support custom styles via style prop.
Add TypeScript types.
Provide the full code.

Real usage: I needed a consistent button across 5 screens. This prompt gave me a 40-line component in seconds. Customized colors in 2 minutes.

2. Create a flat list with pull-to-refresh and infinite scroll

Write a functional React Native component that renders a FlatList with:
- pull-to-refresh (onRefresh)
- infinite scroll (onEndReached)
- loading indicator at bottom
- data fetched from a mock API (use placeholder data)
- TypeScript types
- comments explaining each section

Real usage: For a social feed screen, this prompt saved me from writing boilerplate for pagination and refresh logic. The comments helped junior teammates understand the flow.

3. Build a modal with fade animation and overlay

Create a custom Modal component in React Native with:
- animated fade-in/out
- semi-transparent overlay
- close on overlay press
- children prop for content
- use Animated API (not react-native-reanimated)

Real usage: Replaced a third-party modal library, reducing bundle size by 200KB. The animation is smooth on both iOS and Android.

4. Generate a form with validation using Formik and Yup

Write a registration form in React Native with fields: email, password, confirm password.
Use Formik for form state and Yup for validation.
Show inline error messages.
Add a submit button that logs values.

Real usage: Set up a complete sign-up form in 5 minutes, including password strength validation. The prompts output included proper TypeScript types for Formik.

5. Create a custom hook for keyboard-aware behavior

Write a custom React Native hook 'useKeyboardHeight' that:
- returns current keyboard height (number)
- uses Keyboard.addListener('keyboardWillShow' / 'keyboardWillHide')
- cleans up on unmount
- works on iOS and Android (note: keyboardWillShow is iOS only, use keyboardDidShow for Android)

Real usage: Fixed a layout issue where a button was hidden behind the keyboard. Added marginBottom: keyboardHeight to the button container.

Navigation: Stack, Tab, and Deep Links

6. Set up a stack navigator with authentication flow

Configure React Navigation with:
- a Stack Navigator containing 'Login', 'Register', 'Home' screens
- conditional rendering: if user is authenticated, show Home; else show Login
- use a simple context for auth state (AuthContext)
- TypeScript types for navigation params

Real usage: This prompt generated the entire navigation skeleton for a new app. I replaced the mock auth context with Firebase Auth in 10 minutes.

7. Create a bottom tab navigator with badges

Write a bottom tab navigator using @react-navigation/bottom-tabs with:
- 4 tabs: Home, Search, Notifications, Profile
- each tab uses a different icon from react-native-vector-icons (MaterialIcons)
- Notifications tab shows a badge with count from context
- active tab color is blue, inactive is gray

Real usage: For a social app, I needed badge counts on the notifications tab. This prompt included the badge logic — just connected it to the real notification count.

8. Implement deep linking for a profile screen

Add deep linking to a React Native app using React Navigation.
Configure linking config so that:
- 'asibiont.com/user/:id' opens ProfileScreen with userId param
- fallback to Home screen if route doesn't match
- use the 'linking' prop in NavigationContainer

Real usage: Implemented user profile sharing via URL. The prompt handled both iOS universal links and Android app links setup.

9. Build a custom header with a search bar

Create a custom navigation header with:
- a search bar that expands on tap (using Animated)
- a back button (if previous screen exists)
- a title prop
- uses useLayoutEffect to set header in screen

Real usage: Replaced the default header with an animated search bar for a product listing screen. The animation felt native.

API Integration: REST, GraphQL, and Caching

10. Create a custom hook for fetching data with loading and error states

Write a custom React Native hook 'useFetch' that:
- accepts a url (string) and options (object)
- returns { data, loading, error }
- uses fetch API (not axios)
- cancels request on unmount using AbortController
- TypeScript generics for data type

Real usage: Used in 8 screens to fetch data from a REST API. The AbortController prevented memory leaks when users navigated away quickly.

11. Implement a GraphQL query with Apollo Client

Write a React Native component that:
- uses @apollo/client to fetch a list of users
- displays them in a FlatList
- shows loading spinner and error message
- uses useQuery hook with a typed query
- define the query with gql tag

Real usage: For a user directory screen, this prompt gave me the complete Apollo integration. I only needed to replace the mock query with the real GraphQL endpoint.

12. Build an image upload component with progress

Create a React Native component for uploading an image:
- pick image from gallery using react-native-image-picker
- upload to a given URL using fetch with XMLHttpRequest for progress tracking
- show upload progress bar
- display preview after upload
- handle errors (network, file too large)

Real usage: Added profile picture upload to a settings screen. The progress bar gave users feedback during large uploads.

13. Implement offline-first caching with AsyncStorage

Write a custom hook 'useOfflineData' that:
- first tries to fetch data from API
- if network fails, loads cached data from AsyncStorage
- saves new data to cache on successful fetch
- returns { data, isOffline, refresh }
- TypeScript types

Real usage: For a notes app that works offline, this hook ensured users could view their last fetched notes without internet.

14. Create a debounced search input

Write a React Native component 'DebouncedSearchInput' that:
- uses a text input
- debounces onChangeText by 500ms (use useEffect with setTimeout)
- calls onSearch prop with the debounced value
- shows a clear button when text is not empty

Real usage: For a product search screen, debouncing reduced API calls from every keystroke to every 500ms, cutting server load by 60%.

15. Generate a REST API service layer

Create a service layer for a REST API in TypeScript:
- base URL configurable
- methods: get, post, put, delete
- automatic JSON parsing
- error handling with custom error class
- request/response interceptors (optional)
- example: fetch user by ID

Real usage: Centralized all API calls in one file, making it easy to switch from mock data to real endpoints during development.

Conclusion

These 15 prompts cover the most common tasks in React Native development: from UI components to navigation and API integration. They are not magic — they are shortcuts that eliminate boilerplate and let you focus on business logic. I use them every day, and they save me at least 2-3 hours per week.

The key to effective prompting is specificity: include props, types, libraries, and edge cases. The more context you give, the better the output. Start with these prompts, adapt them to your project, and you'll see your React Native workflow accelerate significantly.

Remember: AI is a tool, not a replacement for understanding the framework. Use these prompts to speed up repetitive work, but always review the generated code for performance and security.

← All posts

Comments