-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Override createElement
to map svg elements to react-native-svg
ones
#11129
Conversation
@@ -20,7 +16,7 @@ export const settings = { | |||
|
|||
description: __( 'Add text that respects your spacing and tabs -- perfect for displaying code.' ), | |||
|
|||
icon: <SVG viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><Path d="M0,0h24v24H0V0z" fill="none" /><Path d="M9.4,16.6L4.8,12l4.6-4.6L8,6l-6,6l6,6L9.4,16.6z M14.6,16.6l4.6-4.6l-4.6-4.6L16,6l6,6l-6,6L14.6,16.6z" /></SVG>, | |||
icon: <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M0,0h24v24H0V0z" fill="none" /><path d="M9.4,16.6L4.8,12l4.6-4.6L8,6l-6,6l6,6L9.4,16.6z M14.6,16.6l4.6-4.6l-4.6-4.6L16,6l6,6l-6,6L14.6,16.6z" /></svg>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about path
, g
and rest, but at least SVG
needs to stay as it adds some accessibility features behind the scenes. It's expected to have it everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't we just map svg
to our SVG
then (instead of the one from react-native-svg`)?
Did you make it work? Changes in both PRs look reasonable. I will try to test it on Friday. |
It works, but still needs some cleanup on the mobile PR (around how we import/build modules). |
Let me know when it is fully working, I will ping a few more developers to look closer into it. The solution we have at the moment helped us to move forward, but I'm still not 100% confident it's bulletproof in the long run. Having this Eslint rule: |
@Tug do you plan to continue working on this PR? It got very out of date :( |
It's not a priority at the moment no 👍 |
Description
This PR reverts to using string versions of
svg
elements and introduces a customcreateElement
function for react-native which will be able to map those to native svg elements.It will also be useful to have a custom
createElement
function in other case, such as having a failover for<div>
,<span>
...How has this been tested?
To be tested along with wordpress-mobile/gutenberg-mobile#184
WIP
Types of changes
Build changes
Checklist: