2017-09-21 17:08:00 +00:00
|
|
|
import React from 'react';
|
2017-11-23 19:12:18 +00:00
|
|
|
import { ScrollView, View, Text, TouchableWithoutFeedback } from 'react-native';
|
2018-05-07 20:41:36 +00:00
|
|
|
import FastImage from 'react-native-fast-image';
|
2017-09-21 17:08:00 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import Modal from 'react-native-modal';
|
|
|
|
|
|
|
|
const styles = {
|
|
|
|
imageWrapper: {
|
2017-11-23 19:12:18 +00:00
|
|
|
alignItems: 'stretch',
|
|
|
|
flex: 1
|
2017-09-21 17:08:00 +00:00
|
|
|
},
|
|
|
|
image: {
|
2017-11-23 19:12:18 +00:00
|
|
|
flex: 1
|
2017-09-21 17:08:00 +00:00
|
|
|
},
|
|
|
|
titleContainer: {
|
|
|
|
width: '100%',
|
|
|
|
alignItems: 'center',
|
2017-11-23 19:12:18 +00:00
|
|
|
marginVertical: 10
|
2017-09-21 17:08:00 +00:00
|
|
|
},
|
|
|
|
title: {
|
|
|
|
color: '#ffffff',
|
2017-11-23 19:12:18 +00:00
|
|
|
textAlign: 'center',
|
2017-09-21 17:08:00 +00:00
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: '600'
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-02-08 14:08:50 +00:00
|
|
|
export default class PhotoModal extends React.PureComponent {
|
2017-09-21 17:08:00 +00:00
|
|
|
static propTypes = {
|
|
|
|
title: PropTypes.string.isRequired,
|
|
|
|
image: PropTypes.string.isRequired,
|
|
|
|
isVisible: PropTypes.bool,
|
|
|
|
onClose: PropTypes.func.isRequired
|
|
|
|
}
|
|
|
|
render() {
|
2017-11-13 12:58:35 +00:00
|
|
|
const {
|
|
|
|
image, isVisible, onClose, title
|
|
|
|
} = this.props;
|
2017-09-21 17:08:00 +00:00
|
|
|
return (
|
|
|
|
<Modal
|
|
|
|
isVisible={isVisible}
|
|
|
|
onBackdropPress={onClose}
|
|
|
|
onBackButtonPress={onClose}
|
|
|
|
>
|
2017-11-23 19:12:18 +00:00
|
|
|
<TouchableWithoutFeedback onPress={onClose}>
|
|
|
|
<View style={styles.titleContainer}>
|
|
|
|
<Text style={styles.title}>{title}</Text>
|
|
|
|
</View>
|
|
|
|
</TouchableWithoutFeedback>
|
2017-09-21 17:08:00 +00:00
|
|
|
<View style={styles.imageWrapper}>
|
2017-11-23 19:12:18 +00:00
|
|
|
<ScrollView contentContainerStyle={styles.imageWrapper} maximumZoomScale={5}>
|
|
|
|
<TouchableWithoutFeedback onPress={onClose}>
|
2018-05-07 20:41:36 +00:00
|
|
|
<FastImage
|
2017-11-23 19:12:18 +00:00
|
|
|
style={styles.image}
|
|
|
|
source={{ uri: encodeURI(image) }}
|
|
|
|
mutable
|
|
|
|
resizeMode='contain'
|
|
|
|
/>
|
|
|
|
</TouchableWithoutFeedback>
|
2017-09-21 17:08:00 +00:00
|
|
|
</ScrollView>
|
|
|
|
</View>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|