HELP: Tabnavigator number of screens

Hi all

In my app I “abuse” a tabnavigator component so that users cannot “swipe” back to the previous screen. At the moment that I added a 6th screen to the tab navigator, the app crashes at the moment I navigate to that screen (empty screen with just a button. screen goes blank/white when I navigate to it)
When I placed the screen outside the tabnavigator, the screen does appear, only now users are able to swipe back to the previous screen (only from the screen that is outside the tab navigator)
So I guess there is a practical limit of 5 screens per navigator. I don’t know if this was intended or if it is a bug, so if Thunkable staff is reading: if this is intended, please state in the documentation that the navigator is limited to 5 screens. If it is a bug: consider this post as a bug report :wink:

I really don’t want the users of my app to be able to swipe back and forth between screens, because that would really break the logic of the “flow” in the app. So I started looking for a workaround. I found something that seems to be working, but I don’t (yet) know if and how this will impact the code quality of the final app (I guess things will get really messy “under the hood” but we will see). Anyway, the workaround that seems to work is to nest multiple tab navigators. So at the highest level, I have one navigator, and below that two other navigators that contain the actual screens:

This seems to work for now, so if anybody has the same/similar issues, I hope this helps!

Final thought: it would be nice if there would be an option for screens to disable animations and swiping, so that we don’t have to abuse tab navigators to get the intended behaviour. Maybe that could be included in one of the following ThunkableX releases? (=feature request :wink:)

Thanks and happy Thunking!
Rob

I now run into an issue with firebase. Don’t know if it is related, but it might be.
In my app, I use a realtimeDB. In all the screens in the first navigator, if I register a listener, the data changed event fires whenever the realtimeDB is updated.
However, on the screen in the second navigator, the data changed event never fires. I am able to access the data in the realtimeDB, but the data changed event just does not fire.
Also, when I use the navigate to functionality, I can navigate to some of the screens in the first navigator, but when I try to navigate to other screens, the app simply crashes (note that if I navigate to the same screens from the first navigator, everything works fine)

Any ideas why this might be happening?

Ok, just to keep you all updated: it seems that the issues I describe are indeed caused by the nesting of Tab Navigators.
I tried a new workaround: use a drawer navigator instead of a tab navigator, set the position to right-hand side and the drawer size to 0 pixels.
Now I also can have screens without the possibility to swipe back to a screen, and all of a sudden the listener started working too and I can navigate back and forth between all the screens.
The only drawback is that when a user accidentally makes a swipe gesture at the right-hand side of the screen, the screen is dimmed, but if you tap the screen again it turns back to normal, so for now I can live with that.

Still hope that there will be an option in the future to just have screens that are not swipable …

1 Like