forked from testshallpass/react-native-dropdownalert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CancelButton.js
31 lines (30 loc) · 904 Bytes
/
CancelButton.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
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {TouchableOpacity} from 'react-native';
import ImageView from './imageview';
import {DEFAULT_IMAGE_DIMENSIONS} from './constants';
export default class CancelButton extends Component {
static propTypes = {
style: PropTypes.object,
onPress: PropTypes.func,
imageStyle: PropTypes.object,
imageSrc: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
};
static defaultProps = {
onPress: () => {},
style: {
padding: 8,
width: DEFAULT_IMAGE_DIMENSIONS,
height: DEFAULT_IMAGE_DIMENSIONS,
alignSelf: 'center',
},
};
render() {
const {style, onPress, imageStyle, imageSrc} = this.props;
return (
<TouchableOpacity style={style} onPress={onPress}>
<ImageView style={imageStyle} source={imageSrc} />
</TouchableOpacity>
);
}
}