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

Cannot Read propertly getDocumentsDirectory of undefined in IOS only

Open Rahish opened this issue 5 years ago • 17 comments

anyone can help me solve it ?

Rahish avatar Jan 15 '20 11:01 Rahish

This sounds like the module isn't correctly linked.

https://facebook.github.io/react-native/docs/linking-libraries-ios

Can you follow the steps there and let me know if you're still having trouble?

thekevinbrown avatar Feb 09 '20 23:02 thekevinbrown

I got the same issue. Followed manual linking steps on react-native documentation. The issue is still there.

Possible Unhandled Promise Rejection (id: 0): TypeError: Cannot read property 'getDocumentsDirectory' of undefined

vrautgit avatar Mar 05 '20 10:03 vrautgit

Same for me and it's well linked

jonathanroze avatar Mar 17 '20 23:03 jonathanroze

A reproduction would help us troubleshoot it. This is working in my projects so it's hard to tell what the issue could be.

thekevinbrown avatar Mar 21 '20 01:03 thekevinbrown

Same issue here. Just copy and pasted the example code. I installed with:

yard add react-native-pdf-lib
cd ios && pod install

EricWiener avatar Apr 05 '20 22:04 EricWiener

Same for me. I installed it this way: yarn add react-native-pdf-lib cd ios pod install

I am getting TypeError: null is not an object (evaluating '_reactNativePdfLib.default.getDocumentsDirectory')

costvin15 avatar Apr 06 '20 09:04 costvin15

@costvin15 I’d recommend using pdf-lib. It works perfectly for me with no native dependencies.

EricWiener avatar Apr 06 '20 11:04 EricWiener

Thanks @EricWiener, I will search on. I am now using react-native-html-to-pdf and it is serving me well.

costvin15 avatar Apr 07 '20 09:04 costvin15

@EricWiener, and @costvin15 I don't see the linking step there in the installation, which would cause this.

Ultimately if the PDFs you're using are small enough to be able to use the pure JS implementation then that's what I'd recommend too as having native modules adds complexity.

thekevinbrown avatar Apr 09 '20 08:04 thekevinbrown

facing the problem in android not ios

lylest avatar May 06 '20 07:05 lylest

Same in iOS. It looks like there is an issue with auto-linking in React Native 0.60+

ivanstnsk avatar Jun 05 '20 12:06 ivanstnsk

I'm using this library on React Native 59, and would welcome a PR to support auto-linking for 60+.

thekevinbrown avatar Jun 09 '20 05:06 thekevinbrown

I'm getting the same issue in IOS react-native": "0.62.2". When can we expect to fix this issue for the latest react native version?

venkat-waran avatar Jul 13 '20 09:07 venkat-waran

@venkat-waran when someone either creates a new PR to solve the issue, or takes ownership of getting #65 over the line.

thekevinbrown avatar Oct 02 '20 08:10 thekevinbrown

This issue is still happening.

tgreco avatar Dec 28 '20 17:12 tgreco

Possible Unhandled Promise Rejection (id: 0): TypeError: Cannot read property 'getDocumentsDirectory' of null how to resolve this

neha-11111 avatar May 10 '23 10:05 neha-11111