Answer the question
In order to leave comments, you need to log in
How to make a local WebView in Expo?
How to display local html&css file in snack.expo?
import React, { Component } from 'react';
import { StyleSheet, View, Text, WebView } from 'react-native';
export default class Screen3 extends Component {
//Screen3 Component
render() {
const htmlURL = require('./res/index.html').uri;
return (
<WebView
originWhitelist={['*']}
source={{htmlURL}}
useWebKit={true}
style={{ flex: 1 }}
javaScriptEnabled={true}
/>
);
}
}
Answer the question
In order to leave comments, you need to log in
I had the same task. helped for android put the file in android/app/src/main/asstes and specify
source={ uri: "file:///android_asset/YOUR FILE"}. and ios is simpler and works with half a kick (put the file next to it and use required to specify the path).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question