wonday / react-native-pdf

A <Pdf /> component for react-native
MIT License
1.6k stars 557 forks source link

Invariant Violation: `new NativeEventEmitter()` requires a non-null argument #884

Closed Jussinevavuori closed 3 days ago

Jussinevavuori commented 1 week ago

What react-native version are you using?

0.74.5


What react-native-pdf version are you using?

6.7.5


What platform does your issue occur on? (android/ios/both)

iOS


Describe your issue as precisely as possible : 1) Steps to reproduce the issue or to explain in which case you get the issue 2) Interesting logs

PDFs have stopped working in my application. Rendering the <PDF /> element crashes the application with the following error:

Steps to reproduce:

  1. In react-native, import PDF from "react-native-pdf".
  2. Render <PDF {...props} />.
ERROR  Invariant Violation: `new NativeEventEmitter()` requires a non-null argument., js engine: hermes

Join a screenshot or video of the problem on the simulator or device?

IMG_4E4B5CC9A893-1


Show us the code you are using?

Not relevant, code itself is very basic usage of react-native-pdf, almost directly from the docs.

rajivchaulagain commented 1 week ago
Go to ios folder then remove

Pods & Podfile.lock
run pod install
Rebuild project
Jussinevavuori commented 1 week ago

Thank you, however this has not fixed it. Reinstalling pods and rebuilding the project did not work, neither did a completely fresh iOS rebuild after deleting the /ios folder.

codeheroes-stephen commented 3 days ago

I had this issue and i needed to install react-native-blob-util after updating

Jussinevavuori commented 3 days ago

Doing these in succession did it! For further reference, if anyone else is having issues with this, do this:

# install latest version of react-native-blob-util
npm install react-native-blob-util@latest

# remove and reinstall pods
cd ./ios
rm -rf Pods
rm Podfile.lock
pod install

# run your project as usual
expo run ios # or other command