Commit 97e4e46f authored by Wietse Kuipers's avatar Wietse Kuipers
Browse files

Merge branch 'fix/thumbnails-for-memberview' into 'master'

Change profile image url to thumbnail url for MemberView

See merge request !45
parents 387f95ad fc618195
......@@ -3,17 +3,29 @@ import PropTypes from 'prop-types';
import { Image, Text, ViewPropTypes, StyleSheet } from 'react-native';
import LinearGradient from 'react-native-linear-gradient';
import { connect } from 'react-redux';
import { url } from '../url';
import styles from './style/memberView';
import SquareView from './SquareView';
const MemberView = props => (
<SquareView style={props.style}>
<Image style={styles.image} source={{ uri: props.member.photo }}>
<LinearGradient colors={['#55000000', '#000000']} style={styles.overlayGradient} />
<Text style={styles.nameText}>{props.member.name}</Text>
</Image>
</SquareView>
const regex = new RegExp(`^(${url}/media/public)/(avatars/[^\\.]+)\\.(jpg|jpeg|png|gif)`);
const MemberView = (props) => {
let photo = props.member.photo;
const matches = regex.exec(photo);
if (matches) {
photo = `${matches[1]}/thumbnails/220x220_1/${matches[2]}.${matches[3]}`;
}
return (
<SquareView style={props.style}>
<Image style={styles.image} source={{ uri: photo }}>
<LinearGradient colors={['#55000000', '#000000']} style={styles.overlayGradient} />
<Text style={styles.nameText}>{props.member.name}</Text>
</Image>
</SquareView>
);
};
MemberView.propTypes = {
member: PropTypes.shape({
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment