# nativescript-popup-with-position

> nativescript popup window with x and y position.

Latest version **1.0.3** (published 2020-02-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install nativescript-popup-with-position
pnpm add nativescript-popup-with-position
yarn add nativescript-popup-with-position
bun add nativescript-popup-with-position
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2020-02-29 |
| First published | 2020-02-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 34.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sonuprasad Gaud |
| Maintainers | gaudsonu98 |
| Keywords | NativeScript, JavaScript, Android, iOS, popup |

## Links

- npm: https://www.npmjs.com/package/nativescript-popup-with-position
- npm.io page: https://npm.io/package/nativescript-popup-with-position

## Alternatives

- [react-native-root-siblings](https://npm.io/package/react-native-root-siblings.md) — 102.9K weekly downloads
- [post-robot](https://npm.io/package/post-robot.md) — 93.7K weekly downloads
- [@praxisui/dialog](https://npm.io/package/@praxisui/dialog.md) — 2.0K weekly downloads
- [easy-toggle-state](https://npm.io/package/easy-toggle-state.md) — 350 weekly downloads
- [ngx-lightbox-evp](https://npm.io/package/ngx-lightbox-evp.md) — 19 weekly downloads

## Recent versions

- 1.0.3 (latest) — 2020-02-29
- 1.0.2 — 2020-02-27
- 1.0.1 — 2020-02-27
- 1.0.0 — 2020-02-27

## README

[![npm](https://img.shields.io/npm/v/nativescript-popup-with-position.svg)](https://www.npmjs.com/package/nativescript-popup-with-position)
[![npm](https://img.shields.io/npm/dt/nativescript-popup-with-position.svg?label=npm%20downloads)](https://www.npmjs.com/package/nativescript-popup-with-position)


# Installation

`tns plugin add nativescript-popup-with-position`


## Usage

```xml
    <Button tap="openPopup"/>
```

```ts
    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

```js
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

| Method                                         | Description                                                                                                                                                                                                                             |
| ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| _showPopup(source: any, view: any)_: `Promise` | Shows 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)_: `Promise`             | Hides the popup and removes it from the view hierarchy.                                                                                                                                                                                 |

## License

Apache License Version 2.0, January 2004

---
_Source: https://npm.io/package/nativescript-popup-with-position · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
