Skip to content

Commit

Permalink
Ignore borderRadius to prevent crash on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasjunior committed Mar 24, 2023
1 parent 7b7c4ce commit 87bdf5d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand All @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions Sample/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -669,7 +669,7 @@ SPEC CHECKSUMS:
React-RCTVibration: ad17efcfb2fa8f6bfd8ac0cf48d96668b8b28e0b
React-runtimeexecutor: 8fa50b38df6b992c76537993a2b0553d3b088004
ReactCommon: b49a4b00ca6d181ff74b17c12b2d59ac4add0bde
ReactNativePdfRenderer: fe4ead7880f402fbba8583e5de2b6428610ed5c1
ReactNativePdfRenderer: b85f20bb86ac7494fadd0f7713b9fe19432fd457
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
Yoga: 79dd7410de6f8ad73a77c868d3d368843f0c93e0
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
Expand Down
5 changes: 4 additions & 1 deletion src/PdfRendererView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<OnPageChangeEventType>) => {
Expand Down

0 comments on commit 87bdf5d

Please sign in to comment.