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

Left/Right Padding Remains When Zoomed

Open rayhanmoidu opened this issue 3 years ago • 2 comments

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, },

rayhanmoidu avatar Sep 14 '20 14:09 rayhanmoidu

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

flysteur-dev avatar Oct 02 '20 15:10 flysteur-dev

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 ;)

kg-currenxie avatar Sep 02 '22 08:09 kg-currenxie