### Example: Add Input and Textarea Components Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/minimal-uniwind/README.md Example of how to add specific components like 'input' and 'textarea' using the CLI. ```bash npx react-native-reusables/cli@latest add input textarea ``` -------------------------------- ### Development Commands Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/INDEX.md Run these commands to start the development server, open simulators/emulators, or clean the project cache. ```bash # All templates npm run dev # Start development server npm run ios # Open iOS simulator npm run android # Open Android emulator npm run web # Open web version npm run clean # Clear cache and modules ``` -------------------------------- ### Start Development Server Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/clerk-auth/README.md Commands to start the development server for the React Native application. Ensure your .env.local file is configured with your Clerk publishable key. ```bash npm run dev ``` ```bash yarn dev ``` ```bash pnpm dev ``` ```bash bun dev ``` -------------------------------- ### Input Return Key Type Examples Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/api-reference/input.md Demonstrates different returnKeyType options for controlling the keyboard's return key action. Use to guide user input flow. ```tsx nextRef?.focus()} /> ``` ```tsx ``` ```tsx Keyboard.dismiss()} /> ``` ```tsx ``` -------------------------------- ### THEME Usage Example Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/types.md Demonstrates how to import and use the THEME object to access light and dark theme colors. ```typescript import { THEME } from '@/lib/theme'; const bgColor = THEME.light.background; const textColor = THEME.dark.foreground; ``` -------------------------------- ### ClassValue Usage Examples Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/types.md Demonstrates various ways to use the cn() utility function with different input types. ```typescript cn('px-4') // string ``` ```typescript cn(12) // number ``` ```typescript cn(true, false) // booleans ``` ```typescript cn(undefined, null) // undefined/null ``` ```typescript cn({ 'px-4': true, 'py-2': false }) // conditional object ``` ```typescript cn(['px-4', 'py-2']) // array ``` ```typescript cn('base', { 'variant': isActive }) // mixed ``` -------------------------------- ### Initialize Project with React Native Reusables CLI Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/README.md Use this command to start a new project with a React Native Reusables template. If no template is specified, you will be prompted to select one interactively. ```bash npx @react-native-reusables/cli@latest init [options] ``` -------------------------------- ### Navigation Links on Home Screen Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/routing.md Provides examples of creating navigation links to external documentation and the GitHub repository using the Link component. ```typescript ``` -------------------------------- ### Package.json Scripts for Expo Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/configuration.md Commonly used scripts for starting the Expo development server with cache clearing and managing project dependencies. ```json { "scripts": { "dev": "expo start -c", "android": "expo start -c --android", "ios": "expo start -c --ios", "web": "expo start -c --web", "clean": "rm -rf .expo node_modules" } } ``` -------------------------------- ### Card with Divider Example Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/api-reference/card.md Demonstrates using a Card component with a Separator to visually divide content sections, such as account details. ```tsx import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Separator } from '@/components/ui/separator'; import { Text } from '@/components/ui/text'; Account Email user@example.com Phone +1 (555) 000-0000 ``` -------------------------------- ### Full Card Component Example Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/api-reference/card.md Demonstrates the complete structure of a Card with header, content, and footer, including input fields and buttons. Ensure all imported components are correctly set up in your project. ```tsx import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Text } from '@/components/ui/text'; import { View } from 'react-native'; export function MyCard() { return ( {/* Header with title and description */} Create Account Enter your details to get started {/* Main content area */} {/* Footer with actions */} ); } ``` -------------------------------- ### NavTheme Usage Example with ThemeProvider Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/types.md Shows how to integrate the NAV_THEME with React Navigation's ThemeProvider, dynamically selecting the theme based on the system's color scheme. ```typescript import { NAV_THEME } from '@/lib/theme'; import { ThemeProvider } from '@react-navigation/native'; import { useColorScheme } from 'nativewind'; export default function RootLayout() { const { colorScheme } = useColorScheme(); return ( {/* App routes */} ); } ``` -------------------------------- ### Sign-In Card Example Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/api-reference/card.md Illustrates a Card component used to create a sign-in form, including input fields, labels, and a submit button. ```tsx import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Text } from '@/components/ui/text'; Sign in Enter your credentials to continue ``` -------------------------------- ### Input Keyboard Type Examples Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/api-reference/input.md Shows various keyboardType props for customizing the on-screen keyboard. Use to optimize input for specific data types. ```tsx ``` ```tsx ``` ```tsx ``` ```tsx ``` -------------------------------- ### Complex Example: Status Card with Icon Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/api-reference/icon.md An example demonstrating a StatusCard component that uses an Icon to visually represent success or error states, with dynamic color and icon selection. ```tsx import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; import { Icon } from '@/components/ui/icon'; import { Text } from '@/components/ui/text'; import { CheckCircle2Icon, AlertCircleIcon } from 'lucide-react-native'; import { View } from 'react-native'; function StatusCard({ status }: { status: 'success' | 'error' }) { const isSuccess = status === 'success'; const IconComponent = isSuccess ? CheckCircle2Icon : AlertCircleIcon; const colorClass = isSuccess ? 'text-green-600' : 'text-red-600'; return ( {isSuccess ? 'Success' : 'Error'} Operation completed ); } ``` -------------------------------- ### Navigation Link to Sign Up Screen Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/routing.md Example of creating a navigation link from the sign-in screen to the sign-up screen using the Link component. The `asChild` prop allows for custom button rendering. ```typescript ``` -------------------------------- ### Input Auto Capitalize Examples Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/api-reference/input.md Illustrates autoCapitalize props for controlling text capitalization. Use to enforce specific capitalization rules. ```tsx ``` ```tsx ``` ```tsx ``` ```tsx ``` -------------------------------- ### Development Commands for Expo Templates Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/PROJECT_OVERVIEW.md Common npm scripts for running and building Expo applications. Use these to start the development server, launch simulators, or build for different platforms. ```bash npm run dev # Start Expo development server ``` ```bash npm run ios # Launch iOS simulator ``` ```bash npm run android # Launch Android emulator ``` ```bash npm run web # Run web version ``` ```bash npm run clean # Remove build artifacts ``` -------------------------------- ### Development Commands for React Native Reusables Templates Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/README.md These commands are used to manage the development workflow, including starting the development server, building for different platforms, and cleaning the project cache. ```bash npm run dev npm run ios npm run android npm run web npm run clean ``` -------------------------------- ### Tab-Based Navigation Example Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/routing.md Implement tab navigation by using the `Tabs` component from `expo-router`. This is an alternative to the default stack navigation used in templates. ```typescript import { Tabs } from 'expo-router'; ``` -------------------------------- ### Navigating with Dynamic Route Segments Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/routing.md Navigate to dynamic routes by constructing the URL with the segment values. This example shows navigation to a user profile page using a `userId`. ```typescript ``` -------------------------------- ### Drawer Navigation Example Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/routing.md Add drawer navigation to your Expo Router app using the `Drawer` component. This allows for a slide-out navigation menu. ```typescript import { Drawer } from 'expo-router/drawer'; ``` -------------------------------- ### Babel Configuration Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/configuration.md Configure Babel presets and plugins for Expo projects. This setup includes Expo Router and Reanimated animations. ```javascript module.exports = function (api) { api.cache(true); return { presets: ['babel-preset-expo'], plugins: [ require.resolve('expo-router/babel'), 'react-native-reanimated/plugin', ], }; }; ``` -------------------------------- ### Using NAV_THEME with React Navigation Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/api-reference/theme.md Example of integrating NAV_THEME with React Navigation using ThemeProvider. It dynamically selects the theme based on the system's color scheme. ```typescript import { NAV_THEME } from '@/lib/theme'; import { ThemeProvider } from '@react-navigation/native'; import { useColorScheme } from 'nativewind'; export default function RootLayout() { const { colorScheme } = useColorScheme(); return ( ); } ``` -------------------------------- ### Initiate OAuth Flow with useSSO Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/api-reference/clerk-auth.md Use the useSSO hook to start an OAuth flow for single sign-on. This function requires a strategy (e.g., 'oauth_google') and handles the redirect URL. It returns createdSessionId and setActive to manage the user session. ```typescript import { useSSO, type StartSSOFlowParams } from '@clerk/expo'; import * as AuthSession from 'expo-auth-session'; const { startSSOFlow } = useSSO(); async function handleOAuth(strategy: 'oauth_google' | 'oauth_github' | 'oauth_apple') { try { const { createdSessionId, setActive } = await startSSOFlow({ strategy, redirectUrl: AuthSession.makeRedirectUri(), }); if (createdSessionId && setActive) { await setActive({ session: createdSessionId }); } } catch (err) { // Handle error } } ``` -------------------------------- ### Controlled Input Example Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/api-reference/input.md Shows how to manage the Input component's state using React's useState hook. The 'value' and 'onChangeText' props are essential for this. ```tsx import { Input } from '@/components/ui/input'; import { useState } from 'react'; export function ControlledInput() { const [value, setValue] = useState(''); return ( ); } ``` -------------------------------- ### Input within a Form Context Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/api-reference/input.md Illustrates integrating Input components within a form, managing state for multiple fields, and using refs to control focus flow between inputs. This example includes email and password fields with submission handling. ```tsx import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Text } from '@/components/ui/text'; import { useState, useRef } from 'react'; import { View } from 'react-native'; export function SignUpForm() { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const passwordRef = useRef(null); function handleEmailSubmit() { passwordRef.current?.focus(); } return ( ); } ``` -------------------------------- ### Use Appropriate Keyboard Type Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/api-reference/input.md Set the `keyboardType` prop to improve user experience by displaying the most suitable keyboard for the input's expected content. For example, use `email-address` for email inputs and `numeric` for numerical inputs. ```tsx // ✅ Correct // ❌ Avoid - generic keyboard ``` -------------------------------- ### Navigation Link to Forgot Password Screen Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/routing.md Example of creating a navigation link from the sign-in screen to the forgot password screen, passing the user's email as a query parameter. This facilitates password recovery flows. ```typescript ``` -------------------------------- ### useSSO Hook Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/api-reference/clerk-auth.md Enables Single Sign-On (SSO) flows, allowing users to sign in using third-party providers like Google, GitHub, or Apple. It provides a function to start the SSO flow. ```APIDOC ## useSSO Hook ### Description Enables Single Sign-On (SSO) flows, allowing users to sign in using third-party providers like Google, GitHub, or Apple. It provides a function to start the SSO flow. ### Strategy Options - `oauth_apple` - Sign in with Apple - `oauth_google` - Sign in with Google - `oauth_github` - Sign in with GitHub ### Usage ```typescript import { useSSO, type StartSSOFlowParams } from '@clerk/expo'; import * as AuthSession from 'expo-auth-session'; const { startSSOFlow } = useSSO(); async function handleOAuth(strategy: 'oauth_google' | 'oauth_github' | 'oauth_apple') { try { const { createdSessionId, setActive } = await startSSOFlow({ strategy, redirectUrl: AuthSession.makeRedirectUri(), }); if (createdSessionId && setActive) { await setActive({ session: createdSessionId }); } } catch (err) { // Handle error } } ``` ``` -------------------------------- ### Apply Theme Colors with Tailwind Utility Classes Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/api-reference/theme.md Use Tailwind utility classes to apply theme colors for backgrounds, text, and borders. A combined example shows how to style a complete UI component. ```tsx // Background colors className="bg-background" className="bg-card" className="bg-primary" // Text colors className="text-foreground" className="text-muted-foreground" className="text-primary-foreground" // Border colors className="border-border" className="border-input" ``` ```tsx // Combined example Card title Subtitle ``` -------------------------------- ### Manual Build Commands Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/INDEX.md Alternative commands for manual builds of iOS, Android, and web platforms. ```bash npx expo export ``` -------------------------------- ### Disabled Input Example Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/api-reference/input.md Renders an Input component that is not editable. Set the 'editable' prop to 'false' to disable user interaction. ```tsx import { Input } from '@/components/ui/input'; ``` -------------------------------- ### Sign-Up Screen Options Configuration Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/api-reference/clerk-auth.md Configures the sign-up screen with modal presentation, an empty title, a transparent header, and disabled gestures. Use this for a modal sign-up flow with a clean interface. ```typescript const SIGN_UP_SCREEN_OPTIONS = { presentation: 'modal', title: '', headerTransparent: true, gestureEnabled: false, } as const; ``` -------------------------------- ### Initialize React Native Reusables Project Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/clerk-auth/README.md Use this command to initialize a new React Native project with the React Native Reusables CLI. Select the 'Clerk auth (Nativewind)' template when prompted. ```bash npx @react-native-reusables/cli@latest init ``` -------------------------------- ### Profile Card Display Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/_autodocs/api-reference/card.md An example of a Card component used to display user profile information, including an avatar and text details. ```tsx import { Card, CardContent } from '@/components/ui/card'; import { Avatar, AvatarImage, AvatarFallback } from '@/components/ui/avatar'; import { Text } from '@/components/ui/text'; import { View } from 'react-native'; {initials} {user.fullName} {user.email} ``` -------------------------------- ### React Native Reusables CLI Options Source: https://github.com/founded-labs/react-native-reusables-templates/blob/main/README.md These are the available options for the React Native Reusables CLI initialization command. Use -c or --cwd to specify the working directory, and -t or --template to select a specific template. ```bash -c, --cwd the working directory. defaults to the current directory. ``` ```bash -t, --template