### Install Dependencies with npm
Source: https://github.com/nivlekrod/amparo/blob/main/README.md
Installs all necessary project dependencies using npm. Ensure Node.js and npm are installed on your system.
```bash
npm install
```
--------------------------------
### Start Expo Development Server
Source: https://github.com/nivlekrod/amparo/blob/main/README.md
Starts the Expo development server, allowing you to run your app on simulators, emulators, or Expo Go. This command is crucial for the development workflow.
```bash
npx expo start
```
--------------------------------
### Reset Expo Project to Blank State
Source: https://github.com/nivlekrod/amparo/blob/main/README.md
Resets the project by moving existing starter code to 'app-example' and creating a new, blank 'app' directory for development. Use this when starting fresh.
```bash
npm run reset-project
```
--------------------------------
### Expo Router Navigation Examples
Source: https://context7.com/nivlekrod/amparo/llms.txt
This snippet demonstrates various navigation patterns using Expo Router, including declarative navigation with the Link component for simple page transitions and deep linking, as well as programmatic navigation using the router object for actions like push, back, and replace. It also includes an example of using Link with a context menu on iOS.
```tsx
import { Link, router, useRouter } from 'expo-router';
import { ThemedText } from '@/components/themed-text';
import { ThemedView } from '@/components/themed-view';
import { Button } from 'react-native';
export default function NavigationExamples() {
const router = useRouter();
return (
{/* Declarative navigation with Link component */}
Go to HomeOpen ModalView Profile #123
{/* Programmatic navigation */}
);
}
```
--------------------------------
### Define Theme Color Palette and Font Families
Source: https://context7.com/nivlekrod/amparo/llms.txt
This example demonstrates the usage of a global theme color palette and font families defined in 'constants/theme.ts'. It shows how to apply theme-aware colors and platform-specific fonts to UI components like cards and text. It relies on 'react-native' and a custom 'useColorScheme' hook.
```tsx
// constants/theme.ts - Usage example
import { Colors, Fonts } from '@/constants/theme';
import { View, Text, StyleSheet } from 'react-native';
import { useColorScheme } from '@/hooks/use-color-scheme';
export default function ThemedCard() {
const colorScheme = useColorScheme() ?? 'light';
const colors = Colors[colorScheme];
return (
Card Title
Body text with serif font
New
const example = "monospace font";
);
}
const styles = StyleSheet.create({
card: {
padding: 16,
borderRadius: 12,
gap: 12,
},
title: {
fontSize: 20,
fontWeight: 'bold',
},
body: {
fontSize: 16,
lineHeight: 24,
},
badge: {
paddingHorizontal: 12,
paddingVertical: 6,
borderRadius: 16,
alignSelf: 'flex-start',
},
code: {
fontSize: 14,
padding: 8,
backgroundColor: '#f5f5f5',
},
});
// Available colors:
// Light mode: text=#11181C, background=#fff, tint=#0a7ea4, icon=#687076
// Dark mode: text=#ECEDEE, background=#151718, tint=#fff, icon=#9BA1A6
//
// Font families (platform-specific):
// iOS: sans='system-ui', serif='ui-serif', rounded='ui-rounded', mono='ui-monospace'
// Android: sans='normal', serif='serif', rounded='normal', mono='monospace'
// Web: Full system font stacks with fallbacks
```
--------------------------------
### Integrating Haptic Feedback on iOS with Expo Haptics
Source: https://context7.com/nivlekrod/amparo/llms.txt
This TypeScript/React Native component demonstrates integrating platform-specific haptic feedback using the `expo-haptics` library. It provides examples for light, medium, and heavy impacts, as well as notification and selection feedback types. The haptic feedback is conditionally applied only on iOS devices, with console logs indicating the action. It's important to note that haptics are iOS-specific and may require additional permissions on Android, while Web has no support.
```tsx
import * as Haptics from 'expo-haptics';
import { TouchableOpacity, View } from 'react-native';
import { ThemedText } from '@/components/themed-text';
export default function HapticExamples() {
const handleLightImpact = async () => {
if (process.env.EXPO_OS === 'ios') {
await Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
}
console.log('Light impact');
};
const handleMediumImpact = async () => {
if (process.env.EXPO_OS === 'ios') {
await Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium);
}
console.log('Medium impact');
};
const handleHeavyImpact = async () => {
if (process.env.EXPO_OS === 'ios') {
await Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Heavy);
}
console.log('Heavy impact');
};
const handleNotification = async () => {
if (process.env.EXPO_OS === 'ios') {
await Haptics.notificationAsync(
Haptics.NotificationFeedbackType.Success
);
}
console.log('Notification success');
};
const handleSelection = async () => {
if (process.env.EXPO_OS === 'ios') {
await Haptics.selectionAsync();
}
console.log('Selection changed');
};
return (
Light Impact (used in tab navigation)Medium ImpactHeavy ImpactNotification SuccessSelection Feedback
);
}
// Note: Haptics only work on iOS physical devices
// Android requires additional vibration permissions
// Web has no haptic feedback support
```
--------------------------------
### React Native Image Handling with Expo Image
Source: https://context7.com/nivlekrod/amparo/llms.txt
This code snippet demonstrates how to use the 'expo-image' library for various image management tasks in React Native. It includes handling local images with automatic density selection, remote images with caching and placeholders, and using images as backgrounds with overlaid content. The 'expo-image' library simplifies image loading and display, improving performance and user experience.
```tsx
import { Image } from 'expo-image';
import { ThemedView } from '@/components/themed-view';
import { ThemedText } from '@/components/themed-text';
export default function ImageExamples() {
return (
{/* Automatic density selection */}
{/*
React Native automatically selects:
- react-logo.png for 1x displays (mdpi)
- react-logo@2x.png for 2x displays (xhdpi, xxhdpi)
- react-logo@3x.png for 3x displays (xxxhdpi)
*/}
{/* Remote image with caching */}
{/* Static assets with specific density */}
App icon automatically scaled
{/* Background image */}
Overlay Text
);
}
// Asset organization:
// assets/images/icon.png (required for 1x)
// assets/images/icon@2x.png (optional for 2x)
// assets/images/icon@3x.png (optional for 3x)
```
--------------------------------
### Expo Router Root Layout Configuration
Source: https://context7.com/nivlekrod/amparo/llms.txt
This snippet shows the root layout configuration for an Expo Router application. It sets up the navigation stack using `expo-router`'s `Stack` component and integrates with `@react-navigation/native` for theme management. It defines screens, including a main tab navigation, a modal screen with specific presentation options, and other regular screens with customizable headers.
```tsx
// app/_layout.tsx
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native';
import { Stack } from 'expo-router';
import { StatusBar } from 'expo-status-bar';
import { useColorScheme } from '@/hooks/use-color-scheme';
// Set default route to tabs
export const unstable_settings = {
anchor: '(tabs)',
};
export default function RootLayout() {
const colorScheme = useColorScheme();
return (
{/* Main tab navigation - header hidden */}
{/* Modal screen with modal presentation */}
{/* Add more screens as needed */}
{/* Auto-adjusts based on theme */}
);
}
```
--------------------------------
### Displaying Icons Cross-Platform with SF Symbols and Material Icons
Source: https://context7.com/nivlekrod/amparo/llms.txt
This TypeScript/React Native component displays icons using the IconSymbol component. It leverages SF Symbols on iOS and Material Icons on Android/Web. The component accepts icon names, sizes, colors, weights, and styles as props. It includes a mapping from SF Symbol names to Material Icon names for cross-platform compatibility. Note that 'weight' accepts a specific set of predefined values.
```tsx
import { IconSymbol } from '@/components/ui/icon-symbol';
import { ThemedView } from '@/components/themed-view';
import { Colors } from '@/constants/theme';
import { useColorScheme } from '@/hooks/use-color-scheme';
export default function IconExamples() {
const colorScheme = useColorScheme() ?? 'light';
const iconColor = Colors[colorScheme].icon;
return (
{/* SF Symbol on iOS, Material Icon on Android/Web */}
{/* Weights: ultraLight, thin, light, regular, medium, semibold, bold, heavy, black */}
);
}
// SF Symbol to Material Icon mapping:
// 'house.fill' → 'home'
// 'paperplane.fill' → 'send'
// 'chevron.left.forwardslash.chevron.right' → 'code'
// 'chevron.right' → 'chevron-right'
```
--------------------------------
### useColorScheme Hook for Platform-Specific Color Schemes (React Native/Web)
Source: https://context7.com/nivlekrod/amparo/llms.txt
A custom hook that retrieves the current color scheme, offering platform-specific handling for web SSR hydration. It returns 'light', 'dark', or null for system default. Dependencies include '@/hooks/use-color-scheme' and '@/constants/theme'.
```tsx
import { useColorScheme } from '@/hooks/use-color-scheme';
import { Colors } from '@/constants/theme';
export default function AdaptiveComponent() {
const colorScheme = useColorScheme(); // Returns 'light' | 'dark' | null
// Apply theme-specific logic
const isDark = colorScheme === 'dark';
const backgroundColor = isDark ? Colors.dark.background : Colors.light.background;
return (
Current theme: {colorScheme ?? 'system default'}
{isDark && Dark mode is active}
);
}
// Web-specific: Prevents hydration mismatch during SSR
// Native: Direct access to system color scheme via React Native
```
--------------------------------
### Configure Bottom Tab Navigator with Haptic Feedback and Theme Icons
Source: https://context7.com/nivlekrod/amparo/llms.txt
This snippet configures a bottom tab navigator using Expo Router. It includes haptic feedback on tab presses (iOS only) and uses theme-aware icons. Dependencies include 'expo-router', 'react-native', and custom components for haptic tabs and icon symbols.
```tsx
// app/(tabs)/_layout.tsx
import { Tabs } from 'expo-router';
import { HapticTab } from '@/components/haptic-tab';
import { IconSymbol } from '@/components/ui/icon-symbol';
import { Colors } from '@/constants/theme';
import { useColorScheme } from '@/hooks/use-color-scheme';
export default function TabLayout() {
const colorScheme = useColorScheme();
return (
(
),
}}
/>
(
),
}}
/>
(
),
// Show badge on tab
tabBarBadge: 3,
}}
/>
);
}
```
--------------------------------
### ExternalLink Component for Cross-Platform Linking
Source: https://context7.com/nivlekrod/amparo/llms.txt
The ExternalLink component allows opening URLs in the system browser on native platforms (iOS/Android) or a new tab on web. It supports custom styling and can be used with nested components for link text or custom button-like appearances. This component ensures consistent link behavior across different environments.
```tsx
import { ExternalLink } from '@/components/external-link';
import { ThemedText } from '@/components/themed-text';
import { ThemedView } from '@/components/themed-view';
export default function ResourcesScreen() {
return (
External Resources
{/* Opens in-app browser on iOS/Android, new tab on web */}
Expo DocumentationReact Native Docs
{/* Styled external link with custom appearance */}
View on GitHub
{/* Native: expo-web-browser with AUTOMATIC presentation style */}
{/* Web: Opens in new tab via target="_blank" */}
);
}
```
--------------------------------
### Collapsible Component for Expandable Sections (React Native)
Source: https://context7.com/nivlekrod/amparo/llms.txt
A reusable component that creates an expandable/collapsible section with an animated chevron icon and theme-aware styling. It relies on '@/components/ui/collapsible', '@/components/themed-text', and '@/components/themed-view'.
```tsx
import { Collapsible } from '@/components/ui/collapsible';
import { ThemedText } from '@/components/themed-text';
import { ThemedView } from '@/components/themed-view';
export default function FAQScreen() {
return (
Frequently Asked Questions
Expo Router is a file-based routing system for React Native apps.
It uses the file system to define your app's navigation structure,
similar to Next.js for web applications.
Features include: typed routes, deep linking, modal presentations,
and seamless navigation between screens.
The app automatically detects your device's color scheme
(light or dark) and applies the appropriate theme colors
from constants/theme.ts.
• iOS: SF Symbols, haptic feedback, context menus
• Android: Material Icons, edge-to-edge display
• Web: Static site generation, responsive layouts
);
}
```
--------------------------------
### ThemedText Component in TypeScript (React Native)
Source: https://context7.com/nivlekrod/amparo/llms.txt
The ThemedText component provides theme-aware text rendering, automatically adapting its color and typography based on the current light or dark mode. It supports predefined text types and allows for custom color overrides. This component is crucial for maintaining consistent UI theming across the application.
```tsx
import { ThemedText } from '@/components/themed-text';
// Basic usage with predefined types
export default function MyScreen() {
return (
<>
Welcome to AmparoAppGetting Started GuideImportant InformationRegular body text that adapts to themeClick here to learn more
>
);
}
// Custom colors override theme defaults
function CustomThemedExample() {
return (
<>
Red in light mode, green in dark mode
Uses default light color, white in dark mode
>
);
}
// Typography reference:
// - default: 16px, lineHeight 24
// - title: 32px bold, lineHeight 32
// - defaultSemiBold: 16px, fontWeight 600, lineHeight 24
// - subtitle: 20px bold
// - link: 16px, color #0a7ea4, lineHeight 30
```
--------------------------------
### ParallaxScrollView Component for Animated Scroll Effects (React Native)
Source: https://context7.com/nivlekrod/amparo/llms.txt
An advanced scroll view component that implements an animated parallax header effect using react-native-reanimated. It requires components from '@/components/parallax-scroll-view', 'expo-image', '@/components/themed-text', and '@/components/themed-view'.
```tsx
import ParallaxScrollView from '@/components/parallax-scroll-view';
import { Image } from 'expo-image';
import { ThemedText } from '@/components/themed-text';
import { ThemedView } from '@/components/themed-view';
export default function ProductScreen() {
return (
}>
Product Details
The header image scales and translates as you scroll, creating
a smooth parallax effect. Scroll up to see the header zoom in,
scroll down to see it translate away.
Features• Header height: 250px• Parallax range: -125px to 187.5px• Scale effect: 1x to 2x on upward scroll• Scroll throttle: 16ms (60fps)
{/* Add more content to enable scrolling */}
{[...Array(10)].map((_, i) => (
Content section {i + 1}
))}
);
}
```
--------------------------------
### ThemedView Component in TypeScript (React Native)
Source: https://context7.com/nivlekrod/amparo/llms.txt
The ThemedView component offers theme-aware background colors, automatically adjusting to the current color scheme (light/dark mode). It can apply default theme backgrounds or accept custom background colors for specific elements. This component is essential for creating visually consistent containers that adapt to user preferences.
```tsx
import { ThemedView } from '@/components/themed-view';
import { ThemedText } from '@/components/themed-text';
export default function ProfileScreen() {
return (
User Profile
{/* Nested themed views with custom colors */}
This card adapts its background to the themeLight mode: #F5F5F5, Dark mode: #2A2A2A
{/* Default themed background */}
Uses default background colors from theme palette
Light: #fff, Dark: #151718
);
}
```
--------------------------------
### useThemeColor Hook in TypeScript (React Native)
Source: https://context7.com/nivlekrod/amparo/llms.txt
The useThemeColor hook provides a convenient way to access theme-aware color values within React Native components. It allows for specifying custom light and dark color overrides or falling back to the global color palette defined in the theme. This hook simplifies the management of colors across different themes and UI elements.
```tsx
import { useThemeColor } from '@/hooks/use-theme-color';
import { View, Text } from 'react-native';
function CustomButton() {
// Get theme color with custom overrides
const backgroundColor = useThemeColor(
{ light: '#0a7ea4', dark: '#ffffff' },
'tint'
);
const textColor = useThemeColor(
{ light: '#ffffff', dark: '#000000' },
'text'
);
return (
Themed Button
);
}
function IconWithThemeColor() {
// Use default palette colors (no custom colors)
const iconColor = useThemeColor({}, 'icon');
const tintColor = useThemeColor({}, 'tint');
return (
<>
{/* #687076 light, #9BA1A6 dark */}
{/* #0a7ea4 light, #fff dark */}
>
);
}
// Available color keys from palette:
// 'text', 'background', 'tint', 'icon', 'tabIconDefault', 'tabIconSelected'
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.