Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shape.tsx: Cannot read property 'name' of undefined #1526

Closed
jacquesdev opened this issue Feb 8, 2021 · 3 comments
Closed

Shape.tsx: Cannot read property 'name' of undefined #1526

jacquesdev opened this issue Feb 8, 2021 · 3 comments

Comments

@jacquesdev
Copy link

jacquesdev commented Feb 8, 2021

Question

I'm getting an error that is driving me nuts. Have tried searching for an answer elsewhere, and have not seen this issue anywhere. I'm probably doing something very obviously wrong, so I thought I'd just add this screenshot since this is the error I am getting

Screenshot 2021-02-08 at 16 31 28

I am simply trying to get to the point where I can display a locally saved SVG image in my iOS app. I have installed this plugin, as well as react-native-svg-transformer, with all the settings I could think mentioned. Since the error is complaining about this plugin, I thought I would start off here. I tried with my initial image, and thought maybe the image as wrong, so tried an svg file from wikipedia, but I just never get past this error, when I try to render the image. What is worse is that I don't see any entries about this error, so I have no idea what to try. Any ideas? Does anyone know what I'm doing wrong?

I don't even see a property called 'name' in Shape.tsx, so I'm guessing this prop is somehow inherited, but not understanding much about SVG, I am not sure how to proceed.

The test.svg file is the svg file in the first article of the wikipedia entry on svg files, to confirm I am using a valid file.

package.json

  "react-native": "0.63.3",  
  "react-native-svg": "^12.1.0",
  "react-native-svg-transformer": "^0.14.3",

component

import Image from './test.svg' 
<Image width={50} height={50} />

metro.config.js

const { getDefaultConfig } = require('metro-config')

module.exports = (async () => {
  const {
    resolver: { sourceExts, assetExts },
  } = await getDefaultConfig()
  return {
    transformer: {
      getTransformOptions: async () => ({
        transform: {
          experimentalImportSupport: false,
          inlineRequires: false,
        },
      }),
      babelTransformerPath: require.resolve('react-native-svg-transformer'),
    },
    resolver: {
      assetExts: assetExts.filter((ext) => ext !== 'svg'),
      sourceExts: [...sourceExts, 'svg'],
    },
  }
})()

@altany
Copy link

altany commented Mar 22, 2021

Any update on this? I tried installing react-native-svg and I am also getting this error.

@vdanylov
Copy link

vdanylov commented Jan 4, 2022

The same, update react-native-svg-transform, cause similar problem

@bohdanprog
Copy link
Member

Hello @jacquesdev,
If you are still experiencing problems, please feel free to open a new one.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants