react-native-pdf icon indicating copy to clipboard operation
react-native-pdf copied to clipboard

"TypeError: Cannot read property 'getConstants' of null, js engine: hermes " after installing "react-native-pdf" package in expo

Open Rahmathirshad opened this issue 1 year ago • 8 comments

react-native version - "0.74.1", react-native-pdf version - "^6.7.5" "react-native-blob-util" version - "^0.19.8",

I'm using EXPO and I'm trying to use 'react-native-pdf' package to open pdf but I'm getting this error "TypeError: Cannot read property 'getConstants' of null, js engine: hermes" just after launching the app in both expo go and also in development build.

I have carefully followed all the steps to add configs and building app but still I'm getting this error, please help.

Rahmathirshad avatar May 09 '24 13:05 Rahmathirshad

is this on ios? if yes what sdk version

karam1ashqar avatar May 14 '24 20:05 karam1ashqar

Facing the same issue here. I'm developing on Android.

anirudhk-tech avatar May 29 '24 18:05 anirudhk-tech

I second this. I cannot get around this issue. Just importing the module gets me this error.

tested on android 15 preview

srt54558 avatar Jun 03 '24 20:06 srt54558

Same problem here, any solution?

victorgoecking avatar Jun 05 '24 17:06 victorgoecking

Same problem here, any solution?

For everyone who's experiencing this problem, what worked for me is building the app all over again. The second time through when you run eas build, make sure you installed react-native-pdf before you start your build. So npx create-expo-app, npm i react-native-pdf, and then eas build in that order.

I think it's because expo automatically creates internal components that go with native module if it's installed before build. If it's installed after, you'd have to manually create these internal components, which I don't know how to. I'm not sure whether this is the reason or not, but it's what I heard.

anirudhk-tech avatar Jun 05 '24 18:06 anirudhk-tech

Same problem here, any solution?

For everyone who's experiencing this problem, what worked for me is building the app all over again. The second time through when you run eas build, make sure you installed react-native-pdf before you start your build. So npx create-expo-app, npm i react-native-pdf, and then eas build in that order.

I think it's because expo automatically creates internal components that go with native module if it's installed before build. If it's installed after, you'd have to manually create these internal components, which I don't know how to. I'm not sure whether this is the reason or not, but it's what I heard.

works like a charm 👍

Samide47 avatar Jul 21 '24 17:07 Samide47

Also got the problem..

defaultdigital1 avatar Jan 20 '25 10:01 defaultdigital1