Reputation: 1149
i am trying to make webview application with vue-native-cli
i am trying to use web-view component with help of documents
this is my page
<template>
<web-view
:source="'https://google.com'"
:style="{marginTop: 20}"
/>
</template>
<script>
export default {
methods: {
}
}
</script>
<style>
</style>
when i use
<view class="text-container">
<text>Hello World</text>
</view>
its working fine but in webview getting
invarian voilation: Element type is invalid
Upvotes: 3
Views: 3507
Reputation: 984
It appears that some pieces of React Native have changed under the hood and the Vue Native docs haven't yet been updated to address it. Answer as of March 2020:
expo install react-native-webview
:source
prop passes the uri as an object:<template>
<web-view :source="{uri:'https://google.com'}" />
</template>
<script>
import { WebView } from "react-native-webview";
export default {
name: "myComponent",
components: {
"web-view": WebView
}
};
</script>
Upvotes: 6
Reputation: 36
you have to import WebView first
import { WebView } from "react-native";
export default {
components: {
'web-view': WebView
},
};
<template>
<web-view
:source="'https://google.com'"
:style="{marginTop: 20}"
/>
</template>
Upvotes: 0