Comments (1)
What
react-native
version are you using? "0.70.8" Whatreact-native-pdf
version are you using? "^6.7.1" What platform does your issue occur on? (android/ios/both) both, although i'm using expo go Describe your issue as precisely as possible :
- Steps to reproduce the issue or to explain in which case you get the issue
I'm getting a a blob pdf file from backend i want to show it on my screen. On installing react-native-pdf it gives me this error 'Unable to resolve module react-native-blob-util'
on installing react-native-blob-util my app doesn't start and give me error below- Interesting
logs
TypeError: Cannot read property 'getConstants' of null, js engine: hermes
ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog,
RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermesJoin a screenshot or video of the problem on the simulator or device? Show us the code you are using?
useEffect(() => { getTokens() .then((token) => { fetch(Endpoints.FUND_REPORT_FILE(props.route.params.refID), { method: 'GET', headers: { 'Authorization':
Bearer ${token.access}
, }, }) .then((response) => response.blob()) .then((blob) => { const reader = new FileReader(); reader.onloadend = () => { const base64Data = reader.result as string; setPdfData(data:application/pdf;base64,${base64Data}
); }; reader.readAsDataURL(blob); }) .catch((error) => { console.error('Error fetching PDF:', error); }); }); }, [props.route.params.refID]);return ( <View style={style.container}> {pdfData ? ( <PDFView source={{ uri: pdfData, cache: true }} onLoadComplete={() => console.log('PDF loaded')} onError={(error) => console.error('Error loading PDF:', error)} style={{ flex: 1 }} /> ) : ( <ActivityIndicator size="large" color={theme.colors.primary} /> )} </View>
);
Hi, may you send your service function (getToken), and what is FileReader? You can use Buffer from buffer, i think i can help you.
from react-native-pdf.
Related Issues (20)
- ProgressViewIOS is depreciated
- Search Bar / Searching Text In PDF?
- Pdf doesnt look same in ios and android
- BUG: Scroll indicator is not visible on android
- Android build error on latest version [email protected] HOT 27
- When sliding through the PDF file, closing the current page causes the app to crash. HOT 9
- iOS New Architecture/Fabric build error: no member named 'enableDoubleTapZoom' HOT 4
- Android Crash at PDF viewing HOT 11
- "TypeError: Cannot read property 'getConstants' of null, js engine: hermes " after installing "react-native-pdf" package in expo HOT 6
- I'm tring to display pdf but PDF shows blank screen, I'm using base64 data in source HOT 1
- Tried to access a JS module before the React instance was fully set up. HOT 8
- Pdf not loading first time in Android ,gives error open failed:ENONT HOT 8
- rn 0.73.8版本,android上不显示红色盖章和姓名
- Links on iOS not working due to code change introduced with the new `enableDoubleTapZoom` option HOT 6
- HyperLinks on onPressLink is not working in IOS. HOT 11
- pdf file not fully 100% loaded... stops after 80-90% HOT 5
- Android: Does not work with any remote URL - Possible unhandled promise rejection (id: 2): Error: /data/user/... open failed: ENOENT (No such file or directory) HOT 12
- Cannot scroll inside GestureDetector on Android HOT 1
- Android crash: Segmentation violation (invalid memory reference)
- Android: Native crash app error "PDF renderer" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-pdf.