Skip to content
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

not working in android and iOS both #195

Open
SayaliEdulab opened this issue Aug 18, 2023 · 4 comments
Open

not working in android and iOS both #195

SayaliEdulab opened this issue Aug 18, 2023 · 4 comments

Comments

@SayaliEdulab
Copy link

Issue Description

while loading pdf in this package we getting error in android and white screen in the IOS

In android

image

Steps to Reproduce / Code Snippets

//import libraries
import { NavigationContainer } from '@react-navigation/native';
import React, { Component } from 'react';
import { View, Text, StyleSheet } from 'react-native';
import PDFReader from 'rn-pdf-reader-js'

// create a component
const PdfViewer = (props) => {

return (

    <View style={{ backgroundColor: '#fff', width: '100%', height: '100%' }}>
        <PDFReader
            source={{
                uri: props.route.params.pdfUri,
            }}
            withPinchZoom={true}
            withScroll={true}
        />
    </View>

);

};

//make this component available to the app
export default PdfViewer;

Expected Results

view pdf

Additional Information

  • Nodejs version: [16.13.0]
  • React Native version: [0.72.3]
  • rn-pdf-reader-js version: [4.1.1]
  • Platform(s) (iOS, Android, or both?): [both]
@SBRKH
Copy link

SBRKH commented Aug 24, 2023

Exact same problem here...

I tried to do the same trick as this issue : react-native-webview/react-native-webview#2920
But didn't work for me.

@dev-jaydeep
Copy link

Create your own component name PdfReader and copy the all code from rn-pdf-reader-js\lib\index.js replace the line source: renderedOnce || !isAndroid ? source : undefined with source: renderedOnce || !isAndroid ? source : { uri: undefined }

copy the bundleContainer.js to components directory

Checkout Example Here

Its working well in IOS and Android

<PdfReader
        style={{ flexGrow: 1 }}
        source={{
          uri: pdfUrl,
        }}
/>

Happy Coding!

@rss14
Copy link

rss14 commented Oct 30, 2023

Create your own component name PdfReader and copy the all code from rn-pdf-reader-js\lib\index.js replace the line source: renderedOnce || !isAndroid ? source : undefined with source: renderedOnce || !isAndroid ? source : { uri: undefined }

copy the bundleContainer.js to components directory

Checkout Example Here

Its working well in IOS and Android

<PdfReader
        style={{ flexGrow: 1 }}
        source={{
          uri: pdfUrl,
        }}
/>

Happy Coding!

Resolveu, muito obrigado!

@Tibze
Copy link

Tibze commented Dec 7, 2023

Create your own component name PdfReader and copy the all code from rn-pdf-reader-js\lib\index.js replace the line source: renderedOnce || !isAndroid ? source : undefined with source: renderedOnce || !isAndroid ? source : { uri: undefined }

copy the bundleContainer.js to components directory

Checkout Example Here

Its working well in IOS and Android

<PdfReader
        style={{ flexGrow: 1 }}
        source={{
          uri: pdfUrl,
        }}
/>

Happy Coding!

Thanks for the solution ! @xcarpentier hi, can you merge this fix on Master ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants