Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Build performant React Native and Expo apps with best practices for lists, animations, and navigation
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
rules/imports-design-system-folder.md
1---2title: Import from Design System Folder3impact: LOW4impactDescription: enables global changes and easy refactoring5tags: imports, architecture, design-system6---78## Import from Design System Folder910Re-export dependencies from a design system folder. App code imports from there,11not directly from packages. This enables global changes and easy refactoring.1213**Incorrect (imports directly from package):**1415```tsx16import { View, Text } from 'react-native'17import { Button } from '@ui/button'1819function Profile() {20return (21<View>22<Text>Hello</Text>23<Button>Save</Button>24</View>25)26}27```2829**Correct (imports from design system):**3031```tsx32// components/view.tsx33import { View as RNView } from 'react-native'3435// ideal: pick the props you will actually use to control implementation36export function View(37props: Pick<React.ComponentProps<typeof RNView>, 'style' | 'children'>38) {39return <RNView {...props} />40}41```4243```tsx44// components/text.tsx45export { Text } from 'react-native'46```4748```tsx49// components/button.tsx50export { Button } from '@ui/button'51```5253```tsx54import { View } from '@/components/view'55import { Text } from '@/components/text'56import { Button } from '@/components/button'5758function Profile() {59return (60<View>61<Text>Hello</Text>62<Button>Save</Button>63</View>64)65}66```6768Start by simply re-exporting. Customize later without changing app code.69