React Native Design

React Native Design

Guides React Native styling, React Navigation and Reanimated animations for cross-platform mobile apps, with component examples, gestures and performance tips.

Skill files5 files

references/

SKILL.md130 lines
1
---
2
name: react-native-design
3
description: Master React Native styling, navigation, and Reanimated animations for cross-platform mobile development. Use when building React Native apps, implementing navigation patterns, or creating performant animations.
4
---
5
6
# React Native Design
7
8
Master React Native styling patterns, React Navigation, and Reanimated 3 to build performant, cross-platform mobile applications with native-quality user experiences.
9
10
## When to Use This Skill
11
12
- Building cross-platform mobile apps with React Native
13
- Implementing navigation with React Navigation 6+
14
- Creating performant animations with Reanimated 3
15
- Styling components with StyleSheet and styled-components
16
- Building responsive layouts for different screen sizes
17
- Implementing platform-specific designs (iOS/Android)
18
- Creating gesture-driven interactions with Gesture Handler
19
- Optimizing React Native performance
20
21
## Detailed section: Core Concepts
22
23
Originally a 6471-byte section in this SKILL.md. Moved to `references/details.md` to fit Codex's 8 KB skill body cap.
24
25
## Quick Start Component
26
27
```typescript
28
import React from 'react';
29
import {
30
View,
31
Text,
32
StyleSheet,
33
Pressable,
34
Image,
35
} from 'react-native';
36
import Animated, {
37
useSharedValue,
38
useAnimatedStyle,
39
withSpring,
40
} from 'react-native-reanimated';
41
42
interface ItemCardProps {
43
title: string;
44
subtitle: string;
45
imageUrl: string;
46
onPress: () => void;
47
}
48
49
const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
50
51
export function ItemCard({ title, subtitle, imageUrl, onPress }: ItemCardProps) {
52
const scale = useSharedValue(1);
53
54
const animatedStyle = useAnimatedStyle(() => ({
55
transform: [{ scale: scale.value }],
56
}));
57
58
return (
59
<AnimatedPressable
60
style={[styles.card, animatedStyle]}
61
onPress={onPress}
62
onPressIn={() => { scale.value = withSpring(0.97); }}
63
onPressOut={() => { scale.value = withSpring(1); }}
64
>
65
<Image source={{ uri: imageUrl }} style={styles.image} />
66
<View style={styles.content}>
67
<Text style={styles.title} numberOfLines={1}>
68
{title}
69
</Text>
70
<Text style={styles.subtitle} numberOfLines={2}>
71
{subtitle}
72
</Text>
73
</View>
74
</AnimatedPressable>
75
);
76
}
77
78
const styles = StyleSheet.create({
79
card: {
80
backgroundColor: '#ffffff',
81
borderRadius: 16,
82
overflow: 'hidden',
83
shadowColor: '#000',
84
shadowOffset: { width: 0, height: 2 },
85
shadowOpacity: 0.1,
86
shadowRadius: 8,
87
elevation: 4,
88
},
89
image: {
90
width: '100%',
91
height: 160,
92
backgroundColor: '#f3f4f6',
93
},
94
content: {
95
padding: 16,
96
gap: 4,
97
},
98
title: {
99
fontSize: 18,
100
fontWeight: '600',
101
color: '#1f2937',
102
},
103
subtitle: {
104
fontSize: 14,
105
color: '#6b7280',
106
lineHeight: 20,
107
},
108
});
109
```
110
111
## Best Practices
112
113
1. **Use TypeScript**: Define navigation and prop types for type safety
114
2. **Memoize Components**: Use `React.memo` and `useCallback` to prevent unnecessary rerenders
115
3. **Run Animations on UI Thread**: Use Reanimated worklets for 60fps animations
116
4. **Avoid Inline Styles**: Use StyleSheet.create for performance
117
5. **Handle Safe Areas**: Use `SafeAreaView` or `useSafeAreaInsets`
118
6. **Test on Real Devices**: Simulator/emulator performance differs from real devices
119
7. **Use FlatList for Lists**: Never use ScrollView with map for long lists
120
8. **Platform-Specific Code**: Use Platform.select for iOS/Android differences
121
122
## Common Issues
123
124
- **Gesture Conflicts**: Wrap gestures with `GestureDetector` and use `simultaneousHandlers`
125
- **Navigation Type Errors**: Define `ParamList` types for all navigators
126
- **Animation Jank**: Move animations to UI thread with `runOnUI` worklets
127
- **Memory Leaks**: Cancel animations and cleanup in useEffect
128
- **Font Loading**: Use `expo-font` or `react-native-asset` for custom fonts
129
- **Safe Area Issues**: Test on notched devices (iPhone, Android with cutouts)
130

© Seth Hobson · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 11,554 prompts

More by @OpenSourceBuffGuy

See all
Sizzling Cheeseburger Close-Up prompt image

Sizzling Cheeseburger Close-Up

Draws a hyper-realistic macro shot of a sizzling cheeseburger with melting cheddar, steam, sparks and floating embers on a black background.

image-prompt, nano-banana, photorealistic, food-photography, macro, close-up, dramatic-lighting, cinematic, bokeh, vibrant-colors, still-life, advertising, product-photography, for-photographers, moody, quick

Woman Escapes a Follower Through a Night Market prompt image

Woman Escapes a Follower Through a Night Market

Generates a 30-second photorealistic urban chase thriller in a crowded evening market, with handheld shots, diegetic sound only and a locked-off ending.

video-prompt, action, photorealistic, handheld, camera-movement, tracking-shot, low-angle, night-scene, cityscape, thriller, negative-prompt, single-take, timed-beats, pov, seedance, cinematic, multi-shot, quick

Exit Interview Theme Summary prompt image

Exit Interview Theme Summary

Aggregates pasted exit-interview notes into recurring themes, reasons for leaving and what would have helped, kept anonymous, as input for retention discussions.

human-resources, summarizer, sentiment-analysis, for-recruiters, placeholders, guardrails, data-analysis, trend-analysis, report, objective, employee-training, quick, performance-reviews, data-privacy, for-managers

Reviews

Loading reviews…

Discussion

Loading comments…