【问题标题】:Facing ReactNativeBlobUtil request error in React Native面对 React Native 中的 ReactNativeBlobUtil 请求错误
【发布时间】:2022-06-19 15:01:22
【问题描述】:
我在使用react-native-pdf 在应用程序中显示 pdf 时遇到了 React Native 问题
控制台中显示的日志:
错误:ReactNativeBlobUtil 请求错误:
java.lang.IllegalStateException:使用自己的信任管理器,但没有
definedjava.lang.IllegalStateException:使用自己的信任管理器,但
没有定义]
【问题讨论】:
标签:
react-native
pdf
blob
react-native-pdf
【解决方案1】:
打开您的代码,只需使用 trustAllCerts 道具并将其 value 设置为 false
如下图:
<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}
/>