New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ BUG ] Error: Element type is invalid: expected a string #142
Comments
Edit: This issue is caused because a component is trying to import an Icon that you are not yet exporting from the To fix this issue:,
Hey @MikeSchlosser16 Thanks for bringing this up. To fix this, you have to import, interop, then export the import { Info, LucideIcon, MoonStar, Sun, X } from 'lucide-react-native';
import { cssInterop } from 'nativewind';
function interopIcon(icon: LucideIcon) {
cssInterop(icon, {
className: {
target: 'style',
nativeStyleToProp: {
color: true,
opacity: true,
},
},
});
}
interopIcon(Info);
interopIcon(MoonStar);
interopIcon(Sun);
interopIcon(X);
export { Info, MoonStar, Sun, X }; For Futre Implementation
|
Thanks @mrzachnugent - I can confirm this resolved it for me using
Appreciate your prompt response! I'll be on the look out going forward but think your future state solution makes sense. |
I was getting that error every time I tried to use Select, DropDownMenu, Dialog. And @mrzachnugent response fixes it.
import { Info, LucideIcon, MoonStar, Plus, Sun, X, ...IconNames } from "lucide-react-native"; function interopIcon(icon: LucideIcon) { interopIcon(Info); export { Info, MoonStar, Plus, Sun, X, ...IconNames }; Thank you for the fix @mrzachnugent |
Describe the bug
When using Dialog, even in the base project, I get the following error (I do have the
PortalHost
component). It appears to be an issue withDialogContent
in particular. It's very possible I'm doing something wrong :)It's worth noting that
AlertDialog
does work as expected. I've tried also just using the template start project, and the issue remains.To Reproduce
Steps to reproduce the behavior:
git clone https://github.com/mrzachnugent/react-native-reusables.git
cp -R react-native-reusables/apps/starter-base/ ./my-project
cd my-project && npm i
npm run ios
npx @react-native-reusables/cli@latest add alert-dialog
Expected behavior
The modal opens properly, without crashing, similar to the demo.
Screenshots
Platform (please complete the following information):
Additional context
It seems odd that
AlertDialog
works fine. I do have thePortalHost
component in the top level_layout.tsx
file, from the base template:The text was updated successfully, but these errors were encountered: