Skip to content

Commit c4c4454

Browse files
committed
docs: document w-screen/h-screen restrictions
- Add restrictions section to sizing.md documenting modifier limitations - Fix indentation of closing ::: tag in arbitrary-values.md
1 parent a93968c commit c4c4454

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

docs/src/content/docs/advanced/arbitrary-values.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ CSS units not available in React Native:
181181
- `rem`, `em` - Use pixels instead
182182
- `vh`, `vw` - Use percentages or Dimensions API
183183
- `ch`, `ex` - Not supported in React Native
184-
:::
184+
:::
185185

186186
## Related
187187

docs/src/content/docs/reference/sizing.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,13 @@ function Component() {
165165
### Requirements
166166

167167
:::note
168-
`w-screen` and `h-screen` can only be used inside **function components**. They won't work in:
168+
`w-screen` and `h-screen` can only be used inside **function components** in the `className` attribute. They won't work in:
169169

170170
- Class components
171171
- Nested callbacks (e.g., inside `.map()` or `.filter()`)
172172
- Global/module-level code
173+
- With any modifiers (`dark:`, `ios:`, `active:`, etc.)
174+
- In `tw` tagged templates or `twStyle()` function calls
173175

174176
This is because they rely on React hooks, which follow the [Rules of Hooks](https://react.dev/warnings/invalid-hook-call-warning).
175177
:::
@@ -188,12 +190,18 @@ Unlike `w-full` and `h-full` which use percentage-based sizing, `w-screen` and `
188190

189191
### Combining with Other Classes
190192

191-
You can combine screen dimensions with other utilities:
193+
You can combine screen dimensions with **static utility classes only** (no modifiers):
192194

193195
```tsx
196+
{/* ✅ Allowed: static utilities */}
194197
<View className="w-screen h-screen bg-gray-100 p-4 items-center justify-center">
195198
<Text>Centered in full screen</Text>
196199
</View>
200+
201+
{/* ❌ Not allowed: modifiers */}
202+
<View className="w-screen dark:h-full" /> {/* Build error */}
203+
<View className="w-screen ios:bg-blue-500" /> {/* Build error */}
204+
<Pressable className="h-screen active:opacity-80" /> {/* Build error */}
197205
```
198206

199207
## Common Patterns

0 commit comments

Comments
 (0)