panhui 5 vuotta sitten
vanhempi
commit
4e38783f1e

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
Utils/SvgUtils.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 9 - 0
Utils/SvgUtilsNew.js


+ 27 - 4
components/SvgIcon.js

@@ -1,18 +1,41 @@
 import * as React from 'react'
 import * as React from 'react'
 import { svg, path } from 'react-native-svg'
 import { svg, path } from 'react-native-svg'
 import { withTheme } from 'react-native-paper'
 import { withTheme } from 'react-native-paper'
-import names from '../Utils/SvgUtils'
+import svgMap from '../Utils/SvgUtilsNew'
 
 
 function Icon(props) {
 function Icon(props) {
-  const { name, width, height, type, theme } = props
+  const { name, width, height, type, theme, fillAll } = props
   let { color } = props
   let { color } = props
   const { colors } = theme
   const { colors } = theme
   if (type) {
   if (type) {
     color = colors[type]
     color = colors[type]
   }
   }
+  const svgInfo = svgMap.get(name)
+  const viewBox = svgInfo ? svgInfo.viewBox || '0 0 1024 1024' : '0 0 1024 1024'
+  const pathList = svgInfo
+    ? svgInfo.pathList || [
+        {
+          ...svgInfo,
+        },
+      ]
+    : []
+  const pathComList = () => {
+    return pathList.map((item, index) => {
+      const pathProps = { ...item }
+      if (fillAll || !item.fillRule) {
+        pathProps.fill = color
+      }
+
+      if (item.fillRule) {
+        pathProps.stroke = color
+      }
+      delete pathProps.viewBox
+      return <path {...pathProps} key={index} />
+    })
+  }
   return (
   return (
-    <svg width={width || 32} height={height || 32} viewBox="0 0 1024 1024">
-      <path fill={color || '#000000'} d={names[name || 'home']} />
+    <svg width={width} height={height} viewBox={viewBox}>
+      {pathComList()}
     </svg>
     </svg>
   )
   )
 }
 }

+ 1 - 1
components/Text.js

@@ -57,7 +57,7 @@ function MyText(props) {
     case 'c2':
     case 'c2':
       // 10
       // 10
       return (
       return (
-        <Text theme={theme} medium style={[{ fontSize: 10 }, { ...style }]}>
+        <Text theme={theme} style={[{ fontSize: 10 }, { ...style }]}>
           {children}
           {children}
         </Text>
         </Text>
       )
       )

+ 6 - 1
navigation/BottomTabNavigator.jsx

@@ -20,7 +20,12 @@ export default function BottomTabNavigator() {
             </Text>
             </Text>
           ),
           ),
           tabBarIcon: ({ focused }) => (
           tabBarIcon: ({ focused }) => (
-            <Icon type={focused ? 'primary' : 'info'} name="home" />
+            <Icon
+              fillAll={!!focused}
+              type={focused ? 'primary' : 'info'}
+              width={37}
+              name="home"
+            />
           ),
           ),
         }}
         }}
       />
       />

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä