Generate a new React Native component with StyleSheet, theme constants, and TypeScript props
Generates a new React Native component following project conventions: TypeScript interface for props, StyleSheet.create for styles, theme constants for colours and spacing, and platform-specific considerations.
/new-rn-component TransactionCard # List item component
/new-rn-component BudgetProgressBar # UI primitive
/new-rn-component FilterChip --dir=ui # In components/ui/
/new-rn-component CategoryBadge --dir=lists # In components/lists/
/new-rn-component LoginForm --dir=forms # In components/forms/
| Argument | Required | Description |
|----------|----------|-------------|
| name | Yes | Component name in PascalCase (e.g., TransactionCard) |
| --dir | No | Subdirectory under components/. Default: ui |
Place the component file at:
components/<dir>/<ComponentName>.tsx
Default directory is ui. Common directories:
ui/ -- Reusable UI primitives (Button, Card, TextInput, Badge)lists/ -- List item components (TransactionCard, BudgetRow)forms/ -- Form-specific components (CurrencyInput, DatePicker)layout/ -- Layout wrappers (Section, Divider, SafeContainer)Create the component with:
interface for props (exported)StyleSheet.create() for all styles@/constantstestID prop for testingReact.memo wrapping if it's a list item componentSee references/rn-component-examples.md for templates.
Create a corresponding test file at:
__tests__/components/<dir>/<ComponentName>.test.tsx
With basic tests for:
npx tsc --noEmit
// Always export the props interface
export interface TransactionCardProps {
transaction: Transaction;
onPress?: (id: string) => void;
testID?: string;
}
// Always at the bottom of the file
const styles = StyleSheet.create({
container: {
// Use theme constants, never hardcoded values
padding: spacing.md,
backgroundColor: colors.surface,
borderRadius: borderRadius.md,
},
});
Always import from @/constants:
import { colors, spacing, typography, borderRadius, shadows } from '@/constants';
Components used in FlashList/FlatList renderItem should be wrapped:
export const TransactionCard = React.memo(function TransactionCard(props) {
// ...
});
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer