Introduction
CricTalk’s component architecture is built with React Native and follows a modular, reusable design pattern. The component library includes UI elements for posts, comments, match rooms, modals, leaderboards, and utility components that maintain consistent styling and behavior throughout the application.Component Organization
All reusable components are located in theapp/components/ directory:
Styling Approach
NativeWind (Tailwind CSS)
CricTalk uses NativeWind for styling, which brings Tailwind CSS utility classes to React Native:Color Palette
The application uses a consistent color scheme:- Primary: Orange (
orange-500,orange-600) - Text: Slate shades (
slate-900,slate-800,slate-600) - Backgrounds: White, gray shades (
gray-200,gray-300) - Status Colors: Green (live), Yellow (upcoming), Red (finished)
Common Styling Patterns
Interactive Elements
All pressable elements use consistent active states:Rounded Avatars
User avatars follow this pattern:Card Layouts
Cards use consistent spacing and borders:Common Props and Patterns
User Identification
Many components requireuserId to determine ownership and enable conditional rendering:
Data Models
Components receive typed data objects defined in schemas:- Post: From
@/schemas/PostSchema - Comment: From
@/schemas/CommentSchema - Room: From
@/schemas/RoomSchema - UserStats: From
@/interfaces/UserStats
Callback Props
Components use standard callback naming:onPress: Generic press actiononClose: Modal/drawer close actiononEditPress: Edit actiononDeletePress: Delete action
State Management Integration
Zustand Stores
Components integrate with global state using Zustand stores:Custom Hooks
Components leverage custom hooks for common operations:useLikePost(): Handle post likesuseDeletePost(): Delete post functionalityuseCreatePost(): Create new postsuseViewPost(): Track post views
Icon Usage
Components use@expo/vector-icons (Ionicons) for consistent iconography:
heart-outline/heart-sharp: Likeschatbox-ellipses-outline: Commentseye-outline: Viewspencil-outline: Edittrash-outline: Deleteadd: Create new
Modal Patterns
Modals in CricTalk follow a consistent pattern:Navigation Integration
Components use Expo Router for navigation:Accessibility Considerations
- All interactive elements use
<Pressable>for better accessibility - Text colors maintain sufficient contrast ratios
- Touch targets meet minimum size requirements (44x44 points)
- Visual feedback on all interactive states
Performance Optimizations
List Rendering
Components use@legendapp/list for optimized list rendering:
Component Memoization
Components can be wrapped withReact.memo() for performance when needed.
Best Practices
- Type Safety: Always define TypeScript types for props
- Consistent Naming: Use clear, descriptive prop and variable names
- Modular Design: Keep components focused on a single responsibility
- Reusability: Extract common patterns into shared components
- Error Handling: Use toast notifications for user feedback
- Loading States: Show activity indicators during async operations
- Empty States: Provide meaningful empty state components with CTAs
Next Steps
- UI Components API Reference - Detailed documentation for each component
- Post Hooks - Custom hooks for posts and interactions
- Architecture - Technical architecture and state management