# Screen Generator Generate React Native screens with navigation integration. ## Task You are a React Native expert. Generate complete, production-ready screens with proper typing and navigation. ### Steps: 1. **Ask for Requirements**: - Screen name and purpose - Required data/API calls - Form inputs (if any) - Navigation params 2. **Generate Screen Component**: ```typescript import React, { useEffect, useState } from 'react'; import { View, Text, StyleSheet, FlatList, RefreshControl, ActivityIndicator, } from 'react-native'; import { NativeStackScreenProps } from '@react-navigation/native-stack'; import { useQuery, useMutation } from '@tanstack/react-query'; import { api } from '../../services/api'; import { Product } from '../../types'; import { ProductCard } from '../../components/ProductCard'; import { RootStackParamList } from '../../navigation/types'; type Props = NativeStackScreenProps; export function ProductListScreen({ navigation, route }: Props) { const { category } = route.params; // Fetch data with React Query const { data: products, isLoading, error, refetch, isRefetching, } = useQuery({ queryKey: ['products', category], queryFn: () => api.getProducts({ category }), }); // Handle item press const handleProductPress = (productId: string) => { navigation.navigate('ProductDetail', { productId }); }; // Render loading state if (isLoading) { return ( ); } // Render error state if (error) { return ( Failed to load products ); } // Render list return ( item.id} renderItem={({ item }) => ( handleProductPress(item.id)} /> )} contentContainerStyle={styles.listContent} refreshControl={ } ListEmptyComponent={ No products found } /> ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', }, centerContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', }, listContent: { padding: 16, }, errorText: { fontSize: 16, color: 'red', }, emptyText: { fontSize: 16, textAlign: 'center', marginTop: 32, }, }); ``` 3. **Generate Form Screen**: ```typescript import React from 'react'; import { View, StyleSheet, ScrollView, KeyboardAvoidingView, Platform, } from 'react-native'; import { useForm, Controller } from 'react-hook-form'; import { zodResolver } from '@hookform/resolvers/zod'; import * as z from 'zod'; import { Input } from '../../components/Input'; import { Button } from '../../components/Button'; import { api } from '../../services/api'; const schema = z.object({ name: z.string().min(1, 'Name is required'), email: z.string().email('Invalid email'), phone: z.string().regex(/^\d{10}$/, 'Invalid phone number'), }); type FormData = z.infer; export function ProfileEditScreen({ navigation }: Props) { const { control, handleSubmit, formState: { errors, isSubmitting }, } = useForm({ resolver: zodResolver(schema), defaultValues: { name: '', email: '', phone: '', }, }); const onSubmit = async (data: FormData) => { try { await api.updateProfile(data); navigation.goBack(); } catch (error) { console.error('Failed to update profile', error); } }; return ( ( )} /> ( )} /> ( )} />