You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are an expert in TypeScript, React Native, Expo, and Mobile App Development.
2
+
3
+
Code Style and Structure:
4
+
5
+
- Write concise, type-safe TypeScript code.
6
+
- Use functional components and hooks over class components.
7
+
- Ensure components are modular, reusable, and maintainable.
8
+
- Organize files by feature, grouping related components, hooks, and styles.
9
+
10
+
Naming Conventions:
11
+
12
+
- Use camelCase for variable and function names (e.g., `isFetchingData`, `handleUserInput`).
13
+
- Use PascalCase for component names (e.g., `UserProfile`, `ChatScreen`).
14
+
- Directory and File names should be lowercase and hyphenated (e.g., `user-profile`, `chat-screen`).
15
+
16
+
TypeScript Usage:
17
+
18
+
- Use TypeScript for all components, favoring interfaces for props and state.
19
+
- Enable strict typing in `tsconfig.json`.
20
+
- Avoid using `any`; strive for precise types.
21
+
- Utilize `React.FC` for defining functional components with props.
22
+
23
+
Performance Optimization:
24
+
25
+
- Minimize `useEffect`, `useState`, and heavy computations inside render methods.
26
+
- Use `React.memo()` for components with static props to prevent unnecessary re-renders.
27
+
- Optimize FlatLists with props like `removeClippedSubviews`, `maxToRenderPerBatch`, and `windowSize`.
28
+
- Use `getItemLayout` for FlatLists when items have a consistent size to improve performance.
29
+
- Avoid anonymous functions in `renderItem` or event handlers to prevent re-renders.
30
+
31
+
UI and Styling:
32
+
33
+
- Use consistent styling leveraging `gluestack-ui`. If there isn't a Gluestack component in the `components/ui` directory for the component you are trying to use consistently style it either through `StyleSheet.create()` or Styled Components.
34
+
- Ensure responsive design by considering different screen sizes and orientations.
35
+
- Optimize image handling using libraries designed for React Native, like `react-native-fast-image`.
36
+
37
+
Best Practices:
38
+
39
+
- Follow React Native's threading model to ensure smooth UI performance.
40
+
- Use React Navigation for handling navigation and deep linking with best practices.
41
+
- Create and use Jest to test to validate all generated components
42
+
- Generate tests for all components, services and logic generated. Ensure tests run without errors and fix any issues.
43
+
44
+
Additional Rules:
45
+
46
+
- Use `yarn` as the package manager.
47
+
- Use Expo's secure store for sensitive data
48
+
- Implement proper offline support
49
+
- Use `zustand` for state management
50
+
- Use `react-hook-form` for form handling
51
+
- Use `react-query` for data fetching
52
+
- Use `react-i18next` for internationalization
53
+
- Use `react-native-mmkv` for local storage
54
+
- Use `axios` for API requests
55
+
- Use `@rnmapbox/maps` for maps, mapping or vehicle navigation
56
+
- Use `lucide-react-native` for icons and use those components directly in the markup and don't use the gluestack-ui icon component
0 commit comments