Nativescript change tab at resume




can i change tab (of tabview) when app is resumed in applicationDidBecomeActive (IOS) ?


Listen for resume event and update the selectedIndex of the TabView.


Thanks a lot for the answer.
I have this code in main.ts of my application

applicationOn(resumeEvent, function (args: ApplicationEventData) {
    if ( {
        // For Android applications, is an android activity class.
        console.log("Activity: " +;
    } else if (args.ios) {
        // For iOS applications, args.ios is UIApplication.
        console.log("UIApplication: " + args.ios);

but how do I access the selectedIndex instance variable in my TabComponent?


That’s up to your code, where ever you have defined TabView keep it accessible in the resume event. Or you can event get the current page from frame then traverse down to get the TabView or setting an id also works.


Thanks for the reply,
I solved by entering the code written previously directly into the TabComponent.