vault-development / react-native-svg-uri

Render SVG images in React Native from an URL or static file
850 stars 335 forks source link

[Android] issue using svgXmlData #115

Closed adamski closed 6 years ago

adamski commented 6 years ago

Following advice from #12 I am now using svgXmlData to pull in SVG images.

e.g.

import svgTick from '../../img/svg/tick.svg';
//...
            <SvgUri 
              width={tickSize}
              height={tickSize} 
              svgXmlData={svgTick}
            />

However I'm getting lots of these error messages:

'ERROR SVG', { [TypeError: undefined is not a function (evaluating 'this.state.svgXmlData.indexOf("<svg ")')] line: 70268, column: 85, sourceURL: 'index.android.bundle' }

Could it be its not finding the SVG files, e.g. this.state.svgXmlData is null?

adamski commented 6 years ago

Sorted via @LeiZung's example in #12 plus using haul

yogeshR5 commented 6 years ago

@adamski how to load svgXmlData plz let you know me.

mortada-codes commented 6 years ago

@adamski @ligaz How to generate release APK by haul?!

manoj2166 commented 5 years ago

yes working in both android and ios with svgXmlData

adamski commented 5 years ago

@mortdatherobot something like this:

yarn run haul bundle -- --platform android --bundle-output app/src/main/assets/index.android.bundle --assets-dest app/src/main/assets/ --dev true
MaxxiMan commented 5 years ago

@manoj2166 could you explain or give an example of how to do it? I have the same error: "error svg..."