wonday / react-native-pdf

A <Pdf /> component for react-native
MIT License
1.6k stars 553 forks source link

Android does not display PDF, downloads and is broken file #688

Closed ploveland closed 2 years ago

ploveland commented 2 years ago

What react-native version are you using? 68.2

What react-native-pdf version are you using? 6.6.2 (react-native-blob-util is version: 16.2)

What platform does your issue occur on? (android/ios/both) android (emulator v.11)

Describe your issue as precisely as possible : 1) Steps to reproduce the issue or to explain in which case you get the issue

We recently upgraded our React-Native from 63.4 to 68.2, as well as our packages to include react-native-pdf. I'm not getting any errors when opening the PDF, but it doesn't display any longer. I get a blank screen with a message that it's been downloaded. When attempting to open the downloaded file, it also says 'can't open file'.

I've tried multiple PDF files, as well as on an IOS emulator. The IOS emulator works properly still.

Join a screenshot or video of the problem on the simulator or device?

Screen Shot 2022-09-06 at 3 04 57 PM

Show us the code you are using?

const showPDF = () => (
    <View testID="pdfLesson" accessibilityLabel="pdfLesson">
      <Pdf
        trustAllCerts={false}
        source={{ uri: url }}
        onError={onError}
        style={{
          width,
          height: Platform.OS === 'ios' ? IOS_PDF_HEIGHT : ANDROID_PDF_HEIGHT,
          backgroundColor: Colors.grey12,
        }}
      />
    </View>
  );
normenster commented 1 year ago

@ploveland Why is this closed and what was the solution ? I`m struggling also with PDFs not displayed on Android.

mobilehubster commented 1 year ago

@ploveland @normenster https://stackoverflow.com/questions/55805955/react-native-pdf-showing-on-android-simulator-but-getting-error-on-actual-andro

mobilehubster commented 1 year ago

@normenster @ploveland This ticket was closed because this lib does not have any problems with android or pdf. U just have to move your pdf to bundle.