I am trying to display pdf file in react-native app.
Here is my code: getting blob from api :
Blob {
"_data": Object {
"blobId": "85225e45-7f45-463b-bd62-a9170551a3b7",
"lastModified": undefined,
"offset": 0,
"size": 3028,
"type": "application/pdf",
},
}
Note: After converting to base64Data i am able to render images but not pdf files.
const fileReaderInstance = new FileReader();
fileReaderInstance.readAsDataURL(response.data);
fileReaderInstance.onload = () => {
base64data = fileReaderInstance.result;
dispatch({
type: OPEN_DOCUMENT, url: base64data
});
}
And in render
<WebView
source={{ uri: url }}
originWhitelist={['*']}
/>
(working fine for images)
<Image source={{uri: url}} style={{ height: 400, width: 300, }} />