mirror of
https://gitlab.com/wheres-the-tp/ui-mobile.git
synced 2026-01-25 07:44:54 -06:00
sort places by distance always
This commit is contained in:
parent
f84c23aa85
commit
7ebfd3bd1b
1 changed files with 3 additions and 0 deletions
|
|
@ -19,6 +19,8 @@ type Props = {
|
|||
viewMode: string,
|
||||
};
|
||||
|
||||
const byDistance = (left: PlaceRecord, right: PlaceRecord) => left.distance - right.distance;
|
||||
|
||||
const PlacesList = ({ foodItemsByPlace = Map(), places, isRefreshing, onPulldown }: Props) => {
|
||||
const refreshing = isRefreshing || !places;
|
||||
return (
|
||||
|
|
@ -27,6 +29,7 @@ const PlacesList = ({ foodItemsByPlace = Map(), places, isRefreshing, onPulldown
|
|||
refreshControl={<RefreshControl refreshing={refreshing} onRefresh={onPulldown} />}>
|
||||
{places &&
|
||||
places
|
||||
.sort(byDistance)
|
||||
.map((place: PlaceRecord, placeId: string) => {
|
||||
const foodItems = foodItemsByPlace.get(placeId, new List());
|
||||
return <PlaceTile key={placeId} place={place} foodItems={foodItems} />;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue