react-native-web-styling
FreeNo executable scriptsNot checkedUse when styling React Native Web components. Provides patterns for StyleSheet API, platform-specific styles, responsive design, and theming.
by TheBushidoCollective★ 202 GitHub starsAbout this skill
React Native Web - Styling
Comprehensive styling patterns for React Native Web, including responsive design, theming, and platform-specific styles.
Key Concepts
StyleSheet API
Use StyleSheet.create() for optimized styles:
import { StyleSheet } from 'react-native';
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
padding: 16,
},
text: {
fontSize: 16,
color: '#333',
lineHeight: 24,
},
});
Flexbox Layout
React Native uses Flexbox for layout (defaults differ from web):
const styles = StyleSheet.create({
// Default flexDirection is 'column' (not 'row' like web)
container: {
flex: 1,
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
},
});
Platform-Specific Styles
Use Platform.select() for different styles per platform:
import { Platform, StyleSheet } from 'react-native';
const styles = StyleSheet.create({
container: {
...Platform.select({
web: {
maxWidth: 1200,
marginHorizontal: 'auto',
},
native: {
paddingHorizontal: 16,
},
}),
},
});
Best Practices
Responsive Design
✅ Use percentage-based widths and flexbox:
const styles = StyleSheet.create({
container: {
width: '100%',
maxWidth: 1200,
},
column: {
flex: 1,
minWidth: 300,
},
row: {
flexDirection: 'row',
flexWrap: 'wrap',
},
});
Media Queries (Web)
✅ Use useWindowDimensions for responsive behavior:
import { useWindowDimensions, StyleSheet } from 'react-native';
function ResponsiveComponent() {
const { width } = useWindowDimensions();
const isDesktop = width >= 768;
return (
<View style={[styles.container, isDesktop && styles.containerDesktop]}>
{/* Content */}
</View>
);
}
const styles = StyleSheet.create({
container: {
padding: 16,
},
containerDesktop: {
padding: 32,
maxWidth: 1200,
},
});
Theming
✅ Create a theme context:
import React, { createContext, useContext, ReactNode } from 'react';
interface Theme {
colors: {
primary: string;
background: string;
text: string;
border: string;
};
spacing: {
xs: number;
sm: number;
md: number;
lg: number;
xl: number;
};
}
const lightTheme: Theme = {
colors: {
primary: '#007AFF',
background: '#FFFFFF',
text: '#000000',
border: '#E5E5E5',
},
spacing: {
xs: 4,
sm: 8,
md: 16,
lg: 24,
xl: 32,
},
};
const ThemeContext = createContext<Theme>(lightTheme);
export function ThemeProvider({ children }: { children: ReactNode }) {
return (
<ThemeContext.Provider value={lightTheme}>
{children}
</ThemeContext.Provider>
);
}
export function useTheme() {
return useContext(ThemeContext);
}
Examples
Styled Component
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
interface ButtonProps {
title: string;
variant?: 'primary' | 'secondary';
size?: 'small' | 'medium' | 'large';
onPress: () => void;
}
export function Button({
title,
variant = 'primary',
size = 'medium',
onPress
}: ButtonProps) {
return (
<Pressable onPress={onPress}>
<View style={[styles.button, styles[variant], styles[size]]}>
<Text style={[styles.text, styles[`${variant}Text`]]}>{title}</Text>
</View>
</Pressable>
);
}
const styles = StyleSheet.create({
button: {
borderRadius: 8,
justifyContent: 'center',
alignItems: 'center',
},
primary: {
backgroundColor: '#007AFF',
},
secondary: {
backgroundColor: 'transparent',
borderWidth: 1,
borderColor: '#007AFF',
},
small: {
paddingHorizontal: 12,
paddingVertical: 6,
},
medium: {
paddingHorizontal: 16,
paddingVertical: 10,
},
large: {
paddingHorizontal: 24,
paddingVertical: 14,
},
text: {
fontWeight: '600',
},
primaryText: {
color: '#FFFFFF',
},
secondaryText: {
color: '#007AFF',
},
});
Responsive Grid
import React from 'react';
import { View, StyleSheet, useWindowDimensions } from 'react-native';
interface GridProps {
children: React.ReactNode;
columns?: number;
gap?: number;
}
export function Grid({ children, columns = 3, gap = 16 }: GridProps) {
const { width } = useWindowDimensions();
// Responsive columns
const responsiveColumns = width < 640 ? 1 : width < 1024 ? 2 : columns;
return (
<View style={[styles.grid, { gap }]}>
{React.Children.map(children, (child) => (
<View style={[styles.gridItem, {
width: `${100 / responsiveColumns}%`,
padding: gap / 2,
}]}>
{child}
</View>
))}
</View>
);
}
const styles = StyleSheet.create({
grid: {
flexDirection: 'row',
flexWrap: 'wrap',
Install react-native-web-styling in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
ReadWriteEditBashGrepGlobFAQ
What does the react-native-web-styling skill do?
Use when styling React Native Web components. Provides patterns for StyleSheet API, platform-specific styles, responsive design, and theming.
How do I install the react-native-web-styling skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the react-native-web-styling skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic