Facing ReactNativeBlobUtil request error in React Native
Asked Answered
P

1

20

I was facing issue in React Native when using react-native-pdf to display pdf in App

logs displayed in console:

Error: ReactNativeBlobUtil request error: java.lang.IllegalStateException: Use of own trust manager but none definedjava.lang.IllegalStateException: Use of own trust manager but none defined]

Photooffset answered 19/6, 2022 at 7:1 Comment(0)
P
81

Open Your code and simply use trustAllCerts prop and set its value false

as shown below :

<Pdf
                    trustAllCerts={false}
                      source={{
                        uri: pdfUrl,
                        cache: true,
                      }}
                      onLoadComplete={(numberOfPages, filePath) => {
                        console.log(`Number of pages: ${numberOfPages}`);
                      }}
                      onPageChanged={(page, numberOfPages) => {
                        console.log(`Current page: ${page}`);
                      }}
                      onError={error => {
                        console.log(error);
                      }}
                      onPressLink={uri => {
                        console.log(`Link pressed: ${uri}`);
                      }}
                      style={styles.pdf}
                    />
Photooffset answered 19/6, 2022 at 7:1 Comment(1)
Works for me. Thanks. Another point to keep in mind is, if you enclose this <Pdf/> in <SafeAreaView/> it doesn't work!!Rotenone

© 2022 - 2024 — McMap. All rights reserved.