wonday / react-native-pdf

A <Pdf /> component for react-native
MIT License
1.59k stars 546 forks source link

Left/Right Padding Remains When Zoomed #500

Open rayhanmoidu opened 4 years ago

rayhanmoidu commented 4 years ago

What react-native version are you using? 0.61.5 What react-native-pdf version are you using? 6.1.2

What platform does your issue occur on? (android/ios/both) ios

Describe your issue as precisely as possible : Trying to add padding on left and right sides of pdf, but the padding remains when I pinch zoom. Is there any way to work around this?

Code: The way I added left/right padding was by adding the following styling to the pdf object's style prop.

pdf: { flex: 1, width: Dimensions.get('window').width-20, height: Dimensions.get('window').height, backgroundColor:'rgba(227, 227, 227, 1)', padding:10, },

flysteur-dev commented 3 years ago

I’m also having this issue with IOS.

As a workaround you could use a scale lower than 1 to simulate the lateral padding instead of using a padding.

Example: scale : 0.9 minScale: 0.9

kg-currenxie commented 2 years ago

Same. I did:

  const padding = 20
  const percentageFromPadding =
    (dimensions.width - padding * 2) / dimensions.width

  return (
       ...
        <Pdf
          scale={percentageFromPadding}
          minScale={percentageFromPadding}

0.9 is close, but this is exact ;)