invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.63k stars 2.2k forks source link

[🐛] ERROR Error: You attempted to use a Firebase module that's not installed natively on your project by calling firebase.app(). android expo #7980

Open hakimov-dev opened 3 weeks ago

hakimov-dev commented 3 weeks ago

Issue

I've a problem using that package ther problem:

 ERROR  Error: You attempted to use a Firebase module that's not installed natively on your project by calling firebase.app().

Ensure you have installed the npm package '@react-native-firebase/app', have imported it in your project, and have rebuilt your native application.

This error is located at:
    in App (at withDevTools.js:18)
    in withDevTools(App) (at renderApplication.js:57)
    in RCTView (at View.js:116)
    in View (at AppContainer.js:127)
    in RCTView (at View.js:116)
    in View (at AppContainer.js:155)
    in AppContainer (at renderApplication.js:50)
    in main(RootComponent) (at renderApplication.js:67), js engine: hermes

But i already have installed that @react-native-firebase/app what could be the reason ? Btw i'm using that package on expo,

package.json:

{
  "name": "drivers-app",
  "version": "1.0.0",
  "main": "expo/AppEntry.js",
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@expo/metro-runtime": "~3.2.1",
    "@react-native-async-storage/async-storage": "1.23.1",
    "@react-native-clipboard/clipboard": "1.14.1",
    "@react-native-community/datetimepicker": "^8.2.0",
    "@react-native-firebase/app": "^20.4.0",
    "@react-native-firebase/messaging": "^20.4.0",
    "@react-navigation/native": "^6.1.18",
    "@react-navigation/native-stack": "^6.11.0",
    "@twotalltotems/react-native-otp-input": "1.3.11",
    "axios": "^1.7.3",
    "dayjs": "^1.11.12",
    "expo": "~51.0.26",
    "expo-blur": "~13.0.2",
    "expo-document-picker": "^12.0.2",
    "expo-linear-gradient": "~13.0.2",
    "expo-notifications": "^0.28.15",
    "expo-secure-store": "^13.0.2",
    "expo-status-bar": "^1.12.1",
    "expo-updates": "^0.25.22",
    "i18next": "^23.12.2",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-i18next": "^15.0.1",
    "react-native": "^0.73.0",
    "react-native-indicators": "^0.17.0",
    "react-native-mmkv": "^2.12.2",
    "react-native-modal": "^13.0.1",
    "react-native-otp-inputs": "^7.4.0",
    "react-native-safe-area-context": "4.10.5",
    "react-native-screens": "3.31.1",
    "react-native-web": "~0.19.10",
    "toastify-react-native": "^5.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0"
  },
  "private": true
}

firebase.json for react-native-firebase v6:

# N/A

russellwheatley commented 3 weeks ago

Hi @hakimov-dev - have you imported @react-native-firebase/app in your JS code and rebuilt the app?

hakimov-dev commented 3 weeks ago

Yes, i have imported

russellwheatley commented 3 weeks ago

I cannot recreate. Please provide an mcve to demonstrate bug.

vonovak commented 3 weeks ago

Hello @hakimov-dev, Are you using a development build? Custom native code cannot be added to Expo Go, if that's what you're using. You need to follow the docs, run npx expo prebuild --clean and then rebuild the app.

Hope this helps