summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoranderklander <anderklander@gmail.com>2017-12-21 21:14:55 +0100
committerAndrej Mihajlov <and@mullvad.net>2017-12-22 13:31:11 +0100
commit8a904d35e5dca7b72bd47f12ca742289a9697e39 (patch)
tree3cf50d418a346c0bf1c2e5dbccacd7a2c2370921
parenta69df881bfb7c584f2d999509ed5a11649ca47d0 (diff)
downloadmullvadvpn-8a904d35e5dca7b72bd47f12ca742289a9697e39.tar.xz
mullvadvpn-8a904d35e5dca7b72bd47f12ca742289a9697e39.zip
Add tintColor for android
-rw-r--r--app/components/Img.android.js24
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 }/>
+ );
+ }
}
}