Hello,
It is frst time I am using React Native you could say and trying to use the WebView from the react-native-webview library. Inside the WebView I have a iframe tag that I want it to strect out like the mobile version in the website. The result ends with really small frame or zoomed out frame. Check the picture below.
I am trying to make it look like this from their website:
Here is the source code when the frame is small:
JavaScript
x
15
15
1
import React from 'react';
2
import { StyleSheet, Text, View } from 'react-native';
3
import { WebView } from 'react-native-webview';
4
5
export default function App() {
6
return (
7
<View style={{ height: '100%', width: '100%' }}>
8
<WebView
9
source={{ html: '<iframe src="https://app.waiteraid.com/reservation/?app_type=bokabord&hash=f6dbbb53f2cbbafdf35e3b82115d411a&gaci=" allowfullscreen></iframe>' }}
10
style={{ marginTop: 40, marginBottom: 40 }}
11
/>
12
</View>
13
);
14
}
15
Here is the code when it is zoomed out:
JavaScript
1
14
14
1
import React from 'react';
2
import { StyleSheet, Text, View } from 'react-native';
3
import { WebView } from 'react-native-webview';
4
5
export default function App() {
6
return (
7
<WebView
8
source={{ html: '<iframe width="100%" height="100%" src="https://app.waiteraid.com/reservation/?app_type=bokabord&hash=f6dbbb53f2cbbafdf35e3b82115d411a&gaci=" allowfullscreen></iframe>' }}
9
style={{ marginTop: 20, marginBottom: 20 }}
10
11
/>
12
);
13
}
14
Advertisement
Answer
I can’t believe myself, instead of sending in a tag to WebView, I should have only given it the link to the website.
JavaScript
1
2
1
<WebView style={styles.webView} source={{ uri: URL }} />
2