tamagui: Error "No theme and no parent?" in production using pages router

Current Behavior

Error “No theme and no parent?”. Issue only occurs in production. Experiencing this issue when attempting to ship my takeout-based app to production for launch.

An even simpler reproduction can be achieved by using:

  • “npm create tamagui@latest” (1.124.9)
  • the “Free - Expo + Next in a production ready monorepo” template
  • running in production (yarn web:prod && yarn web:prod:serve)
  • then hitting the pages-example button in the web ui

Expected Behavior

No client side error occurs and things are normal, like in pre v4 versions of the paid takeout starter.

Tamagui Version

1.124.9 (anything v4)

Platform (Web, iOS, Android)

web

Reproduction

- "npm create tamagui@latest" (1.124.9)
- the "Free - Expo + Next in a production ready monorepo" template
- running in production (yarn web:prod && yarn web:prod:serve)
- then hitting the pages-example button in the web ui

System Info


About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 6
  • Comments: 50 (22 by maintainers)

Commits related to this issue

Most upvoted comments

I am also getting this error when I try to use icons from this package @tamagui/lucide-icons on a particular screen. That particular screen throws this error.

I had the same issue. I’ve fixed this by updating all Tamagui libraries to the latest version. I guess it was a version mismatch. I installed the @tamagui/lucid-icons a few days after the main library.

For me it fixed the problem to make sure that the TamaguiProvider is the very first item in the component tree. Work in the React Native + Expo app as well as in the NextJS application.

Edit: Tamagui ^1.125.14

Our Vercel deployments still show the same error on v1.125.8. Curious if anyone else resolved this specific error.

Update all tamagui dependencies to v1.125.8

Ok yea I see, next is minimizing CSS differently so our scan is failing. This part is a bit brittle, I should probably leave it off by default. I’ll push a fix for now.

I know its sometimes hard but a reproduction would help. This is very likely some cached thing or not upgrading all tamagui deps somehow to the new version.

Same thing here, “expo”: “^52.0.35”, “tamagui”: “^1.125.6”, I also put the tamagui provider at the top and the error still remains: “No parent”

Hey, folks. I fixed that error in the latest PR and added an option: disableThemesBundleOptimize into withTamagui and update starter-free latest version.

https://github.com/tamagui/starter-free/blob/e948b66cc81b71ca727d9d771551598532feecd4/apps/next/next.config.js#L27C5-L27C32

@baronha you need to go here http://localhost:8151/user/nate then hit refresh several times (or hard refresh cmd + R)

Oh yah I saw. Now I realize it. Thank you for helping me to reproduce bug

@deepnavy I think I know this error. I will fix it tomorrow.

I confirmed it’s on iOS as well and probably Android as well.

It occurs when you edit files that force the Tamagui theme provider to re-render. It happens on an SDK 52 Expo project that is fully updated.

Image

Having the same issue on iOS using expo-router after upgrading to tamagui 1.124.15.