-
Notifications
You must be signed in to change notification settings - Fork 179
Open
Description
Description
Problem
The react-native/no-raw-text lint rule triggers errors for valid code when using custom components that correctly handle text rendering, even though these components are not <Text> components. This is common in:
- Expo Router components - Like
<Stack.Screen.Title> - Native Tabs components - Like
<NativeTabs.Trigger.Label> - Custom UI library components - That wrap text internally
Examples of False Positives
// ❌ Reported as error, but works correctly with expo-router
<Stack.Screen.Title>Oops!</Stack.Screen.Title>
// ❌ Reported as error, but NativeTabs.Trigger.Label handles text correctly
<NativeTabs.Trigger.Label>Home</NativeTabs.Trigger.Label>
<NativeTabs.Trigger.Label>Sources</NativeTabs.Trigger.Label>
<NativeTabs.Trigger.Label>Transactions</NativeTabs.Trigger.Label>
<NativeTabs.Trigger.Label>Search</NativeTabs.Trigger.Label>Current Behavior
React Doctor flags these as errors:
✗ Raw "Oops!" outside a <Text> component — this will crash on React Native (17)
✗ Raw "Home" outside a <Text> component — this will crash on React Native (17)
✗ Raw "Sources" outside a <Text> component — this will crash on React Native (17)
✗ Raw "Transactions" outside a <Text> component — this will crash on React Native (17)
Expected Behavior
The rule should recognize that custom components like NativeTabs.Trigger.Label and Stack.Screen.Title correctly handle text rendering, even though they're not <Text> components.
Recommendation
Option 1 is the quickest fix - make ignore.rules work for this rule.
This issue was generated with assistance from an AI coding agent.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels