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.
Description
Problem
The
react-native/no-raw-textlint 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:<Stack.Screen.Title><NativeTabs.Trigger.Label>Examples of False Positives
Current Behavior
React Doctor flags these as errors:
Expected Behavior
The rule should recognize that custom components like
NativeTabs.Trigger.LabelandStack.Screen.Titlecorrectly handle text rendering, even though they're not<Text>components.Recommendation
Option 1 is the quickest fix - make
ignore.ruleswork for this rule.This issue was generated with assistance from an AI coding agent.