Native code and libraries in Expo · senior
The Expo Modules API (Swift and Kotlin)
The Expo Modules API lets you write native modules and views in Swift and Kotlin with a small DSL (Name, Function, AsyncFunction, Events, View, Prop) built on JSI; it works in any React Native app that installs expo, and since SDK 56 a module can live inline inside your app project.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- Definition DSL: Name("Battery"), Function("isLowPower") { … } (synchronous: blocks the JS thread), AsyncFunction("getLevel") { … } (returns a Promise, runs off the JS thread), Constant, Property, Events("onChange") + sendEvent, View(MyView.self) { Prop("color") { … } }.
- Lifecycle hooks: OnCreate, OnDestroy, OnStartObserving, OnStopObserving, OnActivityResult. Types: Records with @Field, Enumerable, Either; arguments convert automatically.
- JS side: requireNativeModule("Battery") and requireNativeViewManager; hooks useEvent and useEventListener.
- Where it lives: a library (npx create-expo-module), a local module in modules/, or since SDK 56 inline Swift/Kotlin files in the app, autolinked at prebuild. SDK 58 ships Expo Modules 2.0 in beta.
- Pick a Turbo Native Module when you need shared C++, and Nitro for very hot call paths; the Expo DSL wins on simplicity in Swift/Kotlin.
- It works in bare React Native apps after installing the expo package.
The red pen
Common traps: mistake → fix
Mistake: "Expo modules only work in Expo Go"
Fix: they need a development build, and work in any app with expo installed.
Mistake: "Function is async"
Fix: Function is synchronous; use AsyncFunction for I/O.
Easy to hard
Questions interviewers ask, easy to hard
- Write the shape of a module with one sync function, one async function and an event.
- How do you expose a native view with props and events?
- When would you choose a Turbo Native Module or Nitro instead?
Practise
Practise with these questions
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.