tamagui: cannot render icon in react-native-web
Current Behavior
When including an icon from @tamagui/lucide-icons I get the following error:
Uncaught Error: Missing tamagui config, you either have a duplicate config, or haven't set it up. Be sure createTamagui is called before rendering. Also, make sure all of your tamagui dependencies are on the same version (`tamagui`, `@tamagui/package-name`, etc.) not just in your package.json, but in your lockfile.
Complete stack trace here:
config.mjs:11 Uncaught Error: Missing tamagui config, you either have a duplicate config, or haven't set it up. Be sure createTamagui is called before rendering. Also, make sure all of your tamagui dependencies are on the same version (`tamagui`, `@tamagui/package-name`, etc.) not just in your package.json, but in your lockfile.
at getConfig (config.mjs:11:1)
at usePropsAndStyle (useProps.mjs:34:75)
at themed.mjs:11:51
at renderWithHooks (react-dom.development.js:16305:1)
at updateFunctionComponent (react-dom.development.js:19588:1)
at updateSimpleMemoComponent (react-dom.development.js:19425:1)
at updateMemoComponent (react-dom.development.js:19284:1)
at beginWork (react-dom.development.js:21673:1)
at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1)
at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1)
getConfig @ config.mjs:11
usePropsAndStyle @ useProps.mjs:34
(anonymous) @ themed.mjs:11
renderWithHooks @ react-dom.development.js:16305
updateFunctionComponent @ react-dom.development.js:19588
updateSimpleMemoComponent @ react-dom.development.js:19425
updateMemoComponent @ react-dom.development.js:19284
beginWork @ react-dom.development.js:21673
callCallback @ react-dom.development.js:4164
invokeGuardedCallbackDev @ react-dom.development.js:4213
invokeGuardedCallback @ react-dom.development.js:4277
beginWork$1 @ react-dom.development.js:27451
performUnitOfWork @ react-dom.development.js:26560
workLoopSync @ react-dom.development.js:26466
renderRootSync @ react-dom.development.js:26434
recoverFromConcurrentError @ react-dom.development.js:25850
performConcurrentWorkOnRoot @ react-dom.development.js:25750
workLoop @ scheduler.development.js:266
flushWork @ scheduler.development.js:239
performWorkUntilDeadline @ scheduler.development.js:533
Show 20 more frames
Show lessUnderstand this error
react-dom.development.js:18687 The above error occurred in one of your React components:
at http://localhost:4201/vendor.js:100944:64
at button
at Provider (http://localhost:4201/vendor.js:23483:5)
at http://localhost:4201/vendor.js:22006:55
at http://localhost:4201/vendor.js:7553:36
at span
at http://localhost:4201/vendor.js:27477:55
at http://localhost:4201/vendor.js:25979:13
at div
at http://localhost:4201/vendor.js:22006:55
at span
at span
at http://localhost:4201/vendor.js:27477:55
at PortalProviderComponent (http://localhost:4201/vendor.js:12922:3)
at span
at span
at http://localhost:4201/vendor.js:27477:55
at ThemeProvider (http://localhost:4201/vendor.js:27673:11)
at Provider (http://localhost:4201/vendor.js:23483:5)
at TamaguiProvider (http://localhost:4201/vendor.js:27335:3)
at TamaguiProvider (http://localhost:4201/vendor.js:91149:28)
at App
Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.
logCapturedError @ react-dom.development.js:18687
update.callback @ react-dom.development.js:18720
callCallback @ react-dom.development.js:13923
commitUpdateQueue @ react-dom.development.js:13944
commitLayoutEffectOnFiber @ react-dom.development.js:23391
commitLayoutMountEffects_complete @ react-dom.development.js:24688
commitLayoutEffects_begin @ react-dom.development.js:24674
commitLayoutEffects @ react-dom.development.js:24612
commitRootImpl @ react-dom.development.js:26823
commitRoot @ react-dom.development.js:26682
finishConcurrentRender @ react-dom.development.js:25892
performConcurrentWorkOnRoot @ react-dom.development.js:25809
workLoop @ scheduler.development.js:266
flushWork @ scheduler.development.js:239
performWorkUntilDeadline @ scheduler.development.js:533
Show 15 more frames
Show lessUnderstand this error
config.mjs:11 Uncaught Error: Missing tamagui config, you either have a duplicate config, or haven't set it up. Be sure createTamagui is called before rendering. Also, make sure all of your tamagui dependencies are on the same version (`tamagui`, `@tamagui/package-name`, etc.) not just in your package.json, but in your lockfile.
at getConfig (config.mjs:11:1)
at usePropsAndStyle (useProps.mjs:34:75)
at themed.mjs:11:51
at renderWithHooks (react-dom.development.js:16305:1)
at updateFunctionComponent (react-dom.development.js:19588:1)
at updateSimpleMemoComponent (react-dom.development.js:19425:1)
at updateMemoComponent (react-dom.development.js:19284:1)
at beginWork (react-dom.development.js:21673:1)
at beginWork$1 (react-dom.development.js:27426:1)
at performUnitOfWork (react-dom.development.js:26560:1)
getConfig @ config.mjs:11
usePropsAndStyle @ useProps.mjs:34
(anonymous) @ themed.mjs:11
renderWithHooks @ react-dom.development.js:16305
updateFunctionComponent @ react-dom.development.js:19588
updateSimpleMemoComponent @ react-dom.development.js:19425
updateMemoComponent @ react-dom.development.js:19284
beginWork @ react-dom.development.js:21673
beginWork$1 @ react-dom.development.js:27426
performUnitOfWork @ react-dom.development.js:26560
workLoopSync @ react-dom.development.js:26466
renderRootSync @ react-dom.development.js:26434
recoverFromConcurrentError @ react-dom.development.js:25850
performConcurrentWorkOnRoot @ react-dom.development.js:25750
workLoop @ scheduler.development.js:266
flushWork @ scheduler.development.js:239
performWorkUntilDeadline @ scheduler.development.js:533
Show 17 more frames
Show lessUnderstand this error
Expected Behavior
@tamagui/lucide-icons should display icons. There’s an issue with getting the config correctly. It appears to only be an issue on react-native-web and icons.
Tamagui Version
1.102.1
Platform (Web, iOS, Android)
web
Reproduction
https://github.com/hcwiley/tamaguiNxSandbox
System Info
System:
OS: macOS 14.5
CPU: (14) arm64 Apple M3 Max
Memory: 111.63 MB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.14.0 - /usr/local/bin/node
Yarn: 1.22.22 - /opt/node/node-v20.14.0-darwin-arm64/bin/yarn
npm: 10.8.1 - /usr/local/bin/npm
Watchman: 2024.05.06.00 - /usr/local/bin/watchman
Browsers:
Chrome: 126.0.6478.127
Safari: 17.5
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 15 (4 by maintainers)
encountering the same issue here, adjusting the import to be
does not do the trick 🤔
Might not be related to your cases, but had the same error in React Native, and the problem were mis-matching versions of the
tamaguipackages.Installed
lucide-iconsvia the docs and got a newer version, than the ones installed (1.110.2vs.1.110.1).After version-matching all of the packages, got the icons rendered on both React Native as well as the web.
For anyone that visits this post in the future, this is what worked for me
delete yarn file/package lock and re-run yarn add react-native-svg @tamagui/lucide-icons and npm install
I had this issue. After replacing
@tamagui/lucide-iconswithlucide-react-nativeit seems to work.