Skip to content

React Native and Expo

Scope: iOS and Android apps built with React Native and Expo, on React Native 0.88 and Expo SDK 58, the current releases. React Native has run only on the New Architecture since version 0.82, and Expo since SDK 55, and Hermes V1 has been its default JavaScript engine since 0.84. Components follow the React rules, such as pure components (REACT-1) and separate server state (REACT-5), and the TypeScript rules apply to the code. Keeping secrets out of the app (SEC-11) and running supported releases (SEC-17) are in Security, third-party SDKs and personal data in Privacy and personal data, and sign-in in Authentication and sessions. Store requirements and privacy declarations are in Mobile games (MOBGAME-5, MOBGAME-6), and they apply to every app. Native code is covered in iOS (Swift and SwiftUI) and Android.

Entries are sorted by score from 1 to 10 (criteria): 9โ€“10 start here or strongly recommended, 6โ€“8 recommended, 1โ€“5 further reading or conditional.

Adopted references

  • 9 React Native documentation: the baseline for React Native: core components and APIs, platform-specific code, native modules, performance, security, testing and upgrades.
  • 9 OWASP Mobile Application Security Verification Standard (MASVS): the security requirements for mobile apps: storage, cryptography, authentication, network communication, platform interaction, code quality, resilience and privacy. The OWASP MASTG describes how to test each of them on iOS and Android.
  • 8 Expo documentation: the baseline for Expo apps: development builds, app config and Continuous Native Generation, Expo Router, the Expo SDK, and building, submitting and updating apps with EAS.
  • 8 Security (React Native): storing sensitive data, deep links, OAuth with PKCE and network security in React Native apps.
  • 7 Expo Router (Expo): file-based routing for Android, iOS and web, with deep links to every screen, protected routes and typed routes.
  • 7 Expo Update (Expo, formerly EAS Update): over-the-air updates of JavaScript and assets, with runtime versions, channels, rollouts, rollbacks and code signing.
  • 7 EAS Build and EAS Submit (Expo): hosted builds of app binaries, signing credentials, and submission to the App Store and Google Play from CI.
  • 7 Performance overview (React Native): the JavaScript and UI threads, and the common causes of dropped frames, such as development mode, large lists and work on the JavaScript thread during animations.

Key rules

Project setup

  • 7 RN-1 Start new apps with Expo and Expo Router, and develop in development builds rather than in Expo Go. The React Native docs recommend a framework for new apps and name Expo; Expo recommends Expo Router for new apps, and calls Expo Go a limited playground that isn't useful for production-grade projects. This applies REACT-7. (React Native, Get started, Expo Router, Introduction, Expo, Develop an app with Expo)
  • 7 RN-2 Generate the ios and android directories with Prebuild (Continuous Native Generation): keep native configuration in the app config and config plugins, keep the generated directories out of Git, and don't edit them by hand. Expo highly recommends Prebuild, which automates upgrades, and manual changes to the generated directories are lost the next time it runs with --clean. (Expo, Continuous Native Generation)
  • 6 RN-3 Write the app in TypeScript with strict on (TS-1), and turn on Expo Router's typed routes, so that the type checker reports links to routes that don't exist. expo/tsconfig.base leaves strict off, so set it in the project's own tsconfig.json. (Expo, Using TypeScript, Typed routes)

Secrets, storage and sign-in

  • 9 RN-4 Treat the JavaScript bundle and the app config as public: never put secrets in EXPO_PUBLIC_ variables, the app config or the code, and call services that need a secret through your own server. Expo inlines EXPO_PUBLIC_ variables into the bundle in plain text, and most app config fields are readable at run time; npx expo config --type public shows what a build exposes. This applies SEC-11. (Expo, Environment variables, Configure with app config, React Native, Storing sensitive info)
  • 9 RN-5 Store tokens and other secrets with expo-secure-store, which uses the iOS Keychain and the Android Keystore, not in AsyncStorage, which is unencrypted, or in a persisted state store, and keep them out of crash reports and analytics. This is how React Native apps apply SEC-19. (React Native, Async Storage, Secure storage, Expo, SecureStore)
  • 9 RN-6 Sign users in through the system browser with expo-auth-session or react-native-app-auth, using the authorization code flow with PKCE (AUTH-2), never in a WebView, and exchange the code on your server when the provider requires a client secret. Any app can register your URL scheme, and RFC 8252, the best current practice for OAuth in native apps, says that apps must not use embedded user agents for authorization requests. IOS-7 is the same rule for native iOS apps. (React Native, OAuth2 and redirects, Expo, Authentication with OAuth or OpenID providers, IETF, RFC 8252, 8.12 Embedded user agents)
  • 8 RN-7 Treat every incoming link as untrusted input: validate its route and query parameters before using them (SEC-10), never put tokens or personal data in a link, and use universal links and Android App Links for links that must open only your app. Expo Router makes every screen deep-linkable, and any app can register the same custom scheme. Protected routes only stop client-side navigation, so your server must still authorize every request (SEC-1). (React Native, Authentication and deep linking, Expo, Linking overview, Expo Router, Protected routes)

Privacy

  • 7 RN-8 Declare the required reason APIs that the app and its libraries use in ios.privacyManifests in the app config, copying the reasons from each library's PrivacyInfo.xcprivacy. Apple doesn't correctly read every privacy manifest in static CocoaPods dependencies, such as Expo SDK packages, so their reasons may need to be in the app's own manifest. This is how Expo apps follow IOS-9. (Expo, Privacy manifests, Apple, Describing use of required reason API)

EAS Build, Submit and Update

  • 7 RN-11 Build and submit releases with EAS Build and EAS Submit from CI, and let EAS manage the signing credentials. If you use local credentials, add credentials.json and the keystore and certificate files to .gitignore (SEC-2). (Expo, Using automatically managed credentials, Using local credentials, Submit to app stores)
  • 6 RN-9 Give every build a runtime version that changes whenever its native code changes, preferably with the fingerprint policy, test each update on a preview build of the same runtime version through its own channel, and release it to production as a rollout to a small share of users first. Cancel the rollout, or roll back, if the error rate rises. An update that calls native code the build doesn't contain fails, and expo-updates may have to roll back to the previous update. Roll out store releases gradually as well (MOBGAME-12). (Expo, Runtime versions and updates, Rollouts, Rollbacks)
  • 6 RN-10 Use over-the-air updates for bug fixes and other changes that the stores allow without review, and ship new features and changes to the app's purpose in a store build. The App Store doesn't allow downloaded code that introduces or changes features, Expo notes that changes to an app's behaviour usually need review, and Google Play allows JavaScript loaded at run time only if it doesn't break its policies. See also MOBGAME-8. (Apple, App Review Guidelines 2.5.2, Expo, Expo Update, Google Play, Device and Network Abuse)
  • 5 RN-12 If your EAS plan includes it, sign updates end to end with expo-updates code signing, and keep the private key out of source control. The app verifies each update's signature before applying it, so nobody between you and the device, not even EAS, can tamper with updates. (Expo, End-to-end code signing with Expo Update)

Performance

  • 7 RN-13 Render long or growing lists with a virtualized list, FlatList, SectionList or FlashList, not with .map() inside a ScrollView, and measure performance in release builds. ScrollView renders all its children at once, while FlatList renders items as they are about to appear, and FlashList, a drop-in replacement that the Expo SDK supports, recycles item components. Development mode makes the JavaScript thread much slower. (React Native, ScrollView, Optimizing FlatList configuration, Expo, FlashList, React Native, Performance overview)
  • 6 RN-14 Turn on the React Compiler after checking the project with react-compiler-healthcheck, and in new code rely on it for memoization, with useMemo and useCallback only where you need precise control. The compiler memoizes components and hooks to avoid unnecessary re-renders, and it relies on code that follows the Rules of React (REACT-1). (Expo, React Compiler, React, React Compiler introduction)

Upgrades and testing

How to enforce

Tools that check the key rules above automatically, in CI, the IDE or a commit hook. "Partly" means the tool covers only some of what the rule asks.

  • 6 Expo Doctor: npx expo-doctor checks that dependencies match the installed Expo SDK, validates them against React Native Directory to flag unmaintained libraries and those untested or incompatible with the New Architecture, and warns when the ios and android directories are committed although the app config holds native settings that only Prebuild applies. Run it in CI. Partly checks RN-2 and RN-15.
  • 6 eslint-config-expo: the ESLint configuration that npx expo lint sets up. It includes the recommended eslint-plugin-react-hooks rules and, from SDK 55, the React Compiler rules, which flag code that breaks the Rules of React. Partly checks RN-14.
  • 6 TypeScript type checking: run tsc in CI with strict on and typed routes generated, and it reports type errors and href values that aren't valid routes. It can't tell whether strict is off. Partly checks RN-3.

Tutorials and further reading