blob: 436f805ccbe560929b5aa81f85fb3c4489f3668a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// @flow
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(){
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 }/>
);
}
}
}
|