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

react-native-pdf enableRTL false and move left to right in android

Open bilal882 opened this issue 2 years ago • 1 comments

I am using react native version 0.72.5 and using the version 6.7.1 of react-native-pdf I am trying to change the direction of moving page from left to right I have passed the prop enableRTL false but not working

here is code

<Pdf trustAllCerts={false} horizontal enablePaging source={source} page={currentPage} enableRTL={false} style={styles.pdf} />

bilal882 avatar Oct 02 '23 10:10 bilal882

I have find one solution to move right to left

First make a pdf component and set code like below

`here

  <Pdf
                source={source}
                trustAllCerts={false}
                onError={(error) => {
                    console.log('error', error)
                }}
                style={[styless.pdf, { transform: [{ scaleX: -1 }] }]}
                horizontal={true}
                enablePaging={true}
            />`

then make a parent of that and give it style ` here

 <View style={[styless.pdfContainer]}>
   // your pdf component
 </View>

`

then style it

` const styless = StyleSheet.create({

pdf: {
    flex: 1,
    width: Dimensions.get('window').width,

    height: Dimensions.get('window').height,
},
pdfContainer: {
    flex: 1,
    width: Dimensions.get('window').width,
    height: Dimensions.get('window').height,
    transform: [{ scaleX: -1 }], // Flip horizontally
},

})`

then flip your pdf horizontal throught canva

https://github.com/wonday/react-native-pdf/assets/98903105/06ed1afe-5399-4f39-b2b8-d9184ca980d7

as show in video.

bilal882 avatar Feb 23 '24 20:02 bilal882