Topic: Getting 'Text strings must be rendered within a <Text> component' (React Native)
esec priority asked 3 years ago
Hi! I've just started learning React Native and have some experience with MDB, so I wanted to test out how MDB works with React Native (Expo for me). I know that MDB is not intended to work like this, I just want to know if there is something I can do about this or just have to give up.
So I have copied code from here (the very first one) - imported everything necessary (oh and MDBNavbarToggler
was missing from imports in that preview code in docs). After fixing everything I could detect, I run it and got like 7 errors, all of them were the same (as I'm looking at it, it looks like even though there are a lot of the same errors, all of them are only pointing to <a>
tag - according to callstack):
Error: Text strings must be rendered within a <Text> component.
Expected behavior It'll just show what is in preview in the docs, without any errors and the same - although since I'm doing this via React Native, I have low hopes...
Actual behavior I got a bunch of errors, while all of them are
Error: Text strings must be rendered within a <Text> component.
And in between them, there is just one
Invariant Violation: View config getter callback for component `i` must be a function (received `undefined`). Make sure to start component names with a capital letter.
(just letting know, I don't want to discuss this error here)
Resources (screenshots, code snippets, etc.)
Malfunctioning file WelcomeScreen.js
paste: PasteBin
Thank you :)
Krzysztof Wilk staff answered 3 years ago
Hi!
React Native has a little bit different logic and it won't work with our MDB5. I.e. - you can try to take <div>sample</div>
from React, paste it in React Native and you should get the same error. That's how our components are developed, so you won't find there tags like <Text>
, which will cause errors like above :(
Keep coding!
esec priority commented 3 years ago
That's a shame... But as I'm searching through licenses, I can see that I have PRO access to Mobile Kit which apparently supports React Native, so at least I can use that :)
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- ForumUser: Priority
- Premium support: Yes
- Technology: MDB React
- MDB Version: 5.0.1
- Device: Computer
- Browser: N/A
- OS: Windows 10 Home
- Provided sample code: Yes
- Provided link: Yes