I recently upgraded RN project from 0.59.10 => 0.60.5. Ever since I've had issues with multiple libraries and the auto-linking feature, this one included.
react-native -v): 0.60.5target 'vaultzap57' do
# Pods for vaultzap57
# Default standard RN pods
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/React'
pod 'React-DevSupport', :path => '../node_modules/react-native/React'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
# Additional pods we've added
pod 'Firebase/Messaging'
pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'
pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'
pod 'ReactNativeNavigation', :path => '../node_modules/react-native-navigation'
pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'
pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'RNKeychain', :path => '../node_modules/react-native-keychain'
pod 'RNSVG', :path => '../node_modules/react-native-svg'
end
```
App to finish building
Red screen, Native module cannot be null stemming from the import line in file
import BackgroundGeolocation from "react-native-background-geolocation";
When you see this error "Native module cannot be null", it means the plugin isn't installed correctly.
You haven't properly migrated your Podfile. Look what a fresh new react-native init foo Podfile looks like:
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'foo' do
# Pods for foo
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/React'
pod 'React-DevSupport', :path => '../node_modules/react-native/React'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
target 'fooTests' do
inherit! :search_paths
# Pods for testing
end
use_native_modules! # <----------------- you're missing this!!
end
target 'foo-tvOS' do
# Pods for foo-tvOS
target 'foo-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
Also - as a maintainer on the v5 branch of react-native-firebase - not related to this project but I listen here since I use this module - you'll need a merged-but-not-released fix on react-native-firebase to deal with AndroidX library numbers: https://github.com/invertase/react-native-firebase/pull/2476
You can either patch-package that patch or depend on the master or the commit hash from react-native-firebase v5.x.x branch to get it. Here's a sample RN60 RNFB Podfile example to look at too if that helps https://github.com/mikehardy/rnfbdemo/blob/master/Podfile
Thanks to both of you for your quick responses @mikehardy @christocracy. After inserting the missing line in the podfile, I can confirm the app built fine. I also removed some of the hardcoded podspecs I had, and unlinked their correlating packages. It seems as though auto-linking does work as intended, given that you don't mess up your podfile during a RN upgrade ...
@mikehardy I read through your suggested patch for firebase, I think I would like to use the master branch of RN-Firebase for the time being instead of using the patch file. How would I go about using master branch or a commit hash when installing RNFB?
You can simply yarn add url#tag_or_commit_hash
@Raymond-Cox do not use master - for react-native-firebase "master" means "v6" which is a huuuuge migration from v5. You'll want to use the v5.x.x specifier, and I add it like so: https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh#L12
glad to hear it's working for you. RN60 sets everyone up for a nice dev experience in the future but getting it working first time is a chore
actually, to be even more specific (since I can't land that patch until CI is fixed in react-native-firebase#v5.x.x and that is blocked on an unrelated problem...) you should specify a commit hash - it's commit 2b8071cd600efc50b1d0a85acfaf56bf55e1927d - I believe you would just use that as the part after '#'. @christocracy sorry for sort of react-native-firebase-jacking your thread here ;-)
It鈥檚 all good @mikehardy, you鈥檙e deputized here :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.
I'm using RNF version 6 with the same version react-native and having the same infuriating problem. With version 6 all I'm supposed to do is npm i react-native-firebase/app.
This is only happening for me on ios.
@Tommoore96 if you're using react-native-firebase, head on over there and open an issue, I support that repo with issue triage. As a general guess though without going too deep here, that is not the only thing you need to do, and it's npm i @react-native-firebase/app (with the @ sign) I believe - so as you fill the template on react-native-firebase be precise to get the best help
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.
Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you.
Most helpful comment
Also - as a maintainer on the v5 branch of react-native-firebase - not related to this project but I listen here since I use this module - you'll need a merged-but-not-released fix on react-native-firebase to deal with AndroidX library numbers: https://github.com/invertase/react-native-firebase/pull/2476
You can either patch-package that patch or depend on the master or the commit hash from react-native-firebase v5.x.x branch to get it. Here's a sample RN60 RNFB Podfile example to look at too if that helps https://github.com/mikehardy/rnfbdemo/blob/master/Podfile