Skip to main content
These 8 rules are automatically enabled when React Doctor detects a React Native or Expo project. They catch platform-specific issues and enforce mobile best practices.

Rules

Severity: error
Rule ID: react-doctor/rn-no-raw-text
Requires text to be wrapped in <Text> components. Raw text outside <Text> crashes on React Native.Why it crashes: React Native doesn’t support raw text nodes like web React. All text must be in <Text> components.Bad:
Good:
This rule is automatically disabled in files with the 'use dom' directive for React Native’s DOM components.
Severity: error
Rule ID: react-doctor/rn-no-deprecated-modules
Detects removed React Native modules and suggests community alternatives.Deprecated modules:
  • AsyncStorage@react-native-async-storage/async-storage
  • Picker@react-native-picker/picker
  • DatePickerIOS@react-native-community/datetimepicker
  • SafeAreaViewreact-native-safe-area-context
  • WebViewreact-native-webview
  • NetInfo@react-native-community/netinfo
  • Clipboard@react-native-clipboard/clipboard
Bad:
Good:
Severity: warn
Rule ID: react-doctor/rn-no-legacy-expo-packages
Detects deprecated Expo packages and suggests modern alternatives.Deprecated packages:
  • expo-avexpo-audio and expo-video
  • expo-permissions → Module-specific permission APIs
  • @expo/vector-iconsexpo-image with SF Symbols
Bad:
Good:
Severity: warn
Rule ID: react-doctor/rn-no-dimensions-get
Prevents using Dimensions.get() which doesn’t update on screen rotation. Use useWindowDimensions() for reactive layouts.Why it’s bad:
  • Dimensions.get() returns static values
  • Doesn’t update on device rotation
  • Requires manual event listeners
  • addEventListener was removed in RN 0.72
Bad:
Good:
Severity: warn
Rule ID: react-doctor/rn-no-inline-flatlist-renderitem
Prevents inline renderItem functions on list components. Inline functions create new references every render, breaking list optimization.Why it’s bad:
  • New function reference every render
  • Prevents PureComponent optimization
  • List items re-render unnecessarily
  • Poor scroll performance
Bad:
Good:
Applies to: FlatList, SectionList, VirtualizedList, FlashList
Severity: warn
Rule ID: react-doctor/rn-no-legacy-shadow-styles
Suggests using boxShadow instead of legacy shadow properties for the new React Native architecture.Legacy properties:
  • shadowColor
  • shadowOffset
  • shadowOpacity
  • shadowRadius
  • elevation (Android)
Bad:
Good:
boxShadow is cross-platform and works on both iOS and Android with the new architecture.
Severity: warn
Rule ID: react-doctor/rn-prefer-reanimated
Suggests using react-native-reanimated instead of built-in Animated API for performant animations.Why Reanimated is better:
  • Runs on UI thread (60fps even with blocked JS thread)
  • Better gesture handling
  • More powerful API
  • Smoother animations
Bad:
Good:
Severity: warn
Rule ID: react-doctor/rn-no-single-element-style-array
Prevents single-element style arrays which create unnecessary array allocations.Bad:
Good:

React Native Best Practices

Performance

  • Use FlatList for long lists, not ScrollView with .map()
  • Implement keyExtractor and getItemLayout for lists
  • Use React.memo() for list items
  • Avoid inline functions in renderItem
  • Use removeClippedSubviews for very long lists

Layout

  • Use Flexbox (default in RN)
  • Avoid absolute positioning when possible
  • Use useWindowDimensions() for responsive layouts
  • Test on different screen sizes

Images

Platform-Specific Code

Testing on Device