Accessing Expo 43 modules from native code

I have a bare workflow Expo app I’m updating from react-native-unimodules to expo@43 . the thing is that we’ve been using the “module registry” on both iOS and Android to access expo-secure-store from native code (iOS, Android).

My question: is there a way we can continue to access expo-secure-store from native code now that react-native-unimodules is deprecated?

Hey @ashoat, let me bring this up internally and see what I can find out for you.

Cheers,
Adam

Short answer: yes! Long answer:

We restructured unimodules into Expo modules, you can read more about that change here. From SDK 43, you probably want to use Expo modules instead of unimodules. The article also links to a migration guide. You should be able to get everything up and running for SDK 43 with that!

Thanks for the response, @bycedric! To be clear I definitely read through the changes before making this post, including reading through the article you linked as well as the migration guide.

It’s my impression that my question is not addressed by any of the existing materials. Can you try clicking into the iOS and Android links in the OP? You can see the code we’re trying to migrate there :slight_smile:

Hey folks, not sure what the right approach here is but I’d like to “bump” this thread as the question was never addressed. As a quick summary, we have native code that relies on react-native-unimodules to directly access Unimodules, and we’d like to know how to migrate that native code in the new system. The code is linked in the OP for both iOS and Android :slight_smile:

Hi. I don’t really know anything about this topic, but just in case it helps, have you seen the following?

Thanks @wodin! I hadn’t seen that, and it was worth a read. Unfortunately, it didn’t address the question in this thread though.

The new Expo modules are actually unimodules, but with a couple of improvements. If you want to access these modules from native side, you might want to check expo-modules-core, which has the module registry now.

I think that answers it, right?

1 Like

Thanks Cedric, that’s super helpful!! Brent also helped me out by referencing the iOS equivalent.

Only thing I’m a bit confused about still is how to access exModuleRegistry from AppDelegate on iOS, and how to access ModuleRegistry from MainApplication on Android.

I’ve tried global-searching on GitHub for other projects using it, as well as just searching through the Expo repo… but not having any luck. I can definitely see that individual Expo modules can access other Expo modules through the Expo module registry, but is it possible to access the Expo module registry from outside an Expo module?

Realizing that it’s kind of obvious for iOS – we just use [proxy exModuleRegistry] instead of [proxy umModuleRegistry].

The part I’m still confused about is Android. What we currently do relies on having access to org.unimodules.adapters.react.ReactModuleRegistryProvider. But the migration guide has us remove the ReactModuleRegistryProvider from MainApplication.java.

My question: how do we access the ModuleRegistry class now that we no longer have access to ReactModuleRegistryProvider?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.