I am having trouble loading a local HTML, CSS, and JS file in my React Native webview. The CSS is not being applied to the HTML. Here is my folder structure:
https://i.sstatic.net/mqYT9.png
My HTML file, along with CSS, images, and JS file are all placed in the following app folder structure:
src --> html --> demo --> paste all files inside this directory. Refer to the image below:
https://i.sstatic.net/m85wv.png
Here is how I am using the HTML in my screen:
let demoHtmlData = require('../../../html/demo/demo.html')
<WebView
style={{flex: 1}}
source={demoHtmlData}
/>
Although the HTML loads successfully, the CSS styles such as colors are not being applied. Below is a snippet of the head section from the HTML file:
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
<title>VIVJOA®</title>
<meta name="apple-mobile-web-app-status-bar-style" content="#7D5895">
<meta name="theme-color" content="#7D5895" />
<link href="css/style.css" rel="stylesheet">
</head>
The CSS file "css/style.css" specified in the HTML is not being applied in the webview. Does anyone have any suggestions on how to resolve this issue?