blob: ced9d3f46114f0a540798460be1e22f1860fe71d (
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
28
29
30
31
32
|
// @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,
height?: number,
width?:number,
};
render(){
const width = this.props.width || 7;
const height = this.props.height || 12;
const source = this.props.source || 'icon-chevron';
const tintColor = this.props.tintColor || 'currentColor';
if (tintColor === 'currentColor' && this.props.style) {
const { color: tint, ...otherStyles } = StyleSheet.flatten(this.props.style);
return(
<Image style={[ otherStyles, { tintColor: tint, height: height, width: width } ]} source={ source }/>
);
} else {
return(
<Image style={[ this.props.style, { height: height, width: width } ]} source={ source }/>
);
}
}
}
|