UNPKG

rnr-starter

Version:

A comprehensive React Native Expo boilerplate with 50+ modern UI components, dark/light themes, i18n, state management, and production-ready architecture

475 lines (375 loc) • 14.8 kB
# šŸš€ React Native UI Boilerplate <div align="center"> [![React Native](https://img.shields.io/badge/React%20Native-0.79.2-61dafb?style=flat-square&logo=react)](https://reactnative.dev/) [![Expo](https://img.shields.io/badge/Expo-53.0-000020?style=flat-square&logo=expo)](https://expo.dev/) [![TypeScript](https://img.shields.io/badge/TypeScript-5.8-3178c6?style=flat-square&logo=typescript)](https://www.typescriptlang.org/) [![NativeWind](https://img.shields.io/badge/NativeWind-4.1-06b6d4?style=flat-square)](https://www.nativewind.dev/) [![npm version](https://img.shields.io/npm/v/rnr-starter?style=flat-square&logo=npm)](https://www.npmjs.com/package/rnr-starter) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT) A comprehensive React Native Expo boilerplate with **50+ modern UI components**, dark/light themes, internationalization, and production-ready architecture. [**View Demo**](#-screenshots) • [**Getting Started**](#-quick-start) • [**Components**](#-ui-components) • [**Features**](#-features) </div> --- ## šŸŽ‰ What's New in v1.2.1 - šŸ“¦ **Package updates and maintenance** - Latest stable dependencies - šŸ”§ **Configuration improvements** - Better build and bundle optimization - šŸ“š **Documentation updates** - Enhanced guides and examples - šŸ“± **Entry point fixes** - Improved package.json configuration - šŸ› ļø **Import cleanup** - Better module organization ### Previous Updates (v1.2.0) - ļæ½ **Enhanced project structure** and configuration - šŸ“¦ **Improved npm package** configuration for better distribution - ļæ½ļø **Updated dependencies** to latest stable versions - šŸ“± **Full Radix UI support** for @rn-primitives components [**View Full Changelog**](./CHANGELOG.md) • [**Latest Release**](https://github.com/uginy/rnr-starter/releases/tag/v1.2.1) --- ## ✨ Features ### šŸŽØ **Rich UI Library** - **50+ Production-ready Components** - Buttons, Cards, Forms, Tables, Modals, and more - **Cross-platform Bottom Sheets** with native feel on iOS/Android - **Advanced Data Tables** with sorting, filtering, and pagination - **Form Components** with validation and error handling - **Toast Notifications** with auto error interceptor ### šŸŒ™ **Theming System** - **Dark & Light Mode** with system preference detection - **Persistent Theme Selection** across app sessions - **Android Navigation Bar** automatically matches theme - **Customizable Color Palette** with CSS variables ### šŸŒ **Internationalization** - **Multi-language Support** (English & Russian included) - **React i18next Integration** with namespace support - **RTL Layout Support** for Arabic/Hebrew languages - **Dynamic Language Switching** without app restart ### šŸ›  **Developer Experience** - **TypeScript** with strict configuration - **Biome** for lightning-fast linting and formatting - **Hot Reload** with Expo development server - **Path Mapping** with `~/` alias for clean imports - **Pre-commit Hooks** for code quality ### šŸ“± **Cross-platform** - **iOS** - Native performance with platform-specific optimizations - **Android** - Material Design compliance with custom theming - **Web** - Progressive Web App ready with responsive design ### šŸ”§ **State Management** - **Zustand** for lightweight global state - **React Query** for server state and caching - **MMKV** for high-performance local storage - **React Hook Form** with Zod validation --- ## šŸš€ Quick Start ### Installation ```bash # Create new project using this template npx create-expo-app MyApp --template rnr-starter # Or clone directly git clone https://github.com/uginy/rnr-starter.git cd rnr-starter bun install ``` ### Development ```bash # Start development server bun run dev # Run on specific platforms bun run ios # iOS simulator bun run android # Android emulator bun run web # Web browser ``` ### First Steps 1. **Update App Configuration** ```bash # Edit app.json for your app details nano app.json ``` 2. **Configure Theme Colors** ```bash # Customize colors in global.css nano global.css ``` 3. **Add Your Content** ```bash # Start building in app/index.tsx nano app/index.tsx ``` --- ## 🧩 UI Components ### šŸ“ Form Components - **Button** / **ButtonAsync** - Enhanced buttons with loading states - **Input** / **Textarea** - Styled text inputs with validation - **Select** / **RadioGroup** - Selection components - **Checkbox** / **Switch** - Toggle components - **DatePicker** - Cross-platform date selection - **OTPInput** - One-time password input with multiple styles ### šŸ“Š Data Display - **Table** - Advanced data tables with sorting/filtering - **Card** - Content containers with headers/footers - **Badge** / **Avatar** - Status and profile components - **Progress** - Loading and progress indicators - **Skeleton** - Loading placeholder components ### šŸŽÆ Navigation & Layout - **Tabs** - Tab navigation with animations - **Accordion** - Collapsible content sections - **Separator** - Visual content dividers - **AspectRatio** - Responsive aspect ratio containers ### šŸ’¬ Overlays & Modals - **Dialog** / **AlertDialog** - Modal dialogs - **BottomSheet** / **BottomSheetModal** - Native bottom sheets - **Popover** / **Tooltip** - Contextual overlays - **HoverCard** - Rich hover interactions (web) - **Toast** - Non-intrusive notifications ### šŸŽ› Interactive Components - **DropdownMenu** / **ContextMenu** - Context-aware menus - **NavigationMenu** / **Menubar** - Navigation components - **Toggle** / **ToggleGroup** - Toggle controls - **Collapsible** - Expandable content areas ### šŸ“„ Typography - **Text** - Enhanced text component with variants - **H1** / **H2** / **H3** / **H4** - Heading components - **P** / **BlockQuote** / **Code** - Content typography - **Lead** / **Large** / **Small** / **Muted** - Text variants --- ## šŸ“ø Screenshots > **Note**: Add your app screenshots here ``` [Hero Screenshot] [Dark Mode] [Components Demo] iOS/Android Theme Demo UI Library ``` --- ## šŸ— Project Structure ``` šŸ“¦ react-native-ui-boilerplate/ ā”œā”€ā”€ šŸ“± app/ # Expo Router pages │ ā”œā”€ā”€ _layout.tsx # Root layout with providers │ ā”œā”€ā”€ index.tsx # Landing page │ └── +not-found.tsx # 404 page ā”œā”€ā”€ 🧩 components/ # Reusable components │ ā”œā”€ā”€ ui/ # UI primitives (50+ components) │ │ ā”œā”€ā”€ button.tsx # Button variants │ │ ā”œā”€ā”€ card.tsx # Card components │ │ ā”œā”€ā”€ table.tsx # Data table │ │ ā”œā”€ā”€ bottom-sheet/ # Bottom sheet components │ │ └── ... # All other UI components │ ā”œā”€ā”€ ThemeToggle.tsx # Theme switcher │ ā”œā”€ā”€ LanguageToggle.tsx # Language switcher │ └── AvatarUploader.tsx # Avatar upload component ā”œā”€ā”€ šŸ“š lib/ # Core utilities │ ā”œā”€ā”€ hooks/ # Custom React hooks │ │ ā”œā”€ā”€ useDayJs.ts # Date utilities │ │ ā”œā”€ā”€ useMMKV.ts # Storage hooks │ │ └── useTable.ts # Table utilities │ ā”œā”€ā”€ stores/ # State management │ │ └── toast-store.ts # Toast notifications │ ā”œā”€ā”€ toast/ # Toast system │ │ ā”œā”€ā”€ providers/ # Toast providers │ │ ā”œā”€ā”€ hooks/ # Toast hooks │ │ └── utils/ # Toast utilities │ ā”œā”€ā”€ icons/ # Custom icons │ ā”œā”€ā”€ locales/ # i18n translations │ │ ā”œā”€ā”€ en.json # English translations │ │ └── ru.json # Russian translations │ ā”œā”€ā”€ constants.ts # App constants │ ā”œā”€ā”€ i18n.ts # Internationalization setup │ ā”œā”€ā”€ store.ts # Zustand store │ ā”œā”€ā”€ utils.ts # Utility functions │ └── types.ts # TypeScript types ā”œā”€ā”€ šŸŽØ assets/ # Static assets ā”œā”€ā”€ šŸ“„ docs/ # Documentation └── āš™ļø Configuration files ā”œā”€ā”€ app.json # Expo configuration ā”œā”€ā”€ tailwind.config.js # Tailwind CSS config ā”œā”€ā”€ biome.json # Biome linter config ā”œā”€ā”€ tsconfig.json # TypeScript config └── metro.config.js # Metro bundler config ``` --- ## šŸ”§ Customization ### Theme Configuration ```typescript // global.css - Customize your color palette :root { --background: 0 0% 100%; --foreground: 222.2 84% 4.9%; --primary: 221.2 83.2% 53.3%; --primary-foreground: 210 40% 98%; /* Add your custom colors */ } ``` ### Adding New Languages ```typescript // lib/locales/your-language.json { "common": { "welcome": "Your translation", "loading": "Your translation" } } // lib/i18n.ts - Register new language import yourLanguage from './locales/your-language.json'; resources: { 'your-lang': { translation: yourLanguage } } ``` ### Custom Components ```tsx // components/ui/your-component.tsx import { cn } from '~/lib/utils'; import { Text } from '~/components/ui/text'; interface YourComponentProps { className?: string; children: React.ReactNode; } export function YourComponent({ className, children }: YourComponentProps) { return ( <Text className={cn('your-default-styles', className)}> {children} </Text> ); } ``` --- ## šŸ“± Usage Examples ### Basic Form with Validation ```tsx import { useForm } from 'react-hook-form'; import { zodResolver } from '@hookform/resolvers/zod'; import { z } from 'zod'; import { Button } from '~/components/ui/button'; import { Input } from '~/components/ui/input'; const schema = z.object({ email: z.string().email(), password: z.string().min(8), }); export function LoginForm() { const { register, handleSubmit, formState: { errors } } = useForm({ resolver: zodResolver(schema) }); return ( <View className="space-y-4"> <Input placeholder="Email" {...register('email')} error={errors.email?.message} /> <Input placeholder="Password" secureTextEntry {...register('password')} error={errors.password?.message} /> <Button onPress={handleSubmit(onSubmit)}> Login </Button> </View> ); } ``` ### Data Table with Filtering ```tsx import { Table } from '~/components/ui/table'; import { useTable } from '~/lib/hooks/useTable'; const columns = [ { accessorKey: 'name', header: 'Name' }, { accessorKey: 'email', header: 'Email' }, { accessorKey: 'role', header: 'Role' }, ]; export function UsersTable() { const [globalFilter, setGlobalFilter] = useState(''); return ( <Table data={users} columns={columns} enableSorting enableFiltering globalFilter={globalFilter} onGlobalFilterChange={setGlobalFilter} enablePagination pageSize={10} /> ); } ``` ### Bottom Sheet Implementation ```tsx import { BottomSheetModal, BottomSheetView } from '~/components/ui/bottom-sheet'; export function ProfileModal() { const [isOpen, setIsOpen] = useState(false); return ( <BottomSheetModal open={isOpen} onOpenChange={setIsOpen} snapPoints={['50%', '90%']} > <BottomSheetView className="p-6"> <Text className="text-2xl font-bold mb-4">User Profile</Text> {/* Your content here */} </BottomSheetView> </BottomSheetModal> ); } ``` --- ## šŸ”Ø Available Scripts ```bash # Development bun run dev # Start development server bun run dev:web # Start web development server bun run dev:android # Start Android development bun run ios # Run on iOS simulator bun run android # Run on Android emulator # Code Quality bun run lint # Run linter bun run lint:fix # Fix linting issues bun run format # Format code bun run format:write # Format and write changes bun run check # Run all checks bun run check:fix # Fix all issues # Building bun run build:dev:android # Development Android build bun run build:preview:android # Preview Android build bun run build:prod:android # Production Android build bun run build:dev:ios # Development iOS build bun run build:preview:ios # Preview iOS build bun run build:prod:ios # Production iOS build ``` --- ## šŸŽÆ Production Checklist - [ ] Update `app.json` with your app details - [ ] Replace placeholder icons in `assets/` - [ ] Configure environment variables in `.env.example` - [ ] Update repository URLs in `package.json` - [ ] Add your custom colors to `global.css` - [ ] Configure EAS Build in `eas.json` - [ ] Add app store metadata - [ ] Test on physical devices - [ ] Set up CI/CD pipeline - [ ] Configure analytics and crash reporting --- ## šŸ¤ Contributing We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details. 1. Fork the repository 2. Create a feature branch (`git checkout -b feature/amazing-feature`) 3. Commit your changes (`git commit -m 'Add amazing feature'`) 4. Push to the branch (`git push origin feature/amazing-feature`) 5. Open a Pull Request --- ## šŸ“„ License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. --- ## šŸ™ Acknowledgments - [Expo](https://expo.dev/) - The platform that makes React Native development a joy - [NativeWind](https://www.nativewind.dev/) - Tailwind CSS for React Native - [RN Primitives](https://github.com/mrzachnugent/react-native-reusables) - Unstyled, accessible components - [Shadcn/ui](https://ui.shadcn.com/) - Design inspiration and component patterns ## šŸ“‹ Changelog See [CHANGELOG.md](./CHANGELOG.md) for a detailed history of changes. ### Latest Updates (v1.1.0) - šŸŽØ Enhanced UI components with better accessibility - šŸ”§ Added InitializationProvider for better app startup - šŸ“± New LoadingScreen component - šŸ› Fixed text rendering issues in React Native - 🌐 Improved internationalization support --- <div align="center"> **Built with ā¤ļø for the React Native community** [⭐ Star this repository](https://github.com/your-username/react-native-ui-boilerplate) if it helped you! </div>