Reputation: 61
Working fine in expo mobile app, but same code doesn't show anything when opening Expo App on Web browser by running command expo start --web
Here is the sample code
<WebView
originWhitelist={['*']}
source={{ uri: 'https://sofit.ltd' }}
style={{marginBottom:100, height:"100%", width:"100%" }}
/>
Upvotes: 6
Views: 6475
Reputation: 5835
For me the answer was to wrap it with a View:
<View style={styles.container}>
<StatusBar style="auto" />
<View style={styles.webviewContainer}>
<WebView
originWhitelist={['*']}
source={{ uri: currentURI }}
ref={webViewRef}
style={styles.webview}
/>
</View>
</View>
// Styles
const styles = StyleSheet.create({
container: {
marginTop: Constants.statusBarHeight,
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
webview: {
flex: 1,
},
webviewContainer: {
flex: 1,
alignSelf: 'stretch',
},
});
Upvotes: 1
Reputation: 3621
Did you try in web only? try this snack: https://snack.expo.io/@djalik/webview-demo
Upvotes: 5