kristerkari / react-native-svg-transformer

Import SVG files in your React Native project the same way that you would in a Web application.
MIT License
1.55k stars 117 forks source link

ERROR SVG, [TypeError: Network request failed] #232

Closed zhiwang20 closed 1 year ago

zhiwang20 commented 1 year ago

Code:

function GetFormIcon({ industry, fill, style, height, width }) {
  switch (industry) {
    case "BR":
      return (
        <BR fill={fill} style={style} height={height} width={width} />
      );
    case "HS":
      return (
        <HS
          fill={fill}
          style={style}
          height={height}
          width={width}
        />
      );
    case "MA":
      return (
        <MA fill={fill} style={style} height={height} width={width} />
      );
    case "NT":
      return (
        <NT fill={fill} style={style} height={height} width={width} />
      );
    case "EN":
      return (
        <EN
          fill={fill}
          style={style}
          height={height}
          width={width}
        />
      );
    case "MT":
      return (
        <MT fill={fill} style={style} height={height} width={width} />
      );
    case "TS":
      return (
        <TS fill={fill} style={style} height={height} width={width} />
      );
  }
}

Images rendered successfully when I exported GetFormIcon to other files, but I got this red warning:

ERROR SVG, [TypeError: Network request failed] at node_modules\expo\build\environment\react-native-logs.fx.js:null in error at node_modules\expo-svg-uri\index.js:null in SvgUri#fetchSVGData at node_modules\@babel\runtime\helpers\asyncToGenerator.js:null in asyncGeneratorStep at node_modules\@babel\runtime\helpers\asyncToGenerator.js:null in _throw at node_modules\react-native\node_modules\promise\setimmediate\core.js:null in tryCallOne at node_modules\react-native\node_modules\promise\setimmediate\core.js:null in setImmediate$argument_0 at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:null in _allocateCallback$argument_0 at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:null in _callTimer at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:null in _callReactNativeMicrotasksPass at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:null in callReactNativeMicrotasks at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:null in __callReactNativeMicrotasks at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:null in guard$argument_0 at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:null in guard at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:null in flushedQueue