[RESOLVED] Live preview error: "Can't find variable: Tabs"

After creating a simple app with only an auth flow and stack navigator, I added a tab navigator with the name “Tabs”. I added an “Item Detail View” screen from the gallery and added it to the Tabs navigator. I then attempted to view the “Item Detail View” screen with live preview and received the error, “Can’t find variable: Tabs”.

I renamed the Tabs navigator back to its default name of Navigator, wondering if this might help, and attempted to view the Item Detail View screen again. The error changed to, “Can’t find variable: Navigator”.

So, I deleted the tab navigator and the Item Detail View screen. I then added the Item Detail View screen back again from the gallery and the builder gave it the name, “Item Detail View Copy”, as if the old screen still existed, even though I had deleted it. It is also not possible to rename the screen to “Item Detail View”, apparently because it would conflict with the ghost screen.

A similar thing is currently happening with the Simple Welcome screen I added from the gallery. I had renamed it to Welcome and subsequently deleted it in an attempt to work around a bug. Now, if I add a new Simple Welcome screen to the app, the builder will not allow the name to be changed to Welcome, as I had done previously. In these renaming cases, there is no indication that it will not save the name changes. But, if you navigate away and then back, the value is reverted and your changes are lost.

Item Detail View Copy screen: https://build.draftbit.com/apps/N3FcGHuL/screens/6nYYeaCs
Simple Welcome screen: https://build.draftbit.com/apps/N3FcGHuL/screens/UYpt004K

Hey Gary, thanks for reporting. Definitely a bug here - let us dive in and get back to you shortly.

1 Like

It’s possible this was caused by the fact that, while I had added a screen to the tab navigator from the Navigation organizer, I had not yet added a second screen and configured the tab navigator itself to have two tabs routing to the two different screens (i.e. with route, label, icon values). Now that I’ve done that, and perhaps “redeployed” and reloaded, I’m no longer seeing the error during live preview. :rocket:

2 Likes

Hey Gary -

We’ve fixed both the bugs you’ve detailed here:

  • Screen naming taking deleted screens into account
  • Tab navigators erroneously being added to the App Navigation code, even when no screens had been assign to their tabs

Let us know if you come across any additional problems, and thanks for the bug reports!

1 Like