'Expo bare workflow with Firebase Analytics

I am building a project using Expo in bare workflow. I am trying to integrate @react-native-firebase package to utilize Analytics; however, I am unable to link it correctly it looks like.

My Podfile looks like this

require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
require File.join(File.dirname(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules")

platform :ios, '12.0'

target 'MyApp' do
  use_expo_modules!
  post_integrate do |installer|
    expo_patch_react_imports!(installer)
    expo_patch_react_imports!(installer)
  end

  config = use_native_modules!
  use_react_native!(:path => config["reactNativePath"])
  
  # React Native Maps dependencies
  pod 'react-native-google-maps', :path => '../node_modules/react-native-maps'

  # React Native Firebase
  pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'
  pod 'RNFBAnalytics', :path => '../node_modules/@react-native-firebase/analytics'

end

I have ran pod install and it was successful; however, when I run "expo start" on ios, it is failing with this error (when I try to import "import analytics from '@react-native-firebase/analytics';")

Invariant Violation: Native module cannot be null.
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
at node_modules/@react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError
at node_modules/metro-runtime/src/polyfills/require.js:204:6 in guardedLoadModule
at screens/Core/Profile/setting/HelpScreen.js:84:10 in HelpScreen

Am I doing this wrong? Can someone please help?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source