/**
* Accordion Usage Example with Automatic Icon Rotation
*
* This example shows the new simplified API where icons automatically
* rotate when the accordion expands/collapses.
*/
import React from 'react';
import {
Accordion,
AccordionItem,
AccordionHeader,
AccordionTrigger,
AccordionTitleText,
AccordionIcon,
AccordionContent,
AccordionContentText,
} from './index';
import { ChevronDownIcon } from 'lucide-react-native'; // or your icon library
// ============================================================================
// BASIC USAGE - With Automatic Icon Rotation
// ============================================================================
export function BasicAccordionExample() {
return (
How do I place an order?
{/* Icon automatically rotates 180° when expanded! */}
To place an order, simply select the products you want, proceed to
checkout, provide shipping and payment information, and finalize
your purchase.
What payment methods do you accept?
We accept all major credit cards, including Visa, Mastercard, and
American Express. We also support payments through PayPal.
);
}
// ============================================================================
// COMPARISON: Old vs New Approach
// ============================================================================
// ❌ OLD APPROACH (manual icon switching)
export function OldApproach() {
return (
{({ isExpanded }) => (
<>
Question?
{/* Had to manually switch icons */}
{isExpanded ? (
) : (
)}
>
)}
);
}
// ✅ NEW APPROACH (automatic rotation)
export function NewApproach() {
return (
Question?
{/* Just one icon - it rotates automatically! */}
);
}
// ============================================================================
// ADVANCED: Still want manual control? You can!
// ============================================================================
export function ManualControlExample() {
return (
{({ isExpanded }) => (
<>
{isExpanded ? 'Click to collapse' : 'Click to expand'}
{/* Icon still rotates automatically */}
>
)}
);
}
// ============================================================================
// MULTIPLE ACCORDIONS
// ============================================================================
export function MultipleAccordionsExample() {
return (
Features
60fps animations, icon rotation, fully customizable.
Performance
Runs on UI thread using React Native Reanimated.
);
}
// ============================================================================
// NOTES
// ============================================================================
/**
* KEY BENEFITS:
*
* 1. ✨ Simpler code - no need to manually switch icons
* 2. 🎨 Smooth 60fps rotation animation
* 3. ⚙️ Customizable rotation angle in animation-config.ts
* 4. 🚀 Runs on UI thread (no JS blocking)
*
* CUSTOMIZATION:
*
* Edit `animation-config.ts` to customize:
* - contentDuration: How fast accordion expands/collapses
* - iconDuration: How fast icon rotates
* - iconRotation: Rotation angle (180° = upside down, 90° = quarter turn)
*
* For advanced customization, edit AnimatedIcon.tsx and AnimatedHeight.tsx
*/