7.0.2 • Published 1 year ago

nativescript-advanced-webview v7.0.2

Weekly downloads
232
License
MIT
Repository
github
Last release
1 year ago

Installation

To install execute:

NativeScript 7+:

ns plugin add nativescript-advanced-webview

NativeScript < 7:

tns plugin add nativescript-advanced-webview@5.0.0

Here is a video showing off Chrome CustomTabs in NativeScript.

Android

CustomTabs

iOS

SFSafariViewController

Why use this? Because Perf Matters

Android Comparison

Demo

AndroidiOS
Android SampleiOS Sample

Example

TypeScript

Initiate the service before the app starts e.g app.ts, main.ts

import { init } from 'nativescript-advanced-webview';
init();
import {
  AdvancedWebviewEvents,
  AdvancedWebViewOptions,
  init,
  NSAdvancedWebViewEventEmitter,
  openAdvancedUrl
} from 'nativescript-advanced-webview';

function whateverYouLike() {
  NSAdvancedWebViewEventEmitter.once(AdvancedWebviewEvents.LoadStarted, () => {
    console.log('LOAD STARTED');
  });

  NSAdvancedWebViewEventEmitter.once(AdvancedWebviewEvents.LoadFinished, () => {
    console.log('LOAD FINISHED');
  });

  NSAdvancedWebViewEventEmitter.once(AdvancedWebviewEvents.LoadError, () => {
    console.log('LOAD ERROR');
  });

  NSAdvancedWebViewEventEmitter.once(AdvancedWebviewEvents.Closed, () => {
    console.log('CLOSED');
  });

  const opts: AdvancedWebViewOptions = {
    url: 'https://nativescript.org',
    showTitle: true,
    toolbarColor: '#336699',
    toolbarControlsColor: '#fff'
  };

  openAdvancedUrl(opts);
}

API

  • openAdvancedUrl(options: AdvancedWebViewOptions)
  • close() iOS Only :: Closed the safari view controller.

AdvancedWebViewOptions Properties

  • url: string
  • toolbarColor: string
  • toolbarControlsColor: string - iOS only
  • showTitle: boolean - Android only

Events

  • LoadStart
  • LoadFinished
  • LoadError
  • Closed
Demo App
  • fork the repo
  • cd into the src directory
  • execute npm run demo.android or npm run demo.ios
7.0.2

1 year ago

7.0.1

2 years ago

7.0.0

3 years ago

6.1.1

3 years ago

6.1.0

3 years ago

6.0.0

4 years ago

5.0.0

4 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.2.0

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago