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

PDF preview not working on Android (but working on iOS)

Open OnizukaJS opened this issue 6 months ago • 6 comments

Hello everyone!

  • Using Expo SDK 51

  • react-native version: "0.74.5"

  • react-native-pdf version: "6.7.5"

Code:

    <View className="flex-1 items-center justify-center">
      <Pdf
        source={{
          uri: file.uri,
          cache: true,
        }}
        trustAllCerts={false}
        onLoadComplete={(numberOfPages) => {
          setPdfPages(numberOfPages)
        }}
        onPageChanged={(page) => {
          setCurrentIndex(page - 1)
        }}
        style={{
          width: PAGE_WIDTH,
          height: PAGE_HEIGHT,
        }}
        horizontal
        enablePaging
      />
    </View>

On iOS, the onLoadComplete fires so I can set the number of pages 11 and swipe from page to another (swiped to page 2 below):

On android, the onLoadComplete doesn't fire and I can't swipe to other pages:

Thanks for the help!

OnizukaJS avatar Jun 12 '25 08:06 OnizukaJS