File tree 3 files changed +12
-0
lines changed
3 files changed +12
-0
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 @@ -34,6 +34,11 @@ interface SvgUriProps {
34
34
* Fill color for the svg object
35
35
*/
36
36
fill ?: string
37
+
38
+ /**
39
+ * Fill the entire svg element with same color
40
+ */
41
+ fillAll ?: boolean
37
42
}
38
43
39
44
export default class SvgUri extends Component < SvgUriProps , { } > { }
Original file line number Diff line number Diff line change @@ -220,6 +220,11 @@ class SvgUri extends Component{
220
220
221
221
obtainComponentAtts ( { attributes} , enabledAttributes ) {
222
222
const styleAtts = { } ;
223
+
224
+ if ( this . state . fill && this . props . fillAll ) {
225
+ styleAtts . fill = this . state . fill ;
226
+ }
227
+
223
228
Array . from ( attributes ) . forEach ( ( { nodeName, nodeValue} ) => {
224
229
Object . assign ( styleAtts , utils . transformStyle ( {
225
230
nodeName,
@@ -303,6 +308,7 @@ SvgUri.propTypes = {
303
308
svgXmlData : PropTypes . string ,
304
309
source : PropTypes . any ,
305
310
fill : PropTypes . string ,
311
+ fillAll : PropTypes . bool
306
312
}
307
313
308
314
module . exports = SvgUri ;
You can’t perform that action at this time.
0 commit comments