Skip to content

Instantly share code, notes, and snippets.

@naranjja
Created April 24, 2018 22:08
Show Gist options
  • Save naranjja/e9cf5574dc125955236af7144742c529 to your computer and use it in GitHub Desktop.
Save naranjja/e9cf5574dc125955236af7144742c529 to your computer and use it in GitHub Desktop.
Popup implementation in NativeScript
<Page xmlns="http://www.nativescript.org/tns.xsd" loaded="onLoaded" navigatedTo="onNavigatedTo" actionBarHidden="true">
<Button id="bOpenPopup" text="Open popup" tap="onOpenPopupTap" />
</Page>
// tns plugin add nativescript-popup
const { Popup } = require("nativescript-popup")
exports.onOpenPopupTap = (args) => {
const page = args.object
const popup = new Popup({
backgroundColor: 'white',
height: 50,
width: 100,
unit: "%",
elevation: 10,
borderRadius: 25
})
popup.showPopup(page.getViewById('bOpenPopup'), '~/path/to/some/template.xml')
}
<StackLayout>
<Label text="This is some template" textWrap="true" />
</StackLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment