UNPKG

react-native-lifetime-livechat

Version:

LiveChat implementation for LifeTime application

65 lines (59 loc) 1.34 kB
/* eslint no-use-before-define: ["error", { "variables": false }] */ import PropTypes from 'prop-types'; import React from 'react'; import { Image, StyleSheet, View, ViewPropTypes } from 'react-native'; import Lightbox from 'react-native-lightbox'; export default function MessageImage({ containerStyle, lightboxProps, imageProps, imageStyle, currentMessage, }) { return ( <View style={[styles.container, containerStyle]}> <Lightbox activeProps={{ style: styles.imageActive, }} {...lightboxProps} > <Image {...imageProps} style={[styles.image, imageStyle]} source={{ uri: currentMessage.image }} /> </Lightbox> </View> ); } const styles = StyleSheet.create({ container: {}, image: { width: 150, height: 100, borderRadius: 13, margin: 3, resizeMode: 'cover', }, imageActive: { flex: 1, resizeMode: 'contain', }, }); MessageImage.defaultProps = { currentMessage: { image: null, }, containerStyle: {}, imageStyle: {}, imageProps: {}, lightboxProps: {}, }; MessageImage.propTypes = { currentMessage: PropTypes.object, containerStyle: ViewPropTypes.style, imageStyle: Image.propTypes.style, imageProps: PropTypes.object, lightboxProps: PropTypes.object, };