We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
First, thanks for this library. I think it is really cool :)
When I try to set the background image to the style object as in the React documentation it doesn't work. Example code:
const divStyle = { color: 'blue', backgroundImage: 'url(' + imgUrl + ')', }; function HelloWorldComponent() { return <div style={divStyle}>Hello World!</div>; }
Checking the code I think the problem is here: https://github.com/alecsgone/jsx-render/blob/6e8053e67b460a2cdcb8585dc606d6b8da5fd3ce/src/dom.js#L24
The objectToStyleString function doesn't take into account the camelCase.
You can hack this just by setting the background image this way:
const divStyle = { color: 'blue', 'background-image': 'url(' + imgUrl + ')', }; function HelloWorldComponent() { return <div style={divStyle}>Hello World!</div>; }
But I don't think this is a good solution because it is not compatible with how react currently works.
I think a better solution would be to loop over the style object and set each prop directly to the element.style object.
I can create a PR for this if you like.
The text was updated successfully, but these errors were encountered:
Totally, PRs are welcome I'll dig into this later, thanks for raising the issue 🙏
Sorry, something went wrong.
No branches or pull requests
First, thanks for this library. I think it is really cool :)
When I try to set the background image to the style object as in the React documentation it doesn't work. Example code:
Checking the code I think the problem is here:
https://github.com/alecsgone/jsx-render/blob/6e8053e67b460a2cdcb8585dc606d6b8da5fd3ce/src/dom.js#L24
The objectToStyleString function doesn't take into account the camelCase.
You can hack this just by setting the background image this way:
But I don't think this is a good solution because it is not compatible with how react currently works.
I think a better solution would be to loop over the style object and set each prop directly to the element.style object.
I can create a PR for this if you like.
The text was updated successfully, but these errors were encountered: