How to use the tns-core-modules/ui/frame.topmost function in tns-core-modules

To help you get started, we’ve selected a few tns-core-modules examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github triniwiz / nativescript-toasty / src / toasty.ios.ts View on Github external
private _getView(): any {
    if (!frameModule.topmost()) {
      const root = this.topViewController;
      if (!root) {
        throw new Error('There is no topmost');
      }
      return root.view.window;
    } else {
      // if the user provided an iOSOpts.anchorView then we're going to use it as the anchor when making the toast
      if (this._iOSOpts && this._anchorView) {
        return this._anchorView;
      } else {
        // if no anchorView requested we'll use the viewController view (might look into using the .window of the main VC later)
        let viewController = frameModule.topmost()
          .viewController as UIViewController;
        if (viewController.presentedViewController) {
          // on iPad, we don't want to show the toast in the modal, but on iPhone we do
          if (device.deviceType !== DeviceType.Tablet) {
github NativeScript / NativeScript / e2e / ui-tests-app / app / test-page-main-view-model.ts View on Github external
protected navigateToExample(exampleFullPath: string) {
        try {
            frame.topmost().navigate(exampleFullPath);
        } catch (error) {
            console.log("EXAMPLE LOAD FAILED:" + error);
            alert("Error loading example: " + exampleFullPath + " \nerror: " + error && error.message);

        }
    }
github NativeScript / NativeScript / apps / app / ui-tests-app / transitions / page0.ts View on Github external
export function onTap(args) {
    var navigationEntry = {
        moduleName: "ui-tests-app/transitions/page1",
        animated: true,
        transition: {
            name: args.object.tag,
            duration: 380,
            curve: "easeIn"
        }
    };
    frame.topmost().navigate(navigationEntry);
}
github NativeScript / NativeScript / e2e / file-qualifiers / app / main / main-page.land.ts View on Github external
export function navigate(args) {
    console.log("---> [LANDSCAPE] navigate");

    topmost().navigate("other/other-page");
}
github rdlauer / plum / app / maps / maps-view-model.ts View on Github external
doFindMe() {
    const page = topmost().currentPage;
    let mymap = page.getViewById('mymap');

    getCurrentLocation({
      desiredAccuracy: 3,
      updateDistance: 10,
      maximumAge: 20000,
      timeout: 20000
    }).then(
      function(loc) {
        if (loc) {
          //console.log('Current location is: ' + loc);
          mymap.setCenter({
            lat: loc.latitude,
            lng: loc.longitude,
            animated: true
          });
github tjvantoll / nativescript-social-share / src / social-share.ios.ts View on Github external
function share(thingsToShare) {
  const activityController = UIActivityViewController.alloc()
      .initWithActivityItemsApplicationActivities(thingsToShare, null);

  const presentViewController = activityController.popoverPresentationController;
  if (presentViewController) {
    const page = topmost().currentPage;
    if (page && page.ios.navigationItem.rightBarButtonItems &&
      page.ios.navigationItem.rightBarButtonItems.count > 0) {
      presentViewController.barButtonItem = page.ios.navigationItem.rightBarButtonItems[0];
    } else {
      presentViewController.sourceView = page.ios.view;
    }
  }

  topmost().ios.controller
    .presentViewControllerAnimatedCompletion(activityController, true, null);
}
github TeamHive / nativescript-pspdfkit / demo / app / main-view-model.ts View on Github external
webContentViewer() {
    frame.topmost().navigate('webcontent');
  }
  secondViewer() {
github manijak / nativescript-carousel / demo / app / main-page.ts View on Github external
export function carousel1() {
  topmost().navigate({
    moduleName: 'carousel1'
  });
}
github triniwiz / nativescript-webrtc / demo / app / main-view-model.ts View on Github external
this.socketIO.on('call:incoming', data => {
      frame.topmost().navigate({
        moduleName: 'call-page',
        context: {
          to: data.to,
          from: data.from,
          sdp: data.sdp,
          type: data.type
        }
      });
    });
github JoshDSommer / nativescript-swiss-army-knife / demo / app / main-view-model.ts View on Github external
public removeScrollVerticalBars(args) {
		const scrollV = topmost().getViewById("scrollV") as ScrollView;
		SwissArmyKnife.removeVerticalScrollBars(scrollV);
	}