From 87bdf5db6d1dc7db559e98fbe5da8265c6fba82f Mon Sep 17 00:00:00 2001 From: Douglas Nassif Roma Junior Date: Fri, 24 Mar 2023 17:49:21 -0300 Subject: [PATCH] Ignore borderRadius to prevent crash on iOS --- README.md | 8 +++++++- Sample/ios/Podfile.lock | 4 ++-- src/PdfRendererView.tsx | 5 ++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e1e221a..4f12816 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ If the file is online, you can use some third part library like `expo-file-syste For more details, see the [Sample Project](https://github.com/douglasjunior/react-native-pdf-renderer/blob/master/Sample/App.tsx). -## Props +## PdfRendererView props Inherits [View Props](https://reactnative.dev/docs/view#props). @@ -75,6 +75,12 @@ Inherits [View Props](https://reactnative.dev/docs/view#props). |onPageChange|`(current: number, total: number) => void`||Invoked on pages scroll.| |singlePage|`boolean`|`false`|Renders only the first page without scroll. (useful for display thumbnail)| +## Limitations + +The `borderRadius` style is ignored by React Native custom view in Android and crash on iOS. + +So, if you need the best option is to wrap the `PdfRendererView` in another `View`. + ## Contribute New features, bug fixes and improvements are welcome! For questions and suggestions use the [issues](https://github.com/douglasjunior/react-native-pdf-renderer/issues). diff --git a/Sample/ios/Podfile.lock b/Sample/ios/Podfile.lock index 01feaa8..2a8bc40 100644 --- a/Sample/ios/Podfile.lock +++ b/Sample/ios/Podfile.lock @@ -431,7 +431,7 @@ PODS: - React-jsi (= 0.71.4) - React-logger (= 0.71.4) - React-perflogger (= 0.71.4) - - ReactNativePdfRenderer (1.0.1): + - ReactNativePdfRenderer (1.0.2): - React-Core - SocketRocket (0.6.0) - Yoga (1.14.0) @@ -669,7 +669,7 @@ SPEC CHECKSUMS: React-RCTVibration: ad17efcfb2fa8f6bfd8ac0cf48d96668b8b28e0b React-runtimeexecutor: 8fa50b38df6b992c76537993a2b0553d3b088004 ReactCommon: b49a4b00ca6d181ff74b17c12b2d59ac4add0bde - ReactNativePdfRenderer: fe4ead7880f402fbba8583e5de2b6428610ed5c1 + ReactNativePdfRenderer: b85f20bb86ac7494fadd0f7713b9fe19432fd457 SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608 Yoga: 79dd7410de6f8ad73a77c868d3d368843f0c93e0 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a diff --git a/src/PdfRendererView.tsx b/src/PdfRendererView.tsx index 0959259..4646ba9 100644 --- a/src/PdfRendererView.tsx +++ b/src/PdfRendererView.tsx @@ -53,7 +53,10 @@ const styles = StyleSheet.create({ const PdfRendererView = (props: PdfRendererViewPropsType): JSX.Element => { const {onPageChange, style, source, singlePage, maxZoom, ...others} = props; - const viewStyles = useMemo(() => [styles.default, style], [style]); + const viewStyles = useMemo(() => [styles.default, style, { + // See https://github.com/douglasjunior/react-native-pdf-renderer#limitations + borderRadius: null, + }], [style]); const handlePageChange = useCallback( (event: NativeSyntheticEvent) => {