Nativescript (typescript) How do I access/get the instance/reference of a component from a different component?

Issue I am trying to access the component(Class instance) of NavigationButton and SearchBar in ActionBar from the component(Class instance) of a tabItem in a TabView. How do I do this? <ActionBar color=”black” title=””> <NavigationButton #navBtn text=”Go Back” android.systemIcon=”ic_menu_back” (tap)=”goBack()” [visibility]=”navBtnVisibility”></NavigationButton>

Continue reading

Nativescript – Angular 4, how to take the selected item's data in itemTap() in listview

Issue Find the below Listview code, where I have written the onItemTap($event) method in (itemTap). .html <ListView [items]=”customer” (itemTap)=”onItemTap($event)” class=”list-group”> <ng-template let-item=”item”> <StackLayout class=”list-group-item”> <Label [text]=”item.name”></Label> <Label [text]=”item.email”></Label> <Label [text]=”item.phoneNumber”></Label> </StackLayout> </ng-template> </ListView> .ts onItemTap(args) { console.log(args.data); console.log(args.view); console.log(args.index); console.log(args.object);

Continue reading

How to access the item context inside RadListView tkListItemSwipeTemplate

Issue Using NativeScript 3 + Angular 5. I need to allow the user to swipe an item within a RadListView to reveal a short description about the item. <RadListView [items]=”featuredVideos” pullToRefresh=”true” selectionBehavior=”None” (itemSwipeProgressStarted)=”onSwipeCellStarted($event)” swipeActions=”true” (pullToRefreshInitiated)=”onPullToRefreshInitiated($event)”> <ng-template tkListItemTemplate let-item=”item”> <VideoComponent =”item”></VideoComponent>

Continue reading

Nativescript Plugin for Caching

Issue Is there an actively maintained nativescript plugin for data caching? like nativescript-cache but sadly this plugin is now inactive. Solution you can use nativescript core module application-settings. it does exactly same as nativescript-cache plugin. import { getBoolean, setBoolean, getNumber,

Continue reading

Set width of Switch

Issue I am using Nativescript with Angular and I would like to set the width of a Switch element. To do this I added: style=”width: 20%; min-width: 20%;” To the element in the template. But the width of the element

Continue reading

nativescript-admob plugin error

Issue I added the nativescript-admob plugin to my NativeScript Angular project and have the below code in a service that I inject into a component: import { Injectable } from “@angular/core”; import * as Admob from “nativescript-admob”; @Injectable() export class

Continue reading

How to resize an image on ActionBar for iOS

Issue I have the following code for the ActionBar <ActionBar title=”” class=”action-bar”> <NavigationButton (tap)=”toggleDrawer()” class=”action-bar-item” ios:visibility=”collapsed” icon=”res://menu”> </NavigationButton> <ActionItem icon=”res://menu” android:visibility=”collapsed” (tap)=”toggleDrawer()” ios.position=”left”> </ActionItem> <StackLayout class=”action-item” android:horizontalAlignment=”center” ios:horizontalAlignment=”center”> <Image src=”res://ideas_wt_full” width=”60%” height=”60%” [visibility]=”android ? ‘visible’ : ‘collapsed'”></Image> <Image src=”res://ideas_wt_full” width=”30%”

Continue reading

angular ng-template with nativescript is really weird buggy

Issue Sorry for that not so concrete title but starting with angular + NS I experience so much weird exceptional behavior that really wonders me. That works ok: <StackLayout> <ListView [items]=”items” class=”list-group”> <ng-template let-item=”item”> <Label [nsRouterLink]=”[‘/item’, item.id]” [text]=”item.name” class=”list-group-item”></Label> </ng-template>

Continue reading

Lazy module can not be found although path seems correct

Issue link: https://play.nativescript.org/?template=play-ng&id=Annyna&v=4 error: ERROR Error: Uncaught (in promise): Error: com.tns.NativeScriptException: Failed to find module: “./TrainingUnit”, relative to: app/trainingunit/list/ Its odd that the module name in the error message is: “./TrainingUnit” The module file name is: trainingunit.module The module class

Continue reading

presentViewController does not exist

Issue I am building a plugin in NativeScript. When I try to access “presentViewController” method on rootViewController, I get the error “property presentViewContrller does not exist”. const rvc = UIApplication.sharedApplication.keyWindow.rootViewContrller; rvc.presentViewContrller(myViewController, true, completion() {}); It suggests to use presentViewContrllerAnimatedCompletion which

Continue reading

How to upgrade to NativeScript 5?

Issue I have a mobile app on NativeScript 4.2 with Angular. How do I upgrade to NativeScript 5.0? I also would like to start using the preview app from the NativeScript CLI. Solution Follow the upgrade instructions at https://docs.nativescript.org/releases/upgrade-instructions. The

Continue reading

Nativescript transparent row gridlayout

Issue I have a grid layout with a fixed header and navbar and a scrollview for the page <GridLayout rows=”50, *, 50″> <StackLayout row=”0″> // header </StackLayout> <ScrollView row=”1″> <StackLayout> // page </StackLayout> </ScrollView> <StackLayout row=”2″> // nav </StackLayout> I’m

Continue reading

NativeScript RadListView component template

Issue I am trying to use an Angular component as the template for RadListView. <StackLayout> <RadListView [items]=”stories” marginRight=”-2″ separatorColor=”transparent” height=”100%”> <ng-template tkListItemTemplate let-story=”item”> <NewsItem [story]=”story”></NewsItem> </ng-template> </RadListView> </StackLayout> I get the following error. file:///app/tns_modules/tns-core-modules/ui/core/view/view.js:57:124: JS ERROR Error: onMeasure() did not

Continue reading

How can I get the tap sound when a user touch a gridlayout?

Issue How can I get the tap sound when a user touch a gridlayout? <GridLayout row=”3″ colSpan=”2″ columns=”15*,75*,10*” height=”12%” rows=”*,*” class=”card-large box” (tap)=”onTap()”> <Label text=”&#xf17b;” class=”fa centered icon-category” col=”0″ rowspan=”2″></Label> <Label text=”MyText” class=”category-name” verticalAlignment=”bottom” col=”1″ row=”0″></Label> <Label text=”numbers” verticalAlignment=”top” col=”1″

Continue reading

ListviewLinearLayout itemWidth not supporting in android platform of nativescript

Issue Documentation: https://docs.telerik.com/devtools/nativescript-ui/Controls/NativeScript/ListView/item-layouts#using-listviewlinearlayout To perform horizontal scroll in recyclerview i have used ListViewLinearLayout as per the documentation. Documentation itself they mentioned clearly: The itemHeight and itemWidth properties are iOS specific. If not used, items are sized dynamically depending on the

Continue reading

Blob type not supported

Issue I am using Nativescript 5 and Angulat 4, and I am trying to download an image using a get request using @angular/http getImageFile(path){ let headers = new Headers(); headers.set(“Content-Type”, “image/jpeg”); return this.http.get((encodeURI(this.serverUrl + path)),{method: RequestMethod.Get, responseType: ResponseContentType.Blob, headers: headers

Continue reading

Page-router-outlet to get the higher component

Issue I am working on nativescript angular project that using RadSideDrawer And here my main-routing.module.ts import { NgModule } from “@angular/core”; import { Routes } from “@angular/router”; import { NativeScriptRouterModule } from “nativescript-angular/router”; import { MainComponent } from “~/app/components/main/main.component”; const

Continue reading

Can't see values in console.log() in nativescript

Issue I have an js file which includes an array! The js file is like this one export const appointments = [ { “taskID”: 9018929, “resource_ID”: 1, “title”: “KNDL Thatcham”, “description”: “<Non-Selected>\r\n10:00 – 18:00”, “startTime”: “2018-12-28T00:00:00”, “endTime”: “2018-12-28T23:59:00”, “statusColour”: “#DFDFDF”,

Continue reading