Skip to content

Commit 20ed3d8

Browse files
author
xiazhigang
committed
修复 修复 svgr 组件样式
1 parent 2978ef4 commit 20ed3d8

File tree

8 files changed

+27
-35
lines changed

8 files changed

+27
-35
lines changed
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import * as React from "react";
2-
import Svg, { Path } from "react-native-svg";
1+
import * as React from "react"
2+
import Svg, { Path } from "react-native-svg"
33

44
function IconAlertTriangle(props) {
55
return (
66
<Svg
77
xmlns="http://www.w3.org/2000/svg"
8-
width={24}
9-
height={24}
108
viewBox="0 0 24 24"
119
fill="none"
1210
stroke={props.color}
@@ -18,7 +16,7 @@ function IconAlertTriangle(props) {
1816
>
1917
<Path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0zM12 9v4M12 17h.01" />
2018
</Svg>
21-
);
19+
)
2220
}
2321

24-
export default IconAlertTriangle;
22+
export default IconAlertTriangle
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import * as React from "react";
1+
import * as React from "react"
22

33
function IconAlertTriangle(props) {
44
return (
55
<svg
66
xmlns="http://www.w3.org/2000/svg"
7-
width={24}
8-
height={24}
97
viewBox="0 0 24 24"
108
fill="none"
119
stroke={props.color}
@@ -17,7 +15,7 @@ function IconAlertTriangle(props) {
1715
>
1816
<path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0zM12 9v4M12 17h.01" />
1917
</svg>
20-
);
18+
)
2119
}
2220

23-
export default IconAlertTriangle;
21+
export default IconAlertTriangle
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
import * as React from "react";
2-
import Svg, { Path } from "react-native-svg";
1+
import * as React from "react"
2+
import Svg, { Path } from "react-native-svg"
33

44
function IconChevronRight(props) {
55
return (
66
<Svg
77
xmlns="http://www.w3.org/2000/svg"
8-
width={24}
9-
height={24}
108
viewBox="0 0 24 24"
119
fill="none"
12-
stroke="currentColor"
10+
stroke={props.color}
1311
strokeWidth={2}
1412
strokeLinecap="round"
1513
strokeLinejoin="round"
@@ -18,7 +16,7 @@ function IconChevronRight(props) {
1816
>
1917
<Path d="M9 18l6-6-6-6" />
2018
</Svg>
21-
);
19+
)
2220
}
2321

24-
export default IconChevronRight;
22+
export default IconChevronRight

example/icons/IconChevronRight.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import * as React from "react";
1+
import * as React from "react"
22

33
function IconChevronRight(props) {
44
return (
55
<svg
66
xmlns="http://www.w3.org/2000/svg"
7-
width={24}
8-
height={24}
97
viewBox="0 0 24 24"
108
fill="none"
11-
stroke="currentColor"
9+
stroke={props.color}
1210
strokeWidth={2}
1311
strokeLinecap="round"
1412
strokeLinejoin="round"
@@ -17,7 +15,7 @@ function IconChevronRight(props) {
1715
>
1816
<path d="M9 18l6-6-6-6" />
1917
</svg>
20-
);
18+
)
2119
}
2220

23-
export default IconChevronRight;
21+
export default IconChevronRight

example/icons/IconCloseGray.rn.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import * as React from "react";
2-
import Svg, { Path } from "react-native-svg";
1+
import * as React from "react"
2+
import Svg, { Path } from "react-native-svg"
33

44
function IconCloseGray(props) {
55
return (
6-
<Svg width={26} height={25} xmlns="http://www.w3.org/2000/svg" {...props}>
6+
<Svg xmlns="http://www.w3.org/2000/svg" {...props}>
77
<Path
88
d="M18.7 6.795L7.318 18.179m.236-11.147l10.91 10.91"
99
stroke="#C8C9CC"
@@ -14,7 +14,7 @@ function IconCloseGray(props) {
1414
fillRule="evenodd"
1515
/>
1616
</Svg>
17-
);
17+
)
1818
}
1919

20-
export default IconCloseGray;
20+
export default IconCloseGray

example/icons/IconCloseGray.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import * as React from "react";
1+
import * as React from "react"
22

33
function IconCloseGray(props) {
44
return (
5-
<svg width={26} height={25} xmlns="http://www.w3.org/2000/svg" {...props}>
5+
<svg xmlns="http://www.w3.org/2000/svg" {...props}>
66
<path
77
d="M18.7 6.795L7.318 18.179m.236-11.147l10.91 10.91"
88
stroke="#C8C9CC"
@@ -13,7 +13,7 @@ function IconCloseGray(props) {
1313
fillRule="evenodd"
1414
/>
1515
</svg>
16-
);
16+
)
1717
}
1818

19-
export default IconCloseGray;
19+
export default IconCloseGray

example/routes/routes.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"question": "pages/question/index",
3232
"Home": "pages/tabs/Home/index"
3333
},
34-
"fullSource": {
34+
"routeMap": {
3535
"content": "/pages/content/index",
3636
"center": "/pages/packages/pkgname/center/index",
3737
"user": "/pages/packages/pkgname/user/index",

src/icons/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ const svgrGenerator = async (fileDir: string, componentName: string) => {
158158
? `${componentName}.tsx`
159159
: `${componentName}.${platform}.tsx`;
160160
const iconPath = path.join(config.iconTarget, `/${iconBaseName}`);
161-
fs.writeFileSync(iconPath, code, "utf-8");
161+
fs.writeFileSync(iconPath, prettierFormat(code), "utf-8");
162162
});
163163
});
164164
return true;

0 commit comments

Comments
 (0)