Home Reference Source

src/components/wrappers/ImageWrapper.js

import React from 'react';
import {View, Image} from 'react-native';

import {globalStyles} from '../../styles/styles';

/**
 * Wrapper for image.
 * @param {Object} props - Properties
 * @param {string} props.source - source, style (don't use wrapperStyle, but use style as props)
 * @returns {Object} ImageWrapper containing the specified image
 */
export default function ImageWrapper(props) {
    const source = props.source;
    const wrapperStyle = props.wrapperStyle;

    let style = wrapperStyle;

    if (style === undefined) style = props.style;

    return (
        <View style={style}>
            <Image source={source} style={globalStyles.resetImage} />
        </View>
    );
}