Hi, any idea how do i target file:///android_asset for local HTML?
hey, let me see if I understand: you have an html file you want to reference from another file? is this file on your apps filesystem or is it an asset saved in another folder?
in the first scenario, you can get file info using the FileSystem api
otherwise you should be able to require
the file from its relative path in your project directory
hi @samee thanks for reply,
actually im refering to webview component, i want it to load the HTML file inside my asset folder,
for IOS, it will be <WebView source={ require(‘…/assets/generic.html’) } />
but for android it will be <WebView source={{ uri: ‘file:///android_asset/generic.html’ }} />
however, in expo case, it will be different, as we dont have android/app/src/main/assets folder, and I tried to create it manually, however it failed.
for more info, pls kindly refer to:
https://saumya.github.io/ray/articles/71/
oh interesting, so the require
syntax doesn’t work on android? what happens?
if you want, you could copy the file to somewhere on the apps FileSystem
and reference it from there, but I’m wondering why the simple require wouldn’t work
I also not sure about why require not working
do you have any example of copying it to filesystem?
thank you very much @samee