-
-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
component doesn't render #15
Comments
What do you mean by display only on edit mode? |
I updated code in questions, had to remove "<" and "/>" because it doesn't show fully with with them |
So my PDFReader is inside View, ScrollView, KeyboardAvoidingView |
iOS or android ? For now I recommend to use this component in full screen. |
Can you provide a screenshot? |
When it is wrapped in just a View it works! Thank you for help! :) |
Close and add in FAQ: https://github.com/xcarpentier/rn-pdf-reader-js#faq |
Hi there, I keep getting this error: This is what is pass to the PDFReader: My package.json: |
I am having the same issue as the one described above. Could it be related to the upgrade to expo 31? |
Hello guys, I solved the display problem by adding the following code inside the styles pdf: { |
`import React, { memo } from 'react';
}
export default memo(LearningScreen);` not showing anything on screen please help me to solve it |
does anyone use the headers? cant get mine to track to the desired destination set on the pdf, honestly Im not even sure if I have this configured properly <View style={{width: '100%', height: '100%'}}> |
Does the work while the device is offline. The following code is what i use. the path being from the filesystem i.e. file://path. |
Were you able to fix this? |
i tried " |
So on closely looking at the code I realized that offline pdf will load from your local file storage but the Pdf viewer itself requires an internet connection to load CDN files, so the device has to be online |
Hi! NOTE: Please read docs from EXPO about FileSystem before continue reading this: https://docs.expo.dev/versions/latest/sdk/filesystem I did my "best" approach to play the reader OFFLINE/ONLINE loading files 1 .- You have to download the CDN the first time that user use the APP, then save it in the storage using FileSystem, obviously the first time that our user use the app it has to be ONLINE I did this in my App.js, this is my first screen to render in my app 2 .- Then you have to edit the index.js file of the module "rn-pdf-reader-js" like this, this means that were always loading CDN from our device no from internet 2.1 .- Edit the HTML like this 3 .- And voilà, you can actually render the PDF reader OFFLINE this only works with files that are store in our device (ie. I KNOW THAT THIS IS NOT THE BEST OPTION BUT THIS IS A GOOD WORKAROUND TO SOLVE THIS I KNOW THAT THIS MODULE WILL CHANGE EVERYTIME THAT WE RUN "NPM INSTALL", THIS MEANS THAT "index.js" WILL NOT WORK TILL WE CHANGE IT AGAIN (STEP #2) THANKS TO @monizb for the feedback |
That's a brilliant workaround! |
Are you sure that FileSystem.readDirectoryAsync will return an array on the same file order that you dowload them? If not the pdfjsLib.GlobalWorkerOptions.workerSrc can get the wrong destination source. You must to make sure where they are before passing them to the scripts tags and off course to the key (workerSrc) above. So you must to reorder the array.
So the cdnList will return the alphabetic order, even if it was not, and you will know exactly where is the index for each filepath. So, if you do not want to change the indexes that you already added to the in the index.js, just add a prefix to each file when you created them to dowload like rn1-, rn2- , rn3-, rn4-, rn5- and prepend them in each file since they are on the same order that you added them to the index.js, but keep the cndList.sort(), just to be sure they will be where we want. Another solution is do the same thing that xcaperntier did, embed each js file as base64 on the bundleContainer and call a function to decode the string and write it to a file with a name that you wish and add it to the source of html. In this case, the pdf viewer will work even the user open it first time without a connection. xcarpentier save and remove it when the component will unmount, but you can leave them there. Good solution, thank you. Great work! |
why my hooks dosent render a pdf by using fetch api in rn-pdf-reader-js . please help i'm new in this native |
@AlacranBlanco |
Is this project compatible with SDK 49? |
Seeing error with SDK 49. Has anyone tried using with SDK49. Error: Cannot convert value to null object Works fine with SDK48. WebView package dependency seem like |
@mktspace I also found same issue on expo SDK 49 |
Hi i have following versions:
"devDependencies": {
"jest-expo": "27.0.0",
"react-native-scripts": "1.11.1",
"react-test-renderer": "16.2.0"
},
"dependencies": {
"expo": "^27.0.0",
"react": "^16.3.1",
"react-native": "^0.55.4"
}
"expo": {
"sdkVersion": "27.0.0",
}
The component doesn't give any error just nothing. The problem is not in uri/base64 they are fine, i tried uri from your example
This is the code:
KeyboardAvoidingView keyboardVerticalOffset={80} behavior="padding" style={{ flex: 1 }}
ScrollView style={{ flex: 1 }}
View style={{ flex: 1,
paddingTop: Constants.statusBarHeight}}>
<PDFReader
source={{ uri: "http://gahp.net/wp-content/uploads/2017/09/sample.pdf" }}
/>
View
ScrollView
KeyboardAvoidingView
Thank you
upd: the full code not displayed i don't know why, it displays only in edit mode
The text was updated successfully, but these errors were encountered: