The best way is to use the expo-sharing library docs , which exposes different ways of dealing with different types of files. You can tag files with a UTI of your choosing.
The above will open a prompt to the user after any non-image file has downloaded. The prompt will ask the user what the user would like to do with the file. Image files on iOS can be handled the same way as all files are handled in Android below.
There will be more posts coming soon. Stay tuned! This works great. Thank you. Just one query — how can i download the image in a specific directory creating a new one and the get the image from that directory. I am using ios simulator, i have downloaded image by using rn-fetch-blob, i am not able to find image in path. This site uses Akismet to reduce spam. Learn how your comment data is processed. Features of rn-fetch-blob rn-fetch-blob is a project committed to making file access and data transfer easier, efficient for React Native developers.
When building a cross-platform app, you'll want to re-use as much code as possible. Scenarios may arise where it makes sense for the code to be different, for example you may want to implement separate visual components for Android and iOS. Certain components may have properties that work on one platform only. All of these props are annotated with platform and have a small badge next to them on the website.
React Native provides a module that detects the platform in which the app is running. You can use the detection logic to implement platform-specific code. React Native does not currently offer full support for downloading and showing a file.
The approach in this article shows you how to download and display a file using the react-native-fs and react-native-webview libraries respectively. In this example, the file is of a PDF format, however, the same approach can be used for images or other text file formats.
A working React Native App. Not sure how to do this? Checkout the setup instructions on the React Native Website. If you're using React Native version 0. 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.
0コメント