diff options
| author | anderklander <anderklander@gmail.com> | 2017-12-21 21:14:55 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2017-12-22 13:31:11 +0100 |
| commit | 8a904d35e5dca7b72bd47f12ca742289a9697e39 (patch) | |
| tree | 3cf50d418a346c0bf1c2e5dbccacd7a2c2370921 | |
| parent | a69df881bfb7c584f2d999509ed5a11649ca47d0 (diff) | |
| download | mullvadvpn-8a904d35e5dca7b72bd47f12ca742289a9697e39.tar.xz mullvadvpn-8a904d35e5dca7b72bd47f12ca742289a9697e39.zip | |
Add tintColor for android
| -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 }/> + ); + } } } |
