-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzise
More file actions
147 lines (132 loc) · 3.62 KB
/
zise
File metadata and controls
147 lines (132 loc) · 3.62 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/* eslint-disable */
import React, { memo, useLayoutEffect, useEffect } from "react";
import PropTypes from "prop-types";
import {
View,
Text,
TouchableOpacity,
SectionList,
Pressable,
Dimensions,
} from "react-native";
import { FontAwesomeIcon } from "@fortawesome/react-native-fontawesome";
import { faMapMarkerAlt } from "@fortawesome/pro-duotone-svg-icons";
import { useNavigation } from "@react-navigation/native";
import { useDispatch } from "react-redux";
import {
VENDOR_INDUSTRIES_MAPPING,
VENDOR_PHOTO_SIZES,
} from "@jmsstudiosinc/vendor";
import Fast2ImageKit from "../../components/Fast2ImageKit";
import { IMLocalized } from "../../Core/localization/IMLocalization";
import { SkeletonHome, TNEmptyStateView } from "../../Core/truly-native";
import DynamicAppStyles from "../../DynamicAppStyles";
import styles from "./styles";
import { updateUIShoppingIndustry } from "../../Core/ui/redux";
import { extractUniqueIndustry } from "../IndustryFilter/utils";
import IndustryFilter from "../IndustryFilter/index";
import PudFilter from "./PudFilter/index";
import Notifications from "../../Core/notifications";
const getBreakpointForScreenSize = ({ theme, dimensions }) => {
const sortedBreakpoints = Object.entries(theme.breakpoints).sort(
(valA, valB) => {
return valA[1] - valB[1];
}
);
console.log(sortedBreakpoints);
return sortedBreakpoints.reduce((acc, [breakpoint, minWidth]) => {
if (dimensions.width >= minWidth) return breakpoint;
return acc;
}, null);
};
const getResponsiveValue = ({ value, dimensions, theme }) => {
if (typeof value === "object") {
return value[getBreakpointForScreenSize({ theme, dimensions })];
}
return value;
};
const VendorList = ({
enrichedNearbyVendors,
pudFilteredVendors,
fullFilteredVendors,
pudFilterOptions,
pudFilter,
industryFilter,
loading,
user,
}) => {
if (loading === true) {
return <SkeletonHome />;
}
const navigation = useNavigation();
const dispatch = useDispatch();
const dimensions = Dimensions.get("window");
const theme = {
breakpoints: {
smallPhone: 0,
phone: 321,
tablet: 768,
},
spacing: {
s: 8,
m: 16,
l: 24,
xl: 40,
},
padding: {
smallPhone: "xs",
phone: "s",
tablet: "m",
},
};
const headerTitle = () => (
<Pressable
style={{
flexDirection: "row",
width: "77%",
}}
testID="Geoposition"
onPress={() => navigation.navigate("Geoposition")}
>
<View style={styles.containerItemNavigation}>
<FontAwesomeIcon
icon={faMapMarkerAlt}
color={DynamicAppStyles.lightColorSet.mainBtnTheme}
size={20}
/>
</View>
<View style={styles.headerTitle}>
<Text numberOfLines={1} style={styles.headerTitle}>
{user.location?.formattedAddress
? user.location.formattedAddress
: IMLocalized("Add Your Address")}
</Text>
</View>
</Pressable>
);
useEffect(() => {
navigation.setOptions({
headerTitle,
});
}, []);
console.log(getResponsiveValue({ value: theme.margin, dimensions, theme }));
console.log(getResponsiveValue({ value: theme.padding, dimensions, theme }));
return (
<View
style={{
margin:
theme.spacing[
getResponsiveValue({ value: theme.margin, dimensions, theme })
],
padding:
theme.spacing[
getResponsiveValue({ value: theme.padding, dimensions, theme })
],
}}
>
<Text>Hola mundo</Text>
</View>
);
};
export default VendorList;
// hola mundo