Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display single waypoint #25161

Merged
merged 19 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 5 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"react-native-web-linear-gradient": "^1.1.2",
"react-native-web-lottie": "^1.4.4",
"react-native-webview": "^11.17.2",
"react-native-x-maps": "1.0.6",
"react-native-x-maps": "github:Expensify/react-native-x-maps#hayata-test-new-version",
"react-pdf": "^6.2.2",
"react-plaid-link": "3.3.2",
"react-web-config": "^1.0.0",
Expand Down
31 changes: 30 additions & 1 deletion src/components/DistanceRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,38 @@ function DistanceRequest({transactionID, transaction, mapboxAccessToken}) {
const {translate} = useLocalize();

const waypoints = lodashGet(transaction, 'comment.waypoints', {});
const waypointCoordinates = _.map(waypoints, (waypoint) => [waypoint.lat, waypoint.lng]);
const numberOfWaypoints = _.size(waypoints);
const lastWaypointIndex = numberOfWaypoints - 1;

const waypointsData = _.filter(
hayata-suenaga marked this conversation as resolved.
Show resolved Hide resolved
_.map(waypoints, (waypoint, key) => {
if (waypoint.lng === undefined || waypoint.lat === undefined) {
hayata-suenaga marked this conversation as resolved.
Show resolved Hide resolved
return;
}

const index = Number(key.replace('waypoint', ''));
let MarkerComponent;
if (index === 0) {
MarkerComponent = Expensicons.DotIndicatorUnfilled;
} else if (index === lastWaypointIndex) {
MarkerComponent = Expensicons.Location;
} else {
MarkerComponent = Expensicons.DotIndicator;
}

return {
coordinate: [waypoint.lng, waypoint.lat],
markerComponent: () => (
<MarkerComponent
height={20}
fill={theme.iconReversed}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use theme.icon since it needs to match the backend and that's what I'm using there. But, let's check with the design team.

Copy link
Contributor Author

@hayata-suenaga hayata-suenaga Aug 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

them.icon is this color 🤔. Is this what's we're looking for? cc: @neil-marcellini @shawnborton

Screenshot 2023-08-21 at 1 36 59 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the color might change after the design discussion happening in this thread. So for now, we can just go with theme.icon and change if necessary after the merge.

We probably have to change the icons themselves anyway.

/>
),
};
}),
(waypoint) => waypoint,
);

// Show up to the max number of waypoints plus 1/2 of one to hint at scrolling
const halfMenuItemHeight = Math.floor(variables.baseMenuItemHeight / 2);
const scrollContainerMaxHeight = variables.baseMenuItemHeight * MAX_WAYPOINTS_TO_DISPLAY + halfMenuItemHeight;
Expand Down Expand Up @@ -167,6 +195,7 @@ function DistanceRequest({transactionID, transaction, mapboxAccessToken}) {
zoom: DEFAULT_ZOOM_LEVEL,
}}
style={styles.mapView}
waypoints={waypointsData}
/>
) : (
<View style={[styles.mapPendingView]}>
Expand Down
2 changes: 1 addition & 1 deletion src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3697,7 +3697,7 @@ const styles = {
...flex.flex1,
borderRadius: variables.componentBorderRadiusLarge,
},

userReportStatusEmoji: {
fontSize: variables.fontSizeNormal,
marginRight: 4,
Expand Down
Loading