Download file to iosreact native






















It looks like mfkp created one that doesn't use RN WebView called react-native-browser a while back but hasn't touched it since. A note on smathson approach of intercepting with onShouldStartLoadWithRequest, if your download request requires authentication then this approach won't work unless you somehow save the necessary information to make an authenticated request.

In our case we are able to use an auth token that we already have saved on the native side. Is there a way to view it instead? I am able to properly download files from webviews, but I would like for them to automatically open once they have finished downloading.

Could someone point me in the right direction for accomplishing this? Dror-Bar and d-vincent my comment above explains on a high level how we accomplished this in our app, but you are going to have to implement your own solution to do it depending on what you want the user experience to be.

It's outside of the scope of react-native-webview as I understand it to handle this kind of stuff automatically. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically.

I'm not actively maintaining this project right now so if anyone wants to do a pull request, more than welcome Skip to content. If not, check the extra setup instructions on react-native-fs page. Install the CocoaPods dependencies iOS specific :. I created an async function downloadPDF which requires a url and fileName. It also contains a basic header with an authorization token and content-type. You can change this to your customised path if you wish. The response from downloadFile contains statusCode , jobId and bytesWritten.

It is important to check both values because, I found it returning even when no files were written. Don't forget to include the style property and set flex:1 as shown above. I can access the image by filepath and set it to a imageview also. Are you sure you want to hide this comment? How about ios? I try it but image not downloaded Reply. Bryan September 3, at am.

How about using CameraRoll api from RN itself? It can save the image to iPhone gallery Reply. How to create folder Reply. Rahul February 28, at am. Leave a Reply Cancel reply Your email address will not be published. Submit Preview Dismiss. Collapse Expand kris kris kris. Nov 25, Dropdown menu Copy link Hide.

Nov 13, Oct 18, May 31, Dec 18, Sep 14, Aug 13, Hide child comments as well Confirm. Log in Create account.



0コメント

  • 1000 / 1000