Skip to content

Commit 80a66b9

Browse files
author
xiazhigang
committed
修复 彻底修复 viewbox 问题
1 parent 7ba64b1 commit 80a66b9

File tree

5 files changed

+21
-16
lines changed

5 files changed

+21
-16
lines changed

.svgorc.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@yocdev/tarocodegen",
3-
"version": "1.1.5",
3+
"version": "1.1.6",
44
"author": "[email protected]",
55
"license": "MIT",
66
"bin": {
@@ -24,8 +24,7 @@
2424
"tarocodegen": "tarocodegen"
2525
},
2626
"files": [
27-
"dist",
28-
".svgorc.js"
27+
"dist"
2928
],
3029
"dependencies": {
3130
"@svgr/core": "^5.5.0",

src/icons/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ const svgrGenerator = async (fileDir: string, componentName: string) => {
138138
svgCode,
139139
{
140140
native: platform === "rn",
141-
dimensions: true,
141+
dimensions: false,
142142
replaceAttrValues: {
143143
"#000": "{props.color}",
144144
"#000000": "{props.color}",

src/util/transformSvg.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,20 @@ function loadSvg() {
1111
console.log(svgCode);
1212
svgr(
1313
svgCode,
14-
{ native: true, dimensions: true },
14+
{
15+
native: true,
16+
dimensions: false,
17+
replaceAttrValues: {
18+
"#000": "{props.color}",
19+
"#000000": "{props.color}",
20+
currentColor: "{props.color}",
21+
},
22+
plugins: [
23+
"@svgr/plugin-svgo",
24+
"@svgr/plugin-jsx",
25+
"@svgr/plugin-prettier",
26+
],
27+
},
1528
{ componentName: "MyComponent" }
1629
).then((jsCode: string) => {
1730
console.log("--js", jsCode);

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,16 +372,16 @@
372372

373373
"@svgr/plugin-prettier@^5.5.0":
374374
version "5.5.0"
375-
resolved "https://registry.npmjs.org/@svgr/plugin-prettier/-/plugin-prettier-5.5.0.tgz"
376-
integrity sha512-mVc+u+eKUmy8sW5UnFpes9NqVtizJfnhasF8Srbi3XdxVTWyU5lmhWlQAgHLhcrsZKowQ0b7xBa4qWHI5Ew/VQ==
375+
resolved "https://registry.nlark.com/@svgr/plugin-prettier/download/@svgr/plugin-prettier-5.5.0.tgz#6c5cc8100f0c895f356d24d523f6ea5165b75366"
376+
integrity sha1-bFzIEA8MiV81bSTVI/bqUWW3U2Y=
377377
dependencies:
378378
deepmerge "^4.2.2"
379379
prettier "^2.1.2"
380380

381381
"@svgr/plugin-svgo@^5.5.0":
382382
version "5.5.0"
383-
resolved "https://registry.npmjs.org/@svgr/plugin-svgo/-/plugin-svgo-5.5.0.tgz"
384-
integrity sha512-r5swKk46GuQl4RrVejVwpeeJaydoxkdwkM1mBKOgJLBUJPGaLci6ylg/IjhrRsREKDkr4kbMWdgOtbXEh0fyLQ==
383+
resolved "https://registry.npm.taobao.org/@svgr/plugin-svgo/download/@svgr/plugin-svgo-5.5.0.tgz#02da55d85320549324e201c7b2e53bf431fcc246"
384+
integrity sha1-AtpV2FMgVJMk4gHHsuU79DH8wkY=
385385
dependencies:
386386
cosmiconfig "^7.0.0"
387387
deepmerge "^4.2.2"

0 commit comments

Comments
 (0)