-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[$250] Android - Distance - Unable to switch distance label unit when tapping on the label #56499
Comments
Triggered auto assignment to @VictoriaExpensify ( |
Triggered auto assignment to @marcochavezf ( |
💬 A slack conversation has been started in #expensify-open-source |
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
|
Job added to Upwork: https://www.upwork.com/jobs/~021887689540451729884 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.The issue occurs when attempting to toggle the distance label (miles ↔ kilometers) on Android. The tap event does not trigger correctly, preventing users from switching the unit. What is the root cause of that problem?The problem originates in the following code: Checking the onTouchEnd={(e) => {
e.stopPropagation();
}}
Since this is a deploy blocker, I will begin preparing my PR and testing immediately. What changes do you think we should make in order to solve the problem?
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?When using pressable components
What alternative solutions did you explore? (Optional)N/A |
Screen recording form the fix:Android app:android.app.movAndroid chrome:android.chrome.moviOS app:iOS.App.moviOS safari:iOS.safari.movChrome Mac:chrome.movSafari Mac:safari.movMacOS app:MacOS.desktop.app.mov |
Hi @OmarKoueifi, thanks for the proposal, it looks good to me. @abdulrahuman5196 could you give final approval when you have a moment? Thanks Removing the blocker status as this is low impact. |
While testing the fix, I noticed an unintended behavior:
Proposed WorkaroundTo prevent this, I implemented the following additional check:
Or:
Should I proceed with this fix? |
Not yet. It seems a bit hacky, so lets see if other options can be raised such as intercepting the touch and preventing map from receiving the event. I'd like to see what @abdulrahuman5196 thinks too. |
ProposalPlease re-state the problem that we are trying to solve in this issue.Unable to switch between distance label unit when tapping on distance label within What is the root cause of that problem?
What changes do you think we should make in order to solve the problem?
const touchStart = useRef<{ x: number; y: number } | null>(null);
onTouchStart={(e: GestureResponderEvent) => {
touchStart.current = { x: e.nativeEvent.pageX, y: e.nativeEvent.pageY };
}}
onTouchEnd={(e: GestureResponderEvent) => {
if (touchStart.current) {
const { pageX, pageY } = e.nativeEvent;
const distance = Math.sqrt(
Math.pow(pageX - touchStart.current.x, 2) + Math.pow(pageY - touchStart.current.y, 2)
);
if (distance < 5) {
toggleDistanceUnit();
}
}
}} After_MarkerView_Fix.mp4What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
What alternative solutions did you explore? (Optional)None |
Why did you update your workaround @OmarKoueifi? Your |
My first workaround was to check |
@Julesssss, @abdulrahuman5196, @VictoriaExpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@abdulrahuman5196 , 👀 on the above plz |
Hi, sorry for the delay checking now |
@Julesssss @abdulrahuman5196 @VictoriaExpensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@Julesssss, @abdulrahuman5196, @VictoriaExpensify Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Checking now. Will provide information before EOD |
Checking again |
Regarding @OmarKoueifi 's proposal here #56499 (comment) and @rohit9625 's proposal here #56499 (comment), both suggest to change OnPress to |
@abdulrahuman5196 I don't like to say I tried everything, but in this case, I really think I did, at least when trying to fix the issue within the current implementation. That being said, I am open to exploring alternative approaches if we can find a more robust solution. Do you have any suggestions on a different direction we could take? |
I found a related GH issue. I hope this can help us understand why the issue happens in our case. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Speaking of GH issues, I found a couple of related issues discussing this. They seem to affect iOS but not Android, whereas in our case, it is affecting Android only. For example, this one: rnmapbox/maps#3440. |
ProposalPlease re-state the problem that we are trying to solve in this issue.Android - Distance - Unable to switch distance label unit when tapping on the label What is the root cause of that problem?On Android, we use App/src/components/MapView/responder/index.android.ts Lines 3 to 9 in ec99650
App/src/components/MapView/MapView.tsx Line 259 in ec99650
What changes do you think we should make in order to solve the problem?Removing const TouchableWrapper = ({
children,
onPress,
accessibilityLabel,
accessibilityRole,
testID,
}: TouchableWrapperProps) => {
const touchStartTime = useRef<number | null>(null);
const touchStartLocation = useRef<{x: number; y: number} | null>(null);
const handleTouchStart = (event: GestureResponderEvent) => {
touchStartTime.current = Date.now();
touchStartLocation.current = {
x: event.nativeEvent.pageX,
y: event.nativeEvent.pageY
};
};
const handleTouchMove = (event: GestureResponderEvent) => {
// If the touch has moved more than a threshold, consider it a drag
if (touchStartLocation.current) {
const dx = Math.abs(event.nativeEvent.pageX - touchStartLocation.current.x);
const dy = Math.abs(event.nativeEvent.pageY - touchStartLocation.current.y);
// If moved more than 1 pixels in any direction, consider it a drag
if (dx > 1 || dy > 1) {
// Reset touch tracking to prevent onPress from firing
touchStartTime.current = null;
touchStartLocation.current = null;
}
}
};
const handleTouchEnd = () => {
// Only trigger onPress if this was a quick tap (less than 200ms)
// and the touch hasn't moved significantly
if (touchStartTime.current && Date.now() - touchStartTime.current < 200) {
onPress?.();
}
touchStartTime.current = null;
touchStartLocation.current = null;
};
return (
<PressableWithoutFeedback
onTouchStart={handleTouchStart}
onTouchMove={handleTouchMove}
onTouchEnd={handleTouchEnd}
accessibilityLabel={accessibilityLabel}
accessibilityRole={accessibilityRole}
>
{children}
</PressableWithoutFeedback>
);
}; Then, replace the App/src/components/MapView/MapView.tsx Lines 320 to 328 in ec99650
<TouchableWrapper
onPress={toggleDistanceUnit}
accessibilityLabel={translate('common.distance')}
accessibilityRole={CONST.ROLE.BUTTON}
>
<View style={[styles.distanceLabelWrapper]}>
<Text style={styles.distanceLabelText}> {distanceLabelText}</Text>
</View>
</TouchableWrapper> Important Apply this change only for Android What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?We can write a unit test to cover the case:
What alternative solutions did you explore? (Optional)N/A |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.95-0
Reproducible in staging?: Yes
Reproducible in production?: Unable to check (New feature)
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both
If this was caught during regression testing, add the test name, ID and link from TestRail: #55517
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Device used: Samsung Galaxy Z Fold 4 / Android 14
App Component: Money Requests
Action Performed:
Expected Result:
The distance label will change from mile to kilometer or vice versa when tapped.
Actual Result:
The distance label does not change when tapped.
Workaround:
Unknown
Platforms:
Screenshots/Videos
https://utest-dl.s3-accelerate.amazonaws.com/12102/26469/491203/6735645/bugAttachment/Bug6735645_1738880567891%211738880241936_Screen_Recording_20250207_061628_Chrome.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20250207T020848Z&X-Amz-SignedHeaders=host&X-Amz-Credential=AKIAJ2UIWMJ2OMC3UCQQ%2F20250207%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Expires=86400&X-Amz-Signature=dac2a54db02eb81e8d48fdc8b2708d0e67edd5823ab77ff7be6674703f776af2
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @abdulrahuman5196The text was updated successfully, but these errors were encountered: