-
-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TabView crashes upon tab navigation #857
Comments
Hi @nilsmehlhorn, For those case, we created platform specific property called
Could you verify, whether this setup will resolve this behavior? |
From @nilsmehlhorn on June 15, 2017 11:13 Hey @tsonevn, My application should allow for handling different lists in parallel tabs. These lists (and therefore the corresponding tabs) are meant to be dynamically added and removed. Furthermore the tabs are initially retrieved from a server. Why wouldn't a dynamic tab-view work? Am I supposed to adjust the How did this work with NS 2.5, I guess because back then the view recycling wasn't working how it does now, right? EDIT EDIT 2 |
Hi @nilsmehlhorn, HTML
TypeScript
|
From @nilsmehlhorn on June 20, 2017 12:17 Hey @tsonevn, were you really able to verify a flawless execution with the code you are providing? The issue is still persisting for me and overall I really don't like the fix. For me, the tab-view implementation seems to need a fix. Circumventing the view recycling by arguably introducing overhead in any component that hosts a (dynamic) tab-view can't be the solution. I made a video of the behavior I am seeing with your code. The corresponding value for The issues to be seen in the video in detail:
|
Hi @nilsmehlhorn, |
From @nilsmehlhorn on June 14, 2017 11:52
Hey, I've got the exact same issue as described in #4317 after updating my project to NS 3.0, however adding a simple ngIf did not do the trick for me. As I have not changed any of my code since the update I'm fairly certain that it is a bug in the TabView. I'll fill out the form just like @AlvSovereign did, you'll see its almost the same:
Which platform(s) does your issue occur on?
Android
Please provide the following version numbers that your issue occurs with:
CLI: 3.0.3
Cross-platform modules: 3.01
Runtime(s): Node: 7.8.0, npm: 4.2.0
Plugin(s):
Please tell us how to recreate the issue in as much detail as possible.
It is the same for me. The first two tabs are showing no data initially though they should (only if add something, as my tabs are presenting dynamic lists in them). When I get to the third tab, I see its contents being displayed correctly for a second, then the application crashes with the following error message:
Is there code involved? If so, please share the minimal amount of code needed to recreate the
This is how my tab-view code looks:
So some equality check inside the PageAdapterImpl.destroyItem fails, but I could not yet figure out why. If this cant be resolved I guess I have to roll back to NS 2.5
EDIT
I've tested the issue further: The TabView seems to hold instantiated versions of the current tab and the ones next to the current one (if there is one on each side). Now, when the third tab is selected the instance for the first tab is disposed, hence the call to the destroyItem method. I think this behaviour is related to the NS 3.0 updates regarding view recycling (or rather the new view life cycle).
Yet, unfortunately the instance passed to destroyItem does not equal the item the tab-view class is keeping track of. Furthermore, as already mentioned, the first two tab-items are not getting rendered at all.
The source for the destroyItem method has the following note attached:
Would it be possible that this call order isn't met?
https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/ui/tab-view/tab-view.android.ts#L78
EDIT 2
So, I've tested the issue without fetching the models for my tabs from the backend. Binding three tabs directly is working without problems - all tabs are rendered correctly and I am able to switch between them. I even found a fix for making it work with the remote tab models: Instead of the suggested
*ngIf="registers"
I used*ngIf="registers.length > 0"
. It solves the issue for the initial display, yet when I add a tab while the tab-view is displayed, the same behaviour occurs again.Copied from original issue: NativeScript/NativeScript#4380
The text was updated successfully, but these errors were encountered: