You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BottomNavigation breaks tab content on navigating to another page and back again #8251
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
CLI: 6.3.2
Cross-platform modules: 6.3.2
Android Runtime: 6.3.1
iOS Runtime: 6.3.0
Plugin(s):
nativescript-angular: 8.20.4
Describe the bug
Navigation to another page from a BottomNavigation and back again breaks the content of the current tab.
ListView can no longer be scrolled, items cannot be tapped etc.
To Reproduce
Create a BottomNavigation, with a ListView on one of the tabs.
Add a page-route to another page (full page, not tab content).
Navigate to the other page
Go back.
The ListView can no longer be scrolled and the items cannot be tapped.
Switch to another tab and back again.
The ListView now can be scrolled again. (If you tapped on an item, that action is triggered)
Expected behavior
To be able to interact with the content of the tab.
Sample project
I've created a demo project in my ns-debugging repository:
I am having the same Issue. It doesn't matter if it is a ListView, RadListView or a ScrollView inside the TabView. Whenever you open a new Page and press the back Button it does not render the TabView correctly.
I get this behaviour with NativeScript 6.3.1 and also with NativeScript 6.4.0.
When the view isn't rendered correct, I still can load any other Page by clicking on the ListView, and when I go back again, the TabView is rendered correctly again. Same when switching Tabs.
Just to chime in: Upgrading my tab-based app from NativeScript 6.1 to 6.3.1 or 6.4 results in the same issue - after visting a new page and going back to the tabs view images are not loaded, list views won't scroll etc. Changing the selected tab and going back again loads the view correctly (minimizing and restoring the app, also).
Someone found's a solution or workaround?
Or we need to wait for a framework fix?
I've been stuck for few days without find a good solution/workaround.
Now i got another bug:
when i suspend the app and resume i got this error, caused by the frame 'tmpl_frame'
java.lang.RuntimeException: Unable to resume activity {net.wubook.zak/com.tns.NativeScriptActivity}: java.lang.IllegalArgumentException: No view found for id 0x3 (unknown) for fragment fragment3[2]<t(22)@ui/home/home-page.xml:1:1;>
Did you find a better solution or did you solve in some way this bug?
We don't use frames for our fake tab-view.
We maintain our own history per tab in a special service and switch out the content with *ngIf, when the user switches tab.
I'm not sure I'd recommend our solution, it is a very old solution from when we couldn't get Tab buttons at the bottom of the screen.
@m-abs I think it is related to fragments being destroyed on navigation forward. I created a PR for (which I use in all my apps now) to handle it the way all android apps do it. (Fragment add/remove instead of replace). I don't have the link right now as I am on my phones. You can look in opened PRs
Activity
m-abs commentedon Jan 17, 2020
On navigating back to the
BottomNavigationthe first tab's frame is attached and immediately detached again, soframe._attachedToWindowisfalse.This is the View tree path:
BottomNavigation(7)>children[0] = Frame(19)>children[0] = Page(38)>children[0] = ProxyViewContainer(41)>children[0] = Frame(42)ridcully commentedon Feb 13, 2020
I am having the same Issue. It doesn't matter if it is a ListView, RadListView or a ScrollView inside the TabView. Whenever you open a new Page and press the back Button it does not render the TabView correctly.
I get this behaviour with NativeScript 6.3.1 and also with NativeScript 6.4.0.
When the view isn't rendered correct, I still can load any other Page by clicking on the ListView, and when I go back again, the TabView is rendered correctly again. Same when switching Tabs.
timdoege commentedon Feb 18, 2020
Just to chime in: Upgrading my tab-based app from NativeScript 6.1 to 6.3.1 or 6.4 results in the same issue - after visting a new page and going back to the tabs view images are not loaded, list views won't scroll etc. Changing the selected tab and going back again loads the view correctly (minimizing and restoring the app, also).
deivdev commentedon Mar 6, 2020
Someone found's a solution or workaround?
Or we need to wait for a framework fix?
I've been stuck for few days without find a good solution/workaround.
m-abs commentedon Mar 7, 2020
@deivdev
Unfortunately no. I spend a long time trying to work around this problem, in the end we choose not to use real-tabs in our application.
deivdev commentedon Mar 11, 2020
Thanks @m-abs , i develop a fake tab bottom bar, with a frame on top.
Now i got another bug:
when i suspend the app and resume i got this error, caused by the frame 'tmpl_frame'
java.lang.RuntimeException: Unable to resume activity {net.wubook.zak/com.tns.NativeScriptActivity}: java.lang.IllegalArgumentException: No view found for id 0x3 (unknown) for fragment fragment3[2]<t(22)@ui/home/home-page.xml:1:1;>Did you find a better solution or did you solve in some way this bug?
m-abs commentedon Mar 11, 2020
@deivdev
Our app is a nativescript-angular app.
We don't use frames for our fake tab-view.
We maintain our own history per tab in a special service and switch out the content with
*ngIf, when the user switches tab.I'm not sure I'd recommend our solution, it is a very old solution from when we couldn't get Tab buttons at the bottom of the screen.
timdoege commentedon Mar 16, 2020
Digging deeper, it seems like this might be related to this NS Angular-issue: NativeScript/nativescript-angular#2075 i
timdoege commentedon Mar 18, 2020
I just tested the 6.5.0 release and the issue is still there, unfortunately.
farfromrefug commentedon Oct 2, 2020
@m-abs I think it is related to fragments being destroyed on navigation forward. I created a PR for (which I use in all my apps now) to handle it the way all android apps do it. (Fragment add/remove instead of replace). I don't have the link right now as I am on my phones. You can look in opened PRs
fix(android): BottomNavigation fragment child already has a parent
fix(android): BottomNavigation fragment child already has a parent (#…
ci: fix npm_install for core on CI (docs) (#9155)