IntelliSense in Expo native modules
I’ve recently been working on an app which uses Expo, a framework for React Native. It actually has a pretty nice developer experience, abstracting away many of the ugly parts of app development.
For the project, I needed to rely heavily on native APIs, like the Nearby Connections API, and found out that the best way was to create an Expo module with npx create-expo-module, which creates a Kotlin module where I can define functions and events to send to the application.
Unfortunately, I found that I could not figure out editor support for Kotlin for the longest time, meaning that I couldn’t get proper editor suggestions and diagnostics showing up.
I looked at the Expo documentation for a while, and tried to get Copilot to fix it multiple times, but it wasn’t until I found a StackOverflow post about the issue which linked me to the documentation where the solution had been all along:
- Open the top-level android directory generated by
npx expo prebuildin Android Studio - Wait for way too long for Gradle to install 1 billion dependencies
- Open the module
.ktfile, such asmodules/my-module/android/src/main/java/expo/modules/mymodule/MyModule.kt - Ta-da!
It’s right there in the documentation, but I didn’t find it, so probably others will also struggle with this in the future and maybe they will be able to find this :)