Expo Native Modules: Config Plugins and the Modules API
How to use native iOS and Android code in Expo without ejecting: config plugins, prebuild, the Expo Modules API in Swift and Kotlin, and development builds.

Can You Use Native Modules in Expo?
Yes. The days of ejecting are over. A few years ago, the moment you needed a native SDK or a custom setting in Info.plist, you had to eject from Expo and own the whole native project yourself. That trade-off is gone.
Today two tools cover almost every case. Config plugins let you change native project settings from JavaScript. The Expo Modules API lets you write your own native code in Swift and Kotlin and call it from React Native. Together they let you interact with any native iOS or Android API while keeping the Expo workflow.
The one thing you do give up is Expo Go. Expo Go only ships with a fixed set of native modules. As soon as you add custom native code, you build your own development build instead. More on that below.
What Is Prebuild and Continuous Native Generation?
Prebuild is the step that generates the ios and android folders from your app config and installed packages. You run it with npx expo prebuild, or let EAS Build run it for you in the cloud.
Expo calls this approach Continuous Native Generation. The idea is simple: the native project is an output, not a source file. You can delete the ios and android folders and regenerate them at any time. Your real source of truth is app.json or app.config.js plus the plugins and packages you install.
This is what makes Expo upgrades sane. Instead of hand-merging diffs into a native project you edited months ago, you bump the SDK, run prebuild again, and get a fresh native project with your config applied on top.
What Are Expo Config Plugins?
Config plugins are configuration as code. Instead of touching Info.plist or AndroidManifest.xml by hand and breaking upgrades, you write a config plugin. A config plugin is a JavaScript function that modifies the native project during the prebuild phase.
That keeps the native project ephemeral and the configuration version-controlled. Every change to native settings lives in a reviewable file in your repo, not in a generated folder someone edited once and forgot about.
Many libraries ship their own config plugin. You add the package name to the plugins array in your app config, sometimes with options, and prebuild applies the native changes for you. Camera permissions, push notification setup and SDK keys are common examples.
How to Write a Custom Config Plugin
When no library plugin covers your case, write your own. The config plugins package exposes helper functions called mods, such as withInfoPlist for iOS and withAndroidManifest for Android. Each one hands you the parsed native file, you change what you need, and you return the config.
A typical plugin is a few lines: export a function that takes the Expo config, wrap it with withInfoPlist, set a key on the plist object, and return it. Then reference the file in the plugins array. Run prebuild and check the generated file to confirm the change landed.
Keep plugins small and idempotent. Prebuild can run many times, so a plugin should produce the same result on every run. Avoid string-replacing large chunks of native files when a structured mod exists for the file you need.
- Use structured mods like withInfoPlist and withAndroidManifest before raw file edits
- Make plugins idempotent so repeated prebuilds give the same output
- Accept options so the same plugin works across environments
- Commit the plugin, not the generated native folders, when using Continuous Native Generation
How to Write a Native Module with the Expo Modules API
Config plugins change settings. When you need to run actual native code, such as calling a platform API or wrapping a native SDK, you write a module. Writing native code in Swift or Kotlin is easier than ever with the Expo Modules API.
It handles the bridging boilerplate, native views and event emitting. It feels like writing a modern library, not hacking a JNI bridge. You describe your module with a small declarative definition: a name, the functions you expose, async functions that return promises, events you send to JavaScript and views you render.
To start, run npx create-expo-module. Add the local flag to create the module inside your app instead of as a separate package, which is the fastest path when the code only serves one app. You get a Swift file, a Kotlin file and a TypeScript file that exposes the module to the rest of your React Native code.
From JavaScript, you import the module and call its functions like any other async API. Types live in the TypeScript layer, so the rest of your app never sees the native details.
Development Builds: Why Expo Go Is Not Enough
Expo Go is a prebuilt app with a fixed set of native modules inside. It can't load your custom Swift or Kotlin code, because that code has to be compiled into the app binary.
A development build is your own version of that app, compiled with your native modules and config plugins, plus the expo-dev-client tooling for fast refresh and debugging. You build it once locally or with EAS Build, install it on a device or simulator, and keep iterating on JavaScript as usual. You only rebuild when native code or native config changes.
Common Mistakes with Native Code in Expo
Most pain comes from mixing the old workflow with the new one.
- Editing the generated ios or android folders by hand, then losing the change on the next prebuild
- Expecting a custom native module to work in Expo Go
- Forgetting to rebuild the development build after adding a package with native code
- Writing one huge config plugin that patches many unrelated files instead of small focused ones
- Reaching for a native module when an existing Expo SDK package already covers the API
Frequently Asked Questions
Do I need to eject from Expo to use native code?
No. Ejecting is no longer part of the Expo workflow. Use config plugins to change native settings and the Expo Modules API to write native code, then run your app in a development build.
What is the difference between a config plugin and a native module?
A config plugin changes the native project during prebuild, such as permissions, plist keys or Gradle settings. A native module is Swift or Kotlin code that runs inside your app and is called from JavaScript. Many libraries ship both.
Can I use React Native libraries with native code in Expo?
Usually yes. Most libraries with native code work in a development build. If a library needs native config, check whether it ships a config plugin. If it doesn't, you can write a small plugin yourself.
Should I commit the ios and android folders in an Expo project?
If you use Continuous Native Generation, no. Treat them as generated output and keep native changes in config plugins. If you choose to manage the native folders yourself, commit them, but then prebuild will no longer be your source of truth.
Does the Expo Modules API work with the New Architecture?
Yes. The Expo Modules API is designed to support React Native's New Architecture, so modules you write with it don't need separate code paths for it. Check the Expo docs for your SDK version for current details.
Keep reading
All guides →
How to Add AI to a React Native App (Step by Step)
Add AI to a React Native app the safe way: keep API keys on your backend, stream responses to the UI, send camera photos, and handle errors and cost.

Expo Router: File-Based Navigation for React Native
How Expo Router works: file-based routes, layouts, dynamic segments, typed routes and universal links, plus when to pick it over React Navigation.

On-Device AI: The Next Frontier for React Native
Why I'm moving inference from the cloud to the edge. A practical guide to running TensorFlow Lite and CoreML directly in React Native apps.