π¦ ClawHub
React Native
by @ivangdavila
Build performant cross-platform mobile apps with React Native components, navigation, and native modules.
TERMINAL
clawhub install react-nativeπ About This Skill
name: React Native description: Build performant cross-platform mobile apps with React Native components, navigation, and native modules. metadata: {"clawdbot":{"emoji":"π±","requires":{"anyBins":["npx","expo"]},"os":["linux","darwin","win32"]}}
React Native Development Rules
Component Performance
FlatList for any list over 10 items β ScrollView with map loads everything in memory, FlatList virtualizeskeyExtractor must return stable unique strings β using index causes bugs on reorder and deletionReact.memo prevents re-renders when props unchanged β wrap pure display componentsuseCallback for functions passed to child components β new function reference triggers child re-renderStyleSheet.createState Management
useState is fine for component-local state β don't add Redux/Zustand for a toggleuseMemo for expensive computations β but don't overuse, caching has overheadNavigation
useEffect cleanupuseFocusEffect for screen-specific side effects β runs on focus, not just mountnavigation.reset for auth flows β clears back stack, prevents returning to login after sign-inStyling
StyleSheet.create outside component body β creates styles once, not every renderflexDirection: 'column', no display: flex neededPlatform.select for platform-specific styles β cleaner than conditionals in style objectsNative Modules
expo-dev-client enables native modules without full eject β best of both worldsPerformance Debugging
InteractionManager.runAfterInteractions defers heavy work β keeps animations smoothuseNativeDriver: true for animations β runs on UI thread, not JS threadconsole.log in production kills performance β remove or use __DEV__ guardImages
resizeMode appropriately β cover crops, contain letterboxes, stretch distortsImage.prefetch(url) before displayingreact-native-svg β better scaling than PNGs for iconsreact-native-fast-image β default Image has no persistent cacheCommon Mistakes
async in useEffect directly β must define async function inside, then call itkey warnings in lists β always use unique, stable keysuseEffect β subscriptions, timers, listeners leak without cleanup returnPlatform Differences
overflow: 'hidden' for border radius clipping β iOS clips by defaultshadow* props, Android uses elevationBackHandler or navigation listenersBuild & Release
npx react-native clean for unexplained build failures β clears caches and derived datacd ios && pod install after adding native dependencies β often forgotten stepcd android && ./gradlew clean for stubborn build issues