wonday / react-native-pdf

A <Pdf /> component for react-native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Rahmathirshad opened this issue · 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.

commented

is this on ios? if yes what sdk version

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

commented

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

tested on android 15 preview

Same problem here, any solution?

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.