react-native-pdf icon indicating copy to clipboard operation
react-native-pdf copied to clipboard

IOS crash

Open hellozengms opened this issue 3 years ago • 1 comments

What react-native version are you using? 0.65.1

What react-native-pdf version are you using? 6.4.0 What platform does your issue occur on? (android/ios/both) ios Describe your issue as precisely as possible :

  1. Open the back of PDF and slide it continuously. Sometimes zoom in and continue to slide. Crash occurs
  2. Last Exception Backtrace: 0 CoreFoundation 0x1848b99d4 __exceptionPreprocess + 216 (NSException.m:199) 1 libobjc.A.dylib 0x19826ab54 objc_exception_throw + 56 (objc-exception.mm:565) 2 CoreFoundation 0x1847c84fc +[NSException raise:format:arguments:] + 96 (NSException.m:146) 3 Foundation 0x185ac0878 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 128 (NSException.m:231) 4 UIKitCore 0x1869c40fc -[UIPageViewController queuingScrollView:didEndManualScroll:toRevealView:direction:animated:didFinish:didComplete:] + 972 (UIPageViewController.m:2036) 5 UIKitCore 0x1869cd6cc -[_UIQueuingScrollView _notifyDelegateDidEndManualScroll:toRevealView:direction:animated:didFinish:didComplete:] + 144 (_UIQueuingScrollView.m:660) 6 UIKitCore 0x1869cf578 -[_UITransitionState cleanupWithFinishedState:completedState:] + 40 (_UITransitionState.m:41) 7 UIKitCore 0x1869cc4ac -[_UIQueuingScrollView _cleanUpCompletionState:didFinish:didComplete:] + 104 (_UIQueuingScrollView.m:518) 8 UIKitCore 0x1869ce154 -[_UIQueuingScrollView _commitGestureDrivenScrollRevealingView:concealingView:inDirection:canComplete:] + 848 (_UIQueuingScrollView.m:759) 9 UIKitCore 0x1869cea68 __54-[_UIQueuingScrollView _didScrollWithAnimation:force:]_block_invoke + 788 (_UIQueuingScrollView.m:817) 10 UIKitCore 0x1869ce474 -[_UIQueuingScrollView _didScrollWithAnimation:force:] + 424 (_UIQueuingScrollView.m:831) 11 UIKitCore 0x1869ca9e8 -[_UIQueuingScrollView layoutSubviews] + 188 (_UIQueuingScrollView.m:239) 12 UIKitCore 0x187627288 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2468 (UIView.m:17521) 13 QuartzCore 0x187b2ab2c -[CALayer layoutSublayers] + 288 (CALayer.mm:10129) 14 QuartzCore 0x187b30ff8 CA::Layer::layout_if_needed(CA::Transaction*) + 520 (CALayer.mm:9996) 15 QuartzCore 0x187b3c314 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 140 (CALayer.mm:2478) 16 QuartzCore 0x187a88570 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 416 (CAContextInternal.mm:2447) 17 QuartzCore 0x187ab26f8 CA::Transaction::commit() + 728 (CATransactionInternal.mm:449) 18 QuartzCore 0x187ab39a8 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92 (CATransactionInternal.mm:925) 19 CoreFoundation 0x18483886c CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 32 (CFRunLoop.c:1799) 20 CoreFoundation 0x184832f40 __CFRunLoopDoObservers + 604 (CFRunLoop.c:1912) 21 CoreFoundation 0x184833488 __CFRunLoopRun + 960 (CFRunLoop.c:2953) 22 CoreFoundation 0x184832b90 CFRunLoopRunSpecific + 572 (CFRunLoop.c:3242) 23 GraphicsServices 0x19ab55598 GSEventRunModal + 160 (GSEvent.c:2259) 24 UIKitCore 0x18711c638 -[UIApplication _run] + 1052 (UIApplication.m:3266) 25 UIKitCore 0x187121bb8 UIApplicationMain + 164 (UIApplication.m:4738) 26 TheOne 0x102880d10 main + 68 (AppDelegate.swift:12) 27 libdyld.dylib 0x184511588 start + 4

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

Show us the code you are using?

export const PdfView=({url})=>{ const [page, setPage]=useState(0); const [totalPage, setTotalPage]=useState(0); return (<View style={styles.container}> <Pdf source={{uri: url, cache: true}} style={styles.pdf} // fitWidth={true} // 默认 false,若为 true 则不能将 fitWidth = true 与 scale 一起使用 fitPolicy={0} // 0:宽度对齐,1:高度对齐,2:适合两者(默认) page={1} // 初始化第几页,1 开始 scale={1} // 页面加载出来 pdf 时的比例 minScale={1} // 最小模块 maxScale={1} // 最大模块 onLoadComplete={(numberOfPages: React.SetStateAction, filePath: any, size:any, tableContents: any)=>{ console.log(number of pages: ${numberOfPages}); // 总页数 setTotalPage(numberOfPages); }}

  onPageChanged={(page, numberOfPages)=>{
    setPage(page);
    console.log(`current page: ${page}`); // 返回当前页
    console.log(`current numberOfPages: ${numberOfPages}`);
    // 返回总页面,其实在 onLoadComplete() 可以获取到
    // 所以不建议在这里获取总页数,因为页面滑动就会触发
  }}
  onError={(error)=>{
    console.log(error);
  }}
  renderActivityIndicator={(progress)=>{
    console.log(`renderActivityIndicator: ${progress}`); // 返回当前页
    return (<View>
      <ActivityIndicator
        animating={true}
        style={[styles.centering, {height: 80}]}
        size="small" />
    </View>);
  }}
  password='111' // pdf 密码,如果密码错误,会触发 onError() 并显示密码不正确或需要密码
  horizontal={false} // 横向
  enablePaging={true} // 在屏幕上只能显示一页
  enableAntialiasing={true} // 在低分辨率屏幕上改进渲染,针对 Android 4.4 上可能会出现的一些问题
  enableRTL={false} // 倒序滑动
  enableAnnotationRendering={true} // 启用渲染注视,iOS 仅支持初始设置,不支持实时更改
  onLoadProgress={(number)=>{
    console.log(number);
    // setProgress(Math.round(number*100)+'%');
  }} // 加载时回调,返回加载进度(0-1)
/>
<Text>
    当前第 {page} 页,共 {totalPage} 页
</Text>

</View>); };

hellozengms avatar Feb 14 '22 02:02 hellozengms

Facing same issue. @hellozengms Were you able to fix it? Or any work around?

abitling avatar Sep 09 '22 09:09 abitling