Expo dependency error, "Cannot find native module 'ExpoCrypto'", in Non-Expo React Native Projects
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 25/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- react-native, typescript
- Domaine
- mobile
Piste de recherche
Reproduisez l’échec avec React Native 0.73.2, cloudinary-react-native 0.2.0 et la configuration de bare project décrite dans l’issue. Examinez d’abord package-lock.json et les dépendances liées à Expo du package ; le travail est terminé lorsque le SDK fonctionne soit dans une application React Native bare, soit documente le workaround requis et la configuration prise en charge.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
I encountered an issue while integrating the cloudinary-react-native package version 0.2.0 into my bare React Native project. The problem arises due to the package's dependency on ExpoCrypto and other Expo modules, which are not available in a non-Expo (bare) React Native environment.
Steps to Reproduce
- Create a new bare React Native project using npx react-native init MyProject.
- Install the cloudinary-react-native package using npm install cloudinary-react-native.
- Attempt to use the package according to the provided documentation.
- Encounter an error related to the missing ExpoCrypto module when running the app.
Expected Behavior
I expected that the cloudinary-react-native package could be used in a bare React Native project without dependencies on Expo-specific modules, or that there would be clear documentation on how to handle such dependencies in a non-Expo environment.
import {Cloudinary} from '@cloudinary/url-gen';
import {upload} from 'cloudinary-react-native';
async function uploadImageToCloudinarySDK(payload: any) {
const {folder, upload_preset, uri} = payload;
const cld = new Cloudinary({
cloud: {cloudName: Config.CLOUDINARY_CLOUD_NAME },
url: {secure: true},
});
const options = {folder, upload_preset, unsigned: true};
await upload(cld, {
file: uri,
options,
callback: (error: any, response: any) => {
if (error) {
console.error('Upload Error:', error);
} else {
console.log('Upload Successful:', response);
}
},
}).catch((error: any) => console.log('ERROR CLD UPLOAD', error?.message));
}
Actual Behavior
The application throws an error indicating that the ExpoCrypto native module cannot be found. This suggests that the package relies on Expo modules, which are not present in bare React Native environments. The exact error message is:
Cannot find native module 'ExpoCrypto', js engine: hermes
Environment
- React Native version: 0.73.2
- Cloudinary React Native SDK version: 0.2.0
- Operating System: iOS
- Device details: iPhone 15 Pro Max
Additional Context
I am not using Expo in my project and prefer to keep it as a bare React Native application. I noticed that the package-lock.json file lists several Expo-related dependencies, which might be causing this issue.
Given the package's potential utility for React Native developers looking to integrate Cloudinary, finding a solution to make it compatible with both Expo and non-Expo environments would be greatly beneficial.
Potential Solutions or Workarounds
I am seeking guidance on how to resolve this issue. Possible solutions could include:
- Instructions on how to remove or bypass the Expo dependencies in a non-Expo environment.
- Updates to the package to support bare React Native projects without requiring Expo modules.
- Any other recommended approaches for using cloudinary-react-native in non-Expo React Native projects.
Thank you for looking into this issue. I appreciate any feedback or solutions you can provide.
- Langage dominant
- TypeScript
- Étoiles
- 28
- Forks
- 21
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de cloudinary/cloudinary-react-native
-
hacktoberfest-accepted
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
cloudinary/cloudinary-react-native#55 · 3 commentaires ·
-
Add CODE_OF_CONDUCT.mdPeut-être à nouveau libre @adimiz1 l’a pris il y a 405 jours, et aucune pull request n’est ouverte. Ouverte
cloudinary/cloudinary-react-native#53 · 2 commentaires · 1 personne assignée ·
-
Support for expo 54Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 45/100
cloudinary/cloudinary-react-native#52 · 8 commentaires ·
-
Issue: Improve `bootstrap.js` to support both Yarn and NPM with clearer errorsPeut-être pris @adimiz1 l’a pris il y a 415 jours. Ouverte
cloudinary/cloudinary-react-native#50 · 3 commentaires · 1 personne assignée ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 15/100
Toutes les issues de cloudinary/cloudinary-react-native
Issues similaires
-
area:docs documentation good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 12 jours
-
area:docs good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
thainanluiz/TSSuper#30 ·
-
[analytics-core] getQueryParams does not decode `+` as space and truncates values containing `=`Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
amplitude/Amplitude-TypeScript#2179 · 1 commentaire ·
Les mainteneurs répondent en général sous 2 jours
-
ci good first issue severity: low
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
TMHSDigital/GH-Arcade#111 ·