blob: bf355220452112c0f045b0b05e9685d3e67cf30f (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
import React from 'react';
import {ProfilePreviewType, PreviewType, ScreenType} from '../../types';
import ProfilePreview from '../profile/ProfilePreview';
import {StyleSheet, View} from 'react-native';
interface SearchResultsProps {
results: Array<ProfilePreviewType>;
previewType: PreviewType;
screenType: ScreenType;
}
const SearchResults: React.FC<SearchResultsProps> = ({
results,
previewType,
screenType,
}) => {
/**
* Added the following swicth case to make Results on Search and Recents screen a list
* Flex is love
*/
var containerStyle;
switch (previewType) {
case 'Search':
containerStyle = styles.containerSearch;
break;
case 'Recent':
containerStyle = styles.containerSearch;
break;
default:
containerStyle = styles.container;
}
return (
<View style={containerStyle}>
{results &&
results.map((profilePreview) => (
<ProfilePreview
style={styles.result}
key={profilePreview.id}
{...{profilePreview}}
previewType={previewType}
screenType={screenType}
/>
))}
</View>
);
};
const styles = StyleSheet.create({
containerSearch: {flexDirection: 'column', flexWrap: 'wrap'},
container: {flexDirection: 'row', flexWrap: 'wrap'},
result: {
marginVertical: 10,
},
});
export default SearchResults;
|