You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/content/docs/guides/state-modifiers.md
+13-17Lines changed: 13 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,8 +5,8 @@ description: Apply styles based on component state with zero runtime overhead
5
5
6
6
Apply styles based on component state using modifiers like `active:`, `focus:`, and `disabled:`. The Babel plugin automatically generates optimized style functions.
7
7
8
-
:::note[Enhanced Components Required]
9
-
State modifiers require using the enhanced `Pressable` and `TextInput` components from `@mgcrea/react-native-tailwind`.
8
+
:::note[Enhanced Components]
9
+
Some state modifiers may require using the enhanced `Pressable` and `TextInput` components from `@mgcrea/react-native-tailwind`.
10
10
:::
11
11
12
12
## Active Modifier (Pressable)
@@ -16,8 +16,7 @@ Use the `active:` modifier to apply styles when a Pressable component is pressed
Use the `disabled:` modifier to apply styles when a component is disabled.
91
87
88
+
:::note[How Pressable states are wired]
89
+
`Pressable` gets its `active:` behavior for free from React Native's `style={({ pressed }) => ...}` API, but React Native does not pass `disabled` into that callback. The enhanced `Pressable` shipped by this library injects the `disabled` flag so `disabled:` modifiers work correctly.
90
+
:::
91
+
92
92
### Pressable Example
93
93
94
94
```tsx
@@ -100,9 +100,7 @@ export function SubmitButton({ isLoading }) {
0 commit comments