Files
agent-skills/skills/vercel-react-native-skills/rules/ui-safe-area-scroll.md
Jason Woltje f5792c40be feat: Complete fleet — 94 skills across 10+ domains
Pulled ALL skills from 15 source repositories:
- anthropics/skills: 16 (docs, design, MCP, testing)
- obra/superpowers: 14 (TDD, debugging, agents, planning)
- coreyhaines31/marketingskills: 25 (marketing, CRO, SEO, growth)
- better-auth/skills: 5 (auth patterns)
- vercel-labs/agent-skills: 5 (React, design, Vercel)
- antfu/skills: 16 (Vue, Vite, Vitest, pnpm, Turborepo)
- Plus 13 individual skills from various repos

Mosaic Stack is not limited to coding — the Orchestrator and
subagents serve coding, business, design, marketing, writing,
logistics, analysis, and more.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 16:27:42 -06:00

66 lines
1.5 KiB
Markdown

---
title: Use contentInsetAdjustmentBehavior for Safe Areas
impact: MEDIUM
impactDescription: native safe area handling, no layout shifts
tags: safe-area, scrollview, layout
---
## Use contentInsetAdjustmentBehavior for Safe Areas
Use `contentInsetAdjustmentBehavior="automatic"` on the root ScrollView instead of wrapping content in SafeAreaView or manual padding. This lets iOS handle safe area insets natively with proper scroll behavior.
**Incorrect (SafeAreaView wrapper):**
```tsx
import { SafeAreaView, ScrollView, View, Text } from 'react-native'
function MyScreen() {
return (
<SafeAreaView style={{ flex: 1 }}>
<ScrollView>
<View>
<Text>Content</Text>
</View>
</ScrollView>
</SafeAreaView>
)
}
```
**Incorrect (manual safe area padding):**
```tsx
import { ScrollView, View, Text } from 'react-native'
import { useSafeAreaInsets } from 'react-native-safe-area-context'
function MyScreen() {
const insets = useSafeAreaInsets()
return (
<ScrollView contentContainerStyle={{ paddingTop: insets.top }}>
<View>
<Text>Content</Text>
</View>
</ScrollView>
)
}
```
**Correct (native content inset adjustment):**
```tsx
import { ScrollView, View, Text } from 'react-native'
function MyScreen() {
return (
<ScrollView contentInsetAdjustmentBehavior='automatic'>
<View>
<Text>Content</Text>
</View>
</ScrollView>
)
}
```
The native approach handles dynamic safe areas (keyboard, toolbars) and allows content to scroll behind the status bar naturally.