How to understand a React Native codebase
React Native renders native views from React components. The JavaScript side looks like a React app with navigation instead of URLs; the `android/` and `ios/` folders hold native projects that are usually generated but sometimes customised.
How to tell it's React Native
react-nativeinpackage.json,index.jscallingAppRegistry.registerComponentandroid/andios/folders and ametro.config.js- Components from
react-nativesuch asView,TextandFlatList
Where things usually live
- index.js
- Registers the root component.
- App.tsx or src/App.tsx
- Root component with providers and the navigator.
- src/navigation/
- Stack, tab and drawer navigators (often React Navigation).
- src/screens/
- Screen components.
- src/native/ or modules/
- Bridges to custom native code.
- android/ and ios/
- Native projects: permissions, build settings, native dependencies.
Conventions, not rules. Real projects rename and move things, so confirm against the repository.
Where to start reading
App.tsxand the navigation setup, to list every screen- Any custom native modules
- Native config files for permissions and deep links
How a request moves through the code
- The native app starts and loads the JavaScript bundle built by Metro.
AppRegistryruns the root component.- The navigator shows a screen; navigation passes params between screens.
- Screens fetch data and render native views through React Native components.
- Platform features go through native modules, from libraries or custom code.
Questions to ask about the repository
- Map the navigation tree: every navigator and screen.
- Which native modules does the app use, and which are custom?
- How are deep links handled?
What trips people up
- Files ending
.ios.tsxand.android.tsxare platform-specific versions of the same module. - Native changes need a rebuild of the app; reloading JavaScript isn't enough.
- The New Architecture changes how native modules are written, so check which one the app uses.