Babylon React Native with expo?

Hello! I’m going to start Babylon React Native and I’m thinking especially about Virtual Reality. But I’m in doubt: does Babylonjs work well with expo or should I use React Native CLI?

There are parts of expo that work with Babylon React Native, but I believe only for asset management. Maybe @ryantrem @Cedric will have more information.

Also see here: Babylon Native with Expo

I don’t have any new thoughts or insights beyond what I shared in the thread @bghgary linked above. I expect someone will need to try it and see what can be learned, but so far all the use cases I’m aware of are not expo (just regular RN CLI).

Hi team. I have an existing React Native + Expo project and am also exploring Babylon JS (versus Viro) for Augmented Reality in my mobile app.

ryantrem mentioned in the linked thread:

My understanding of Expo is that the native part of the app is basically pre-built from React Native plus a pre-selected set of React Native modules.

I wanted to follow up to share that it is possible to use third party native libraries with Expo Development Builds. I am already using Expo with the Mapbox Maps SDK and the setup was quite straightforward.

How is this done?
Expo uses a Custom Development Client, which is a version of the app that autolinks native dependencies that aren’t available in the standard Expo Go.

Using Expo “config plugins”, I can tell Expo how I would like to configure the native modules. Expo then updates necessary native files (AndroidManifest.xml, Info.plist) during the build process. If the native SDK does not provide a plugin, it seems possible to create a custom plugin- although I have not tested this out.

Expanding this for Babylon Native

  • Babylon would need to provide a config plugin to configure the native settings during build time (Example PR, Example Plugin file)
  • All native code should be prebuilt and available through a React Native lib (seems to be the case already for Babylon React Native? Correct me if I’m wrong here)
  • Testing: Would need to be tested in an Expo Development Build + EAS Build (Expo’s hosted build service)

Opening support for Expo would be great since it can open up opportunities for devs to integrate BabylonJS into existing RN projects. I’d be interested in hearing your thoughts on this @bghgary and @ryantrem

3 Likes

Sounds promising!

Yea that’s right, if by Native you mean C++. For each platform, there is also a bit of platform specific glue code that is not prebuilt (Java, objective-c, etc).

I’m quite sure from what you’ve described above that you’re far more of an Expo expert than us. Would you be interested in giving your suggestions above a try?

Thanks for getting back @ryantrem I’m open to making a basic prototype with Expo + RN + BabylonJS just to see if it works- I would probably start with making a custom config plugin in my own project.

I am also planning to make a basic prototype with Viro, compare the two and go with whatever one I like better. Viro already has some successful examples with Expo so I may end up choosing it to get my app up faster, but BabylonJS may win me over if I notice a considerable performance advantage (which would make it worth the work).

Will keep you posted on what I pursue in the next 1-2 mo.

2 Likes

The biggest advantage of Babylon React Native will be if you want to have the same app/experience available in a browser, or if you need low level control of the scene and the rendering details. Otherwise, Viro might work just fine for your scenario. Will be curious to hear about progress on the Expo experiment, and also which route you decide to go!