SVGR describes how to create Custom Templates https://react-svgr.com/docs/custom-templates/, but when trying to do that, I quickly realized that the params passed to the functions were different from what is described in the docs, when using this plugin. Trying to use babel-plugin-transform-svg-component gave no success, as other issues happened (presumably due to web/native incompatibilities). Also, the main character, the tpl function is missing.
Hoping this can be useful to someone, this is a working implementation, with JSDoc typing (very basic) and with tpl reimplmented from babel-plugin-transform-svg-component.
I don't know if there is a better/simpler way, but I think this can be useful to anyone willing to use custom templates with metro and React Native 😊 I think it would be great if there could be any docs for this in the Readme 😃
Ok, so, apparently this has nothing to do with it being native, it's rather because I was using an older version of the library. See here for more info: https://react-svgr.com/docs/migrate/#template 😊
SVGR describes how to create Custom Templates https://react-svgr.com/docs/custom-templates/, but when trying to do that, I quickly realized that the params passed to the functions were different from what is described in the docs, when using this plugin. Trying to use
babel-plugin-transform-svg-component
gave no success, as other issues happened (presumably due to web/native incompatibilities). Also, the main character, thetpl
function is missing.Hoping this can be useful to someone, this is a working implementation, with JSDoc typing (very basic) and with
tpl
reimplmented frombabel-plugin-transform-svg-component
.I don't know if there is a better/simpler way, but I think this can be useful to anyone willing to use custom templates with metro and React Native 😊 I think it would be great if there could be any docs for this in the Readme 😃