Build React Native UI components
✓Works with OpenClaudeYou are a React Native mobile developer. The user wants to build reusable UI components for React Native applications.
What to check first
- Verify React Native is installed:
npx react-native --version - Check your project has
react-nativeandreactinpackage.jsondependencies - Confirm you're targeting iOS, Android, or both platforms
Steps
- Import
View,Text,StyleSheet, andTouchableOpacityfromreact-nativeat the top of your component file - Define a functional component that accepts
propsas a parameter - Create a
StyleSheet.create()object below your component to define platform-optimized styles - Use
Viewas the root container instead ofdiv— it's the fundamental building block in React Native - Replace all HTML text with
<Text>components; plain strings won't render - Use
TouchableOpacityinstead of<button>for pressable elements and wraponPresshandlers (notonClick) - Apply styles via the
styleprop using the stylesheet or inline objects — CSS doesn't work in React Native - Export your component as the default export and test it in your app's main screen
Code
import React from 'react';
import {
View,
Text,
StyleSheet,
TouchableOpacity,
Alert,
} from 'react-native';
const CustomButton = ({ title, onPress, disabled = false, variant = 'primary' }) => {
const handlePress = () => {
if (!disabled && onPress) {
onPress();
}
};
return (
<TouchableOpacity
onPress={handlePress}
disabled={disabled}
activeOpacity={0.7}
style={[
styles.button,
variant === 'primary' && styles.primaryButton,
variant === 'secondary' && styles.secondaryButton,
disabled && styles.disabledButton,
]}
>
<Text
style={[
styles.buttonText,
variant === 'secondary' && styles.secondaryText,
disabled && styles.disabledText,
]}
>
{title}
</Text>
</TouchableOpacity>
);
};
const styles = StyleSheet.create({
button: {
paddingVertical: 12,
paddingHorizontal: 24,
borderRadius: 8,
alignItems: 'center',
justifyContent: 'center',
},
primaryButton: {
backgroundColor: '#007AFF',
},
secondaryButton: {
backgroundColor: '#E8E8E8',
},
disabledButton: {
backgroundColor: '#CCCCCC',
},
buttonText: {
fontSize: 16,
fontWeight: '600',
color
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related Mobile Skills
Other Claude Code skills in the same category — free to download.
React Native Screen
Create React Native screens with navigation
Expo Setup
Set up Expo project with common configurations
Mobile Navigation
Set up React Navigation with typed routes
Push Notification
Implement push notifications (Expo/Firebase)
Offline Storage
Set up offline storage (AsyncStorage, MMKV)
Mobile Auth Flow
Create mobile authentication flow
App Store Prep
Prepare app for App Store/Play Store submission
Deep Linking
Implement deep linking and universal links
Want a Mobile skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.