File tree 4 files changed +13
-1
lines changed
4 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ react-native link react-native-svg # not react-native-svg-uri !!!
27
27
| ` source ` | ` ImageSource ` | | Same kind of ` source ` prop that ` <Image /> ` component has
28
28
| ` svgXmlData ` | ` String ` | | You can pass the SVG as String directly
29
29
| ` fill ` | ` Color ` | | Overrides all fill attributes of the svg file
30
+ | ` fillAll ` | ` Boolean ` | Adds the fill color to the entire svg object
30
31
31
32
## Known Bugs
32
33
Original file line number Diff line number Diff line change @@ -39,6 +39,11 @@ interface SvgUriProps {
39
39
* Invoked when load completes successfully.
40
40
*/
41
41
onLoad ?: Function
42
+
43
+ /**
44
+ * Fill the entire svg element with same color
45
+ */
46
+ fillAll ?: boolean
42
47
}
43
48
44
49
export default class SvgUri extends Component < SvgUriProps , { } > { }
Original file line number Diff line number Diff line change @@ -226,6 +226,11 @@ class SvgUri extends Component{
226
226
227
227
obtainComponentAtts ( { attributes} , enabledAttributes ) {
228
228
const styleAtts = { } ;
229
+
230
+ if ( this . state . fill && this . props . fillAll ) {
231
+ styleAtts . fill = this . state . fill ;
232
+ }
233
+
229
234
Array . from ( attributes ) . forEach ( ( { nodeName, nodeValue} ) => {
230
235
Object . assign ( styleAtts , utils . transformStyle ( {
231
236
nodeName,
@@ -310,6 +315,7 @@ SvgUri.propTypes = {
310
315
source : PropTypes . any ,
311
316
fill : PropTypes . string ,
312
317
onLoad : PropTypes . func ,
318
+ fillAll : PropTypes . bool
313
319
}
314
320
315
321
module . exports = SvgUri ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " react-native-svg-uri" ,
3
- "version" : " 1.2.1 " ,
3
+ "version" : " 1.2.3 " ,
4
4
"description" : " Render an SVG Image from an URL" ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
You can’t perform that action at this time.
0 commit comments