Uncaught (in promise): TypeError: Cannot read property 'getActiveChildNavs' of undefined
TypeError: Cannot read property 'getActiveChildNavs' of undefined
at findTopNavs (http://localhost:8100/build/vendor.js:23742:41)
at http://localhost:8100/build/vendor.js:23748:44
at Array.forEach (<anonymous>)
at findTopNavs (http://localhost:8100/build/vendor.js:23747:19)
at http://localhost:8100/build/vendor.js:23748:44
at Array.forEach (<anonymous>)
at findTopNavs (http://localhost:8100/build/vendor.js:23747:19)
at http://localhost:8100/build/vendor.js:23464:32
at Map.forEach (native)
at App.getActiveNavContainers (http://localhost:8100/build/vendor.js:23463:24)
Hm. It’s an echo of a bug in a previous version that got fixed. Maybe the devs unfixed it. I think you should check issues on Github. This sounds a lot like a previous known issue.
Already found the solution but I had to change the code inside components/super-tabs.ts
Look for getActiveChildNavs(): NavigationContainer[] { return [this._tabs[this.selectedTabIndex]]; }
I tried console.log for this.selectedTabIndex and it returned -1 when you switch between ionic tabs and super-tabs page, so I changed it to
getActiveChildNavs(): NavigationContainer[] { if (this.selectedTabIndex < 0) { this.selectedTabIndex = 0; } return [this._tabs[this.selectedTabIndex]]; }
And now it works
I am using “ionic2-super-tabs”: “^5.0.2”, and here is my super-tabs.js
SuperTabsComponent.prototype.getActiveChildNavs = function () {
if (this.selectedTabIndex < 0) {
this.selectedTabIndex = 0;
}
return [this._tabs[this.selectedTabIndex]];
};
But still i am getting
Error: Uncaught (in promise): TypeError: Cannot read property 'getActiveChildNavs' of undefined
TypeError: Cannot read property 'getActiveChildNavs' of undefined
at findTopNavs (http://localhost:8100/build/vendor.js:22399:25)
at http://localhost:8100/build/vendor.js:22405:27
at Array.forEach (<anonymous>)
at findTopNavs (http://localhost:8100/build/vendor.js:22404:19)
at http://localhost:8100/build/vendor.js:22405:27
at Array.forEach (<anonymous>)
at findTopNavs (http://localhost:8100/build/vendor.js:22404:19)
at http://localhost:8100/build/vendor.js:22405:27
at Array.forEach (<anonymous>)
at findTopNavs (http://localhost:8100/build/vendor.js:22404:19)
at c (http://localhost:8100/build/polyfills.js:3:19752)
at new t (http://localhost:8100/build/polyfills.js:3:21532)
at __awaiter (http://localhost:8100/build/vendor.js:57894:12)
at SuperTabsComponent.ngAfterViewInit (http://localhost:8100/build/vendor.js:58115:16)
at callProviderLifecycles (http://localhost:8100/build/vendor.js:13122:18)
at callElementProvidersLifecycles (http://localhost:8100/build/vendor.js:13089:13)
at callLifecycleHooksChildrenFirst (http://localhost:8100/build/vendor.js:13072:29)
at checkAndUpdateView (http://localhost:8100/build/vendor.js:14227:5)
at callViewAction (http://localhost:8100/build/vendor.js:14569:21)
at execComponentViewsAction (http://localhost:8100/build/vendor.js:14501:13)