5

In my React Native app, I'm trying to add the expo-mail-composer package using this guide.

I use [email protected],
I added "install-expo-modules": "^0.2.8",
then "expo-mail-composer": "~11.3.0",

When I try to import the package with

import * as MailComposer from 'expo-mail-composer'

it throws the error

Cannot find native module 'ExpoMailComposer'
1
  • are you using expo-cli or react-native-cli? if you using expo cli then no need to add dependency or if you using react-native-cli then you should import its package to the respective platform android or ios Commented Nov 8, 2022 at 6:28

5 Answers 5

11

This issue was resolved for me by creating a new development build:

eas build --profile development --platform android

Then downloading and installing that build on my device:

adb install --user 0 <path_to_apk>

I then ran the app with:

set APP_ENV=development&& npx expo start --dev-client

The app opened as normal after that, and MailComposer.composeAsync() appears to work.

(For reference, I'm developing on a physical Android device using the Managed workflow, and did not have to use npx install-expo-modules@latest.)

Sign up to request clarification or add additional context in comments.

1 Comment

Fixed my error for ExpoSharing. Seems odd that an Expo module requires a new Dev build, and that the Expo doc mentions nothing about needing a new Dev build. but oh well. Seems to fix my error too.
2

To use expo modules in a non-expo project (aka bare workflow), you need to install Expo modules first with:

npx install-expo-modules@latest

https://docs.expo.dev/bare/installing-expo-modules/

Comments

0

Building again instead of reload worked for me

npm run build or pnpm android

Comments

0

I was getting the issue with a missing ExpoLinking module when I tried to run the app on my android device using npx expo start. I had previously built the app with older dependencies using npx expo run:android, and tapping on the app would result with the error.

The steps for me to fix this were:

  1. Check if the dependency is installed and is listed in package.json -> expo-linking
  2. Uninstall the existing app from the device.
  3. Rebuild the project using npx expo run:android - This added a new iconfor the app and things worked correctly.

Comments

0

If after rebuilding the app doesn't work you need to create a new development build in expo.

eas build --profile=development

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.