简体   繁体   中英

How to properly add Expo to an existing react-native app within an NX monorepo?

I have a NX monorepo with a react native app. I need to install expo (cause I need to use some libs like ExpoAV) to the app, should I run yarn add expo at the workspace level or at the react-native app level?

What would be the right process to install, in general, dependencies that have their "stuff" to setup during an install?

Update

When I try to install the expo module from the workspace directory I get "'Expo/Expo.h' file not found at #import <Expo/Expo.h>" just doing the followings:

  • create a nx workspace
  • yarn add expo (in the workspace directory)
  • manual setup of expo (changing AppDelegate.h and AppDelegate.mm)
  • pod install in the ios folder of the app
  • npx nx run-ios [appname]

I assume the react-native app you have already setup with NX is a "bare" react-native app. So it's not using expo. Expo is a kind of convenience walled garden to develop react-native apps. One can "eject" from an expo react-native project to a "bare" react-native project. This is often necessary once you need libraries which are not yet compatible with an expo react-native app.

So you've got a "bare" react-native app on your hands in your monorepo. Which is totally fine. You can still use all of the expo modules in your app as well. The setup to use them is a bit more cumbersome than other a basic react-native library.

They have a proper guide how to integrate Expo in your "Bare Workflow React-Native" app here:

Introduction: https://docs.expo.dev/bare/hello-world/

Guide to add Expo to Bare Workflow: https://docs.expo.dev/bare/installing-expo-modules/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM