React Native Load Local HTML File Place Inside App in WebView

React Native’s WebView gives us an sparkling facility to Load Local HTML File with Style.CSS and JavaScript file inside WebView in Android and iOS applications. We can make a Mobile website in HTML language with CSS file and put that complete website inside our Application in a particular folder and call the specific HTML file in WebView. This would help us to create and Show Static website application for some special purpose. All the Tags in HTML file should work fine and this method also supports External CSS(Caching Style Sheet) and JavaScript + JQuery files attached to HTML file.

Contents in this project Load Local HTML File Place Inside App in WebView in Android iOS Example :

1. Create a folder inside your project folder named as Local_Website like i did in below screenshot.


2. Now Download Both SampleHtmlFile.html and Style.css file from below and copy inside Local_Website folder.

Download SampleHtmlFile.html File.

Download Style.css File.

Code For SampleHtmlFile.html file :

Code for styles.css file :

Now next step is to start coding your application.

3. Open your App.js file and Import StyleSheet, WebView and Platform component in your project.

4. Create a const variable named as LoacalWebURL and set the Web page URL using require format.

5. Create the WebView component inside render’s return block and set Source as LoacalWebURL . This would directly navigate the Source to local webpage.

6. Create Custom Style.

7. Complete source code for App.js File :

Screenshot in Android application :

Load Local HTML FileScreenshot in iOS Application :