Skip to content

Latest commit

 

History

History
60 lines (44 loc) · 2.26 KB

File metadata and controls

60 lines (44 loc) · 2.26 KB
id title
webView
WebView

import PlatformTabs from '@theme/PlatformTabs';

Description

WebView renders HTML, CSS, and JavaScript content in a prism. When you enable web inspectors in your app, use web inspector clients, such as Chrome DevTools, to debug the displayed WebView content.

Example

⚠️ Don't forget to include the WebView and Internet privileges in your manifest.xml file!
<uses-privilege ml:name="WebView"/>
<uses-privilege ml:name="Internet"/>
import React from "react";
import { View, WebView, Prism, Scene } from "magic-script-components";

export class ExampleWebView extends React.Component {

  render() {
    return (
      <Scene>
        <Prism size={[1, 1, 0.2]} >
          <View name="main-view" anchorPoint={'center-center'}>
            <WebView width={1} height={0.8} url={'https://www.magicleap.com'} />
          </View>
        </Prism>
      </Scene>
    );
  }
}

Create Properties

Name Type Default Value Required Description
width number n/a Y The width of the WebView. Must be greater than 0
height number n/a Y The height of the WebView. Must be greater than 0

Element Properties

Name Type Default Value Description
url string n/a Sets the URL to load in the WebView.
action string n/a Requests the specified action.
scrollBy vec2 n/a Scrolls the WebView in the given direction. Enter an array of two numbers: [xPixels, yPixels]

action options: WebViewAction