diff options
| -rw-r--r-- | app/components/Img.android.js | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/app/components/Img.android.js b/app/components/Img.android.js index 303fe4e5cb..436f805ccb 100644 --- a/app/components/Img.android.js +++ b/app/components/Img.android.js @@ -1,9 +1,27 @@ // @flow -import React from 'react'; -import { Image, Component } from 'reactxp'; +import React, { Component } from 'react'; +import { StyleSheet } from 'react-native'; +import { Image } from 'reactxp'; export default class Img extends Component { + props: { + source: string, + style: Object, + tintColor?: string + }; + render(){ - return (<Image style={ this.props.style } source={ this.props.source }/>); + const { source, tintColor, style } = this.props; + + if (tintColor === 'currentColor' && style) { + const { color: tint, ...otherStyles } = StyleSheet.flatten(style); + return( + <Image style={[ otherStyles, { tintColor: tint } ]} source={ source }/> + ); + } else { + return( + <Image style={ style } source={ source }/> + ); + } } } |
