Skip to content

Conversation

@kishannareshpal
Copy link

@kishannareshpal kishannareshpal commented Jan 3, 2026

What?

Adds support for styles.borderRadius to the PdfView component.

  • iOS
  • Android (no changes required - android already supports border radius)

Motivation

First of all, thank you @wonday and everyone else for maintaining this library — it has been extremely helpful.

In one of my apps, I needed to render the PDF view inside a rounded container (e.g. a card UI). However, I think PdfView currently does not support rounded corners on iOS due to how PDFKit renders its content.

How?

iOS

Internally, PDFView (which is the native impl. of the renderer this lib uses on iOS) manages a UIScrollView for page rendering. Applying a corner radius directly to the PDFView on its own does not fully work as you'd have to recursively apply the same radius to the UIScrollView internal views, but that does not quite work when scrolling as the pages are lazily rendered - resulting in wonky rounded pages some of the times.

Note: I had initially verified the above using this snippet via d9e0714
- (void)applyCornerRadius:(UIView *)view radius:(CGFloat)radius {
	view.layer.cornerRadius = self.layer.cornerRadius;
	view.layer.masksToBounds = YES;
// Recursively apply the corner radius to the subviews, otherwise those will take precendence
if ([view isKindOfClass:[UIScrollView class]]) {
	view.layer.cornerRadius = radius;
	view.layer.masksToBounds = YES;
	view.clipsToBounds = YES;
}

for (UIView *subview in view.subviews) {
	[self applyCornerRadius:subview radius:radius];
}

}

So I decided to wrap the PDFView in a dedicated clipping container instead, which is then responsible for applying the corner radius and clip its child view, which in this case is PdfView.

iOS
Screen.Recording.2026-01-03.at.09.55.18.mp4

Android

Setting border radius in android already works in this library which is great! So nothing changes in this end.

Android (no changes needed)
Screen.Recording.2026-01-03.at.15.18.41.mp4

PS: If you have any other suggestions, I’d love to hear them and will gladly take them on board.

Cheers,
Kishan

@kishannareshpal kishannareshpal marked this pull request as ready for review January 3, 2026 15:22
@kishannareshpal
Copy link
Author

kishannareshpal commented Jan 3, 2026

err, nevermind - I don't know how I missed this, but I just realized that could achieve the same in React by wrapping it with another View and applying overflow: 'hidden' to that

Screenshot 2026-01-03 at 16 10 14

This PR is now redundant due to this workaround :) so I'm closing it.

@kishannareshpal kishannareshpal deleted the support-border-radius branch January 4, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant