-
Notifications
You must be signed in to change notification settings - Fork 130
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
Raw text cannot be used outside of a <Text> tag when using style property #269
Comments
Did you try the latest one, 3.9.1? It fixes this one #266 |
Hi @Intellicode, Thanks for the suggestion. I've just upgraded to 3.9.1, but unfortunately the problem remains. |
Similar issue: export const Comp = () => {
return (
<Text>
<Text>The quick brown fox jumped over the lazy dog</Text>{" "}
{/* Whitespace(s) cannot be used outside of a <Text> tag ^ */}
<Text>The quick brown fox jumped over the lazy dog</Text>
</Text>
);
}; |
I could reproduce this test, let me see what I can do. If anyone has time, a PR would be appreciated else it would have to wait until I have time to look into the issue in detail. |
problem still exists in 3.10.0 |
Getting the same Problem when declaring a custom Component: const H1 = ({ children, style }: Props) => {
return (
<Text
style={tw.style("text-4xl font-bold opacity-85 underline mb-4", style)}
>
{children}
</Text>
);
}; And then having something like this in my code: <H1>Settings</H1> I think this should not be an error, but I can understand why it is. Will there be a fix for that or is it intentional to throw an error there? |
@Crafter-Y did you find any solution for this error? |
Hi there,
I am probably doing something wrong, if not a lot of things, but I can't figure out what. I have Googled, and I have read through the issues here, but to no avail.
In brief, after a recent upgrade on a project to
"eslint-plugin-react-native": "^3.8.1"
, I'm getting all kinda warnings.These seem to be only on elements where I have implemented in-line styles, but there's so many, I'm not 100% sure.
If I delete the style prop, the warning goes away, but then so does the styling.
Here are a couple examples:
I'm not using StyleSheets, and
theme.xxx
is referencing an imported style sheet that looks like this:The only way to make this warning to away--aside from disabling the rule--is to use variables in lieu of text, like this:
But that seems like a lot of work, that I'm loath to consider.
Any clues and/or advice would be most appreciated.
The text was updated successfully, but these errors were encountered: