cnjon / react-native-pdf-view

React Native PDF View
MIT License
404 stars 167 forks source link

Error while updating property 'src' of a view managed by: RCTPDFViewAndroid #2

Closed tomvo closed 8 years ago

tomvo commented 8 years ago

Ok, moving one step forward at a time. Now getting this error.

I have a test.pdf in the apps root.

From logcat:

W/RCTPDFViewAndroid( 3196): display test.pdf 1
E/unknown:ViewManager( 3196): Error while updating prop src
E/unknown:ViewManager( 3196): java.lang.reflect.InvocationTargetException
E/unknown:ViewManager( 3196):   at java.lang.reflect.Method.invoke(Native Method)
E/unknown:ViewManager( 3196):   at java.lang.reflect.Method.invoke(Method.java:372)
E/unknown:ViewManager( 3196):   at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:75)
E/unknown:ViewManager( 3196):   at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:40)
E/unknown:ViewManager( 3196):   at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:213)
E/unknown:ViewManager( 3196):   at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:147)
E/unknown:ViewManager( 3196):   at com.facebook.react.uimanager.UIViewOperationQueue$2.run(UIViewOperationQueue.java:673)
E/unknown:ViewManager( 3196):   at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:723)
E/unknown:ViewManager( 3196):   at com.facebook.react.uimanager.GuardedChoreographerFrameCallback.doFrame(GuardedChoreographerFrameCallback.java:32)
E/unknown:ViewManager( 3196):   at com.facebook.react.uimanager.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:120)
E/unknown:ViewManager( 3196):   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:765)
E/unknown:ViewManager( 3196):   at android.view.Choreographer.doCallbacks(Choreographer.java:580)
E/unknown:ViewManager( 3196):   at android.view.Choreographer.doFrame(Choreographer.java:549)
E/unknown:ViewManager( 3196):   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
E/unknown:ViewManager( 3196):   at android.os.Handler.handleCallback(Handler.java:739)
E/unknown:ViewManager( 3196):   at android.os.Handler.dispatchMessage(Handler.java:95)
E/unknown:ViewManager( 3196):   at android.os.Looper.loop(Looper.java:135)
E/unknown:ViewManager( 3196):   at android.app.ActivityThread.main(ActivityThread.java:5221)
E/unknown:ViewManager( 3196):   at java.lang.reflect.Method.invoke(Native Method)
E/unknown:ViewManager( 3196):   at java.lang.reflect.Method.invoke(Method.java:372)
E/unknown:ViewManager( 3196):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
E/unknown:ViewManager( 3196):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
E/unknown:ViewManager( 3196): Caused by: com.joanzapata.pdfview.exception.FileNotFoundException: /test.pdfdoes not exist.
E/unknown:ViewManager( 3196):   at com.joanzapata.pdfview.PDFView.fromFile(PDFView.java:976)
E/unknown:ViewManager( 3196):   at com.keyee.pdfview.PDFViewManager.display(PDFViewManager.java:77)
E/unknown:ViewManager( 3196):   at com.keyee.pdfview.PDFViewManager.setSrc(PDFViewManager.java:92)
E/unknown:ViewManager( 3196):   ... 22 more
E/unknown:React( 3196): Exception in native call from JS
E/unknown:React( 3196): com.facebook.react.bridge.JSApplicationIllegalArgumentException: Error while updating property 'src' of a view managed by: RCTPDFViewAndroid
E/unknown:React( 3196):     at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:86)
E/unknown:React( 3196):     at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:40)
E/unknown:React( 3196):     at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:213)
E/unknown:React( 3196):     at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:147)
E/unknown:React( 3196):     at com.facebook.react.uimanager.UIViewOperationQueue$2.run(UIViewOperationQueue.java:673)
E/unknown:React( 3196):     at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:723)
E/unknown:React( 3196):     at com.facebook.react.uimanager.GuardedChoreographerFrameCallback.doFrame(GuardedChoreographerFrameCallback.java:32)
E/unknown:React( 3196):     at com.facebook.react.uimanager.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:120)
E/unknown:React( 3196):     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:765)
E/unknown:React( 3196):     at android.view.Choreographer.doCallbacks(Choreographer.java:580)
E/unknown:React( 3196):     at android.view.Choreographer.doFrame(Choreographer.java:549)
E/unknown:React( 3196):     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
E/unknown:React( 3196):     at android.os.Handler.handleCallback(Handler.java:739)
E/unknown:React( 3196):     at android.os.Handler.dispatchMessage(Handler.java:95)
E/unknown:React( 3196):     at android.os.Looper.loop(Looper.java:135)
E/unknown:React( 3196):     at android.app.ActivityThread.main(ActivityThread.java:5221)
E/unknown:React( 3196):     at java.lang.reflect.Method.invoke(Native Method)
E/unknown:React( 3196):     at java.lang.reflect.Method.invoke(Method.java:372)
E/unknown:React( 3196):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
E/unknown:React( 3196):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
E/unknown:React( 3196): Caused by: java.lang.reflect.InvocationTargetException
E/unknown:React( 3196):     at java.lang.reflect.Method.invoke(Native Method)
E/unknown:React( 3196):     at java.lang.reflect.Method.invoke(Method.java:372)
E/unknown:React( 3196):     at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:75)
E/unknown:React( 3196):     ... 19 more
E/unknown:React( 3196): Caused by: com.joanzapata.pdfview.exception.FileNotFoundException: /test.pdfdoes not exist.
E/unknown:React( 3196):     at com.joanzapata.pdfview.PDFView.fromFile(PDFView.java:976)
E/unknown:React( 3196):     at com.keyee.pdfview.PDFViewManager.display(PDFViewManager.java:77)
E/unknown:React( 3196):     at com.keyee.pdfview.PDFViewManager.setSrc(PDFViewManager.java:92)
E/unknown:React( 3196):     ... 22 more
cnjon commented 8 years ago

@tomvo E/unknown:ViewManager( 3196): Caused by: com.joanzapata.pdfview.exception.FileNotFoundException: /test.pdfdoes not exist. Sorry! The current version, only support absolute path!

tomvo commented 8 years ago

Ah, got it! Any clue on how to absolutely reference to a file in a folder inside the react-native app?

tomvo commented 8 years ago

Found all the necessary info, thanks a lot!

oliversisson commented 8 years ago

@tomvo - can you share what you learned?

tomvo commented 8 years ago

@oliversisson long time ago! I also built in ionic2. I just copy pasted some snippets into a gist here, maybe it's helpful to you: https://gist.github.com/tomvo/9e79f52d05856ba3b8fc276b6d7ecc5e