-
Notifications
You must be signed in to change notification settings - Fork 0
/
BannerItem.js
61 lines (56 loc) · 1.84 KB
/
BannerItem.js
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import React, {Component} from 'react';
import {View, Text, ImageBackground, TouchableOpacity} from 'react-native';
// import Gestures from 'react-native-touch-gestures';
import styles from './Styles';
type IProps = {
navigation: any,
routeName: String,
id: Number,
featureName: String,
height: Number,
};
class BannerItem extends Component<IProps> {
constructor(props) {
super(props);
this.state = {};
}
render() {
const {viewStyle, imageStyle, url} = this.props;
return (
<View
onTouchStart={(e) => {
this.props.isAutoScroll(false);
}}
style={[styles.containerStyle, viewStyle]}>
<ImageBackground
source={{uri: url}}
style={[styles.imageStyle, imageStyle]}>
<View style={styles.textView}>
{this.props[this.props.titleKey] != undefined &&
this.props[this.props.titleKey] != '' ? (
<Text numberOfLines={1} style={styles.titleStyle}>
{this.props[this.props.titleKey]}
</Text>
) : this.props.title != undefined && this.props.title != '' ? (
<Text numberOfLines={1} style={styles.titleStyle}>
{this.props.title}
</Text>
) : null}
{this.props[this.props.subTitleKey] != undefined &&
this.props[this.props.subTitleKey] != '' ? (
<Text numberOfLines={1} style={styles.subTitleStyle}>
{this.props[this.props.subTitleKey]}
</Text>
) : this.props.subTitle != undefined &&
this.props.subTitle != '' ? (
<Text numberOfLines={1} style={styles.titleStyle}>
{this.props.subTitle}
</Text>
) : null}
</View>
</ImageBackground>
</View>
);
}
}
export default BannerItem;