Chris
Chris

Reputation: 40613

How can i incorporate Expo components in a non-expo React Native app?

I'd like to use Expo's barcode scanner component in a non-expo app that i've already mostly built:

https://docs.expo.io/versions/latest/sdk/bar-code-scanner.html

Is it reasonable to do this? Or is it more reasonable to create a new Expo app then migrate my existing codebase into the new expo app?

My existing app was created using react-ignite, not sure if that is relevant or does not make a difference.

Upvotes: 1

Views: 1917

Answers (1)

jevakallio
jevakallio

Reputation: 35890

Generally speaking, integrating Expo components with native dependencies (such as the camera) into a non-Expo app is possible, but is a bit tricky, as you'd have to lift the source code from the Expo codebase into your application.

The JavaScript code for these modules exists in the expo/expo-sdk module, and are quite straightforward:

However, the native module that's required to make the Camera work are embedded within the expo/expo client application, and depends on other parts of the Expo codebase.

Instead, I recommend you use the react-native-camera component, which supports barcode scanning out of the box, and is easier to integrate into a plan React Native application.

Upvotes: 2

Related Questions