xcarpentier / rn-pdf-reader-js

📄 PDF reader in JavaScript only for Expo - Android & iOS capable
MIT License
386 stars 163 forks source link

Object entries requires that input parameter not be null or undefined #196

Open aasuparekh1 opened 11 months ago

aasuparekh1 commented 11 months ago

Issue Description

Error: Object.entries requires that input parameter not be null or undefined

Steps to Reproduce / Code Snippets

import React from 'react' import { StyleSheet, View, Text,Dimensions } from 'react-native' import PDFReader from 'rn-pdf-reader-js'

export default class App extends React.Component { render() { return (

)

} }

const styles = StyleSheet.create({ container: { paddingTop: 30, flex: 1, }, imageContainer: { flex: 1, width: Dimensions.get("window").width, height: Dimensions.get("window").height, }, })

Expected Results

open pdf in pdf viewer

Additional Information

mhstrkmp commented 11 months ago

Had the same issue after upgrading to expo SDK49. I am not sure if this is the best approach, but after downgrading react-native-webview in my case back to 11.23.1 it works again. However, it is not the recommended version by expo.

dev-jaydeep commented 11 months ago

Checkout the comment to make it resolve.

https://github.com/xcarpentier/rn-pdf-reader-js/issues/195#issuecomment-1693329604

WuZhiChun commented 8 months ago

Had the same issue after upgrading to expo SDK49. I am not sure if this is the best approach, but after downgrading react-native-webview in my case back to 11.23.1 it works again. However, it is not the recommended version by expo.

但是在IOS ,不行

MateusArenas commented 7 months ago

try this to resolve:

import PDFReader, { Props } from 'rn-pdf-reader-js'

class MyPDFReader extends PDFReader {
  constructor(props: Props | Readonly<Props>) {
    super(props);
    this.state = { ...this.state, renderedOnce: true };
  }
}

....

return (
   <MyPDFReader 
       source={{ uri: uri }}
       ....
   />
)