1.0.3 • Published 4 years ago

nativescript-popup-with-position v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

npm npm

Installation

tns plugin add nativescript-popup-with-position

Usage

    <Button tap="openPopup"/>
    import { Popup } from 'nativescript-popup-with-position';

    function openPopup(args){
    const popup = new Popup({
        backgroundColor:'white' | '#fff',
        height:100,
        width:100,
        unit:'dp' | 'px' | '%',
        elevation:10, // android only
        borderRadius:25 // android only
    });
    const view = new Label();
    view.text = "Test";

    /* IOS */
    const nativeView = UILabel.new();
    nativeView.text = "Native Button";
    nativeView.frame = CGRectMake(0,0,50,50);
    /* -- IOS */

    /* Android */
    const nativeView = new new android.widget.TextView(context);
    nativeView.setText("Native Button");
    nativeView.setWidth(50);
    nativeView.setHeight(50);
    /* -- Android */
    let xpos = 0;
    let ypos = 0;

    popup.showPopup(anchor: View | nativeView , view: View | nativeView, xpos , ypos);
    }

API

Constructor

Popup(options: PopupOptions)

Constructor Example

import { Popup, PopupOptions } from "nativescript-popup-with-position";

const opts: PopupOptions = {
  backgroundColor: "white" | "#fff",
  height: 100,
  width: 100,
  unit: "dp" | "px" | "%",
  elevation: 10, // android only
  borderRadius: 25 // android only
};

const popup = new Popup(opts);

Popup Methods

MethodDescription
showPopup(source: any, view: any): PromiseShows the popup anchored to the source argument with the view argument as the popup contents. The view argument can be a native Android/iOS view, a NativeScript View, or a string path to a template within the app directory.
hidePopup(data?: any): PromiseHides the popup and removes it from the view hierarchy.

License

Apache License Version 2.0, January 2004

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago