tamagui
tamagui copied to clipboard
Error trying to use Tamagui Core in vanilla React Native project
Describe the bug
When calling setupReactNative
from @tamagui/core
, I get the error WeakMap key must be an Object
.
I'm trying to use Tamagui Core in a vanilla React Native app with React Native 0.70.6. Upon following the configuration steps for @tamagui/core
, I see the error below:
To Reproduce
In a vanilla RN app, follow the steps outlined in the Tamagui Core configuration section: https://tamagui.dev/docs/core/configuration
- Add the following libraries to your app:
"@tamagui/animations-reanimated": "1.1.5",
"@tamagui/config-base": "1.1.5",
"@tamagui/core": "1.1.5",
"@tamagui/theme-base": "1.1.5",
- Have a config file detailed in the configuration docs.
- Wire up a provider
- Open app, see error shown in above screenshot.
System Info (please complete the following information):
Output of npx envinfo --system --npmPackages --binaries --browsers
:
System:
OS: macOS 13.1
CPU: (10) arm64 Apple M1 Pro
Memory: 36.45 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node
Yarn: 3.2.3 - ~/.nvm/versions/node/v16.15.1/bin/yarn
npm: 8.11.0 - ~/.nvm/versions/node/v16.15.1/bin/npm
Watchman: 2023.01.16.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 109.0.5414.119
Safari: 16.2
npmPackages:
@tamagui/animations-reanimated: 1.1.5 => 1.1.5
@tamagui/config-base: 1.1.5 => 1.1.5
@tamagui/core: 1.1.5 => 1.1.5
@tamagui/theme-base: 1.1.5 => 1.1.5
react-native: 0.70.6 => 0.70.6
react-native-reanimated: 2.13.0 => 2.13.0
- [ ] yarn.lock or similar
- [ ] If it's a specific file, add
//! debug
to the top (the!
works in esbuild compiled packages but not necessary always) and include that (only for compiler, but helps to know if it's on or off). - [ ] Run your server/bundler with
DEBUG=tamagui
and include that output at the bottom.
Same here...
Can't make it work
Think this might be fixed in 1.1.7 via this PR: https://github.com/tamagui/tamagui/pull/595
Will validate and close this if so!
@Drew-Gerber did it worked?
@AguSandoval I get a different error now - this appears to be because I don't have certain native modules installed/linked when using a newly created React Native project via the RN CLI. Here's the error:
I've resorted to doing the below for now - and only adding views that I need to setupReactNative
's argument:
import {Text, View, Image} from 'react-native';
setupReactNative({View, Text, Image});
@AguSandoval I get a different error now - this appears to be because I don't have certain native modules installed/linked when using a newly created React Native project via the RN CLI. Here's the error:
I've resorted to doing the below for now - and only adding views that I need to
setupReactNative
's argument:import {Text, View, Image} from 'react-native'; setupReactNative({View, Text, Image});
Seeing this as well
i can't imagine how this would be cause by use, setupReactNative does almost nothing, i think it just looks like its coming from there. but either way the newest versions are a lot safer as they carefully isolate things even if you don't set TAMAGUI_TARGET, so i think this is fixed