wonday / react-native-pdf

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

Load Complete callback doesn't happen due to case issue #875

Open GaryGiebler opened 1 month ago

GaryGiebler commented 1 month ago

react-native 0.73.x

react-native-pdf version 6.7.5

What platform does your issue occur on? both

The load complete callback doesn't happen because the code is trying to match case using upper case letters while the actual case is lower case.

Here's the fixed code (line 291 in index.js):

if (res && res.respInfo && res.respInfo.headers && !res.respInfo.headers["content-encoding"] && !res.respInfo.headers["transfer-encoding"] && res.respInfo.headers["content-length"]) { const expectedContentLength = res.respInfo.headers["content-length"];

rajivchaulagain commented 1 month ago
  <Pdf
          ref={pdfRef}
          trustAllCerts={false}
          source={{
            uri,
          }}
          onLoadProgress={(percent) => calculateLoadingProgress(percent)}
          style={{
            width,
            height,
          }}
          onPageSingleTap={(e, x, y) => handlePosition(e, x, y)}
          onLoadComplete={(numberOfPages, path, { height, width }) =>
            console.log(`height & width : ${height} ${width}`)
          }
        />

isn't these working?