This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
Tutorial: Create an inline module
Edit page
A tutorial on creating a native module and view directly in your Expo project using inline modules.
Inline modules are experimental and available in Expo SDK 56 and later. The API is subject to breaking changes.
In this tutorial, you will create an example native module and a native view directly inside your Expo project's app directory using inline modules.
Unlike the standard Expo Modules, inline modules don't require a separate package or create-expo-module scaffolding.
You write Kotlin and Swift files alongside your app code, and Expo discovers them automatically.
1
Setup your project
Open the app config and set the expo.experiments.inlineModules.watchedDirectories to ["app"]:
Defining expo.experiments.inlineModules enables inline modules functionalities in an Expo project.
In expo.experiments.inlineModules.watchedDirectories you can specify in which directories your inline modules live.
Note that not all directories are allowed. For more information, see the inline modules reference.
2
3
4
5
Create a native view
To create a native view inside the app directory, let's use the ExpoWebView example.
For Android, create a Kotlin file called FirstInlineView.kt inside the app directory and add a view similar to the following:
For iOS, create a Swift file called FirstInlineView.swift inside the app directory:
6
Use the native view in your app
You use the inline view in a similar way to the inline module:
Now run your example app by compiling it using npx expo run:android or npx expo run:ios command.
After running the above command(s), you will see the app with a text constant coming from the native android/iOS module and a web view coming from a native view.
Congratulations! You've created your first Expo inline module and view.
Next steps
A reference on how to create inline modules using Kotlin and Swift.
A tutorial on creating a native module that persists settings with Expo Modules API.