Node v6
Starting with v0.19 Astro must be used with Node v6+!
Menu

Prompt View Plugin

The prompt view plugin allows you to show a popup that asks the user for text input. The popup will block input to the rest of the screen and there is a Cancel and customizable Submit button, both of which close the popup. The Submit button can only be pressed if some text has been entered, otherwise the button is disabled.

const promptView = await PromptViewPlugin.init()
promptView.setPrompt('Please enter some text')
promptView.setPlaceholder('This is the placeholder text')
promptView.setSubmitButtonLabel('Submit!')
const result = await promptView.show()

if (!result.cancelled) {
    console.log(result.text)
}

result.text will be undefined if the user cancel's the prompt, so it is important to check result.cancelled before performing any actions with the entered text.

Screenshots

IOS Android

Methods

PromptViewPlugin.init() #

Creates and returns a promise which resolves to an instance of the prompt view plugin which is used to make subsequent method calls. A single instance can be used multiple times without the need to re-configure it.


setTitle(title) #

Sets title of prompt.


setPlaceholder(placeholder) #

Sets the placeholder text of the prompt text area. The placeholder will disappear as soon as the user starts editing.


setSubmitButtonLabel(label) #

Set the text label of the Submit button of the prompt.


setCancelButtonLabel(label) #

Set the text label of the Cancel button of the prompt.


show() #

Presents the prompt view on top the current view. All input to the rest of the screen is blocked until either Cancel or Submit is pressed.

This returns a promise which resolves to an object with two properties: