blob: ee804ff39eb5001d57c1ef3d0c4e5edb13b953b1 (
plain)
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
32
33
34
35
36
37
|
import React from 'react';
import {Image, StyleSheet, View} from 'react-native';
import {useSelector} from 'react-redux';
import {COVER_HEIGHT, IMAGE_WIDTH} from '../../constants';
import {RootState} from '../../store/rootreducer';
import {ScreenType} from '../../types';
interface CoverProps {
userXId: string | undefined;
screenType: ScreenType;
}
const Cover: React.FC<CoverProps> = ({userXId, screenType}) => {
const {cover} = useSelector((state: RootState) =>
userXId ? state.userX[screenType][userXId] : state.user,
);
return (
<View style={[styles.container]}>
<Image
style={styles.image}
defaultSource={require('../../assets/images/cover-placeholder.png')}
source={{uri: cover, cache: 'reload'}}
/>
</View>
);
};
const styles = StyleSheet.create({
container: {
position: 'absolute',
},
image: {
width: IMAGE_WIDTH,
height: COVER_HEIGHT,
},
});
export default Cover;
|