TypeError: Cannot read property 'push' of null when using SvgXml with babel plugin import
See original GitHub issueHello. I don’t know if I’m using this library wrong or what but I only get “TypeError: Cannot read property ‘push’ of null” whenever I am trying to use an SvgXml tag.
babel.config:
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [['babel-plugin-inline-import', { extensions: ['.svg'] }]],
};
MyComponent.js
import React from 'react';
import { View, StyleSheet, Text } from 'react-native';
import { SvgXml } from 'react-native-svg';
import MyIcon from '../assets/icons/MyIcon.svg';
import CustomText from './CustomText';
const styles = ...
const MyComponent = ({ text }) => {
return (
<View style={styles.header}>
<SvgXml width={100} height={200} xml={MyIcon} />
<CustomText italic style={styles.label}>
{text}
</CustomText>
</View>
);
};
export default MyComponent;
What am I doing wrong? Thanks in advance
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top Results From Across the Web
Cannot read property 'push' of null when using SvgXml with ...
This is a clean project, only installed what was needed for this package and the babel plugin. import { View } from 'react-native';...
Read more >TypeError: Cannot read property 'push' of null in react js
Here problem is you are storing blank array with key as transactions , but you are fetching data key transations .
Read more >import { svgXml } from "react-native-svg"; Code Example
import SvgUri from 'react-native-svg-uri'; // SVG Package ... reactjs typeError: Cannot read property 'offsetHeight' of null ...
Read more >Uncaught TypeError: Cannot read property 'push' of undefined
Uncaught TypeError: Cannot read property 'push' of undefined. Hey,. I am trying to serve random words to the user but only serve each...
Read more >package.json - Mend Renovate Dashboard
webpackJsonp||[]).push([[0],{455:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Probably babel conf error, closing.
Well nothing to do unless there’s a repro, instructions in readme are quite clear and seem to work just fine.