WebView html local in Android

I’m trying to open in expo-sdk-35 html file that loads script file.
In IOS everything works fine as expected like this:
<WebView source = { require('./file.html') } />

On the other hand, for Android the above code doesn’t work for me.

I tried:
const myHtml= Asset.fromModule(require('./file.html')).uri; <WebView uri= {{uri: myHtml}} />

I tried with loading the html before in a async way :
const file = await AssetUtils.resolveAsync(require("./file.html")); const paypalHtml = await FileSystem.readAsStringAsync(file.localUri);

Nothing is working for me.
I saw some comments that said to attach the file to android assests folder.
I don’t know how to that in expo (I tried with expo assests directory).

I would appreciate any help,
Thank you from advance.

Hi

See if this thread helps:

What should be the baseUri?

It depends on the images/scripts/etc. referenced in the html.
e.g. if the html contains: <img src="images/test.jpg"> where the full URL is actually https://www.example.com/site/images/test.jpg then the base URL is https://www.example.com/site/

Nothing worked for me.
I solved it by moving the file to the server.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.