From 11f6d22a2ae158bd06835954f4e479d2c5d9d097 Mon Sep 17 00:00:00 2001 From: Mikael Sand Date: Wed, 23 Jan 2019 22:27:44 +0200 Subject: [PATCH] Update README.md --- README.md | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a5b6be2e..83733117 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,38 @@ react-native link react-native-svg # not react-native-svg-uri !!! - [ANDROID] There is a problem with static SVG file on Android, Works OK in debug mode but fails to load the file in release mode. - At the moment the only workaround is to pass the svg content in the svgXmlData prop. + At the moment the only workaround is to pass the svg content in the svgXmlData prop, + or, you can use [babel-plugin-inline-import](https://github.com/credcollective/babel-plugin-inline-import) + + .babelrc + ```json + { + "presets": ["module:metro-react-native-babel-preset"], + "plugins": [ + ["babel-plugin-inline-import", { + "extensions": [ + ".svg" + ] + }] + ] + } + ``` + + App.js + ```javascript + import * as React from 'react'; + import SvgUri from 'react-native-svg-uri'; + import testSvg from './test.svg'; + + export default () => ( + + ); + ``` + ## Usage