Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

How do I make a WebView display even when offline?

$
0
0

I want a WebView component to display both when online and offline. When online, I want it to use the url I have provided. I want the locally saved/Cached so it can also be displayed when offline. Here's a code example:

`import React from 'react';    import { View, Text, StyleSheet } from 'react-native';    import WebView from 'react-native-webview';    function App() {      return (    <WebView style={styles.container}          source={{ uri: 'https://wikipedia.org' }}      //a random example    />      );    };    const styles = StyleSheet.create({      container: {        flex: 1,        backgroundColor: '#fff',        alignItems: 'center',        justifyContent: 'center'  },    })    export default App;` 

I tried using different dependencies but failed. I'm pretty new to react-native, please don't make it too complex when answering.


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>