-
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
[HOLD for payment 2023-10-27] [$500] Focus does not shift directly from "Manual" option to "Distance" option #27563
Comments
ProposalPlease re-state the problem that we are trying to solve in this issue.Focus does not shift directly from "Manual" option to "Distance" option What is the root cause of that problem?App/src/components/TabSelector/TabSelector.js Lines 76 to 86 in b11bddc
In Screen.Recording.2023-09-10.at.4.52.45.PM.movAnd in this issue case, when we move from the tab index 0 to 2 by click, the tabs swipe horizontal and // tab 1 background
outputRange: _.map(inputRange, (i) => (i === tabIndex ? themeColors.midtone : themeColors.appBG)),
// the tab index is 1 so the result will be
outputRange: [themeColors.appBG, themeColors.midtone, themeColors.appBG] so while the swipe from tab 0 to tab 2 the tab 1 will flicker in the middle What changes do you think we should make in order to solve the problem?To fixing this issue without change any animation, we need to apply the animation to affected tabs only, and prevent other tab from changing its style. For example, while we move from tab1 to tab3 by click, the affected tabs are [tab1, tab3] only. For that we can do the following:
The animation outputRange will be // outputRange: _.map(inputRange, (i) => (i === tabIndex ? activeValue : inactiveValue))
outputRange: _.map(inputRange, (i) => (affectedTabs.includes(tabIndex) && i === tabIndex ? activeValue : inactiveValue)) when tab press set affected tabs = [currentTab, clickedTab] // using ref rather than state here to prevent any lags and the `TabSelector` will already re-render when navigation state change
affectedAnimatedTabs.current = [state.index, index]; reset affected tabs after transition end const [, reRender] = useReducer(x => !x, false);
const defaultAffectedAnimatedTabs = Array.from({length: state.routes.length}, (v, i) => i);
const affectedAnimatedTabs = useRef(defaultAffectedAnimatedTabs);
React.useEffect(() => {
setTimeout(() => {
affectedAnimatedTabs.current = defaultAffectedAnimatedTabs;
// re-render is important to re-defining opacity and background base on new affected tabs, to be ready for user swiping.
reRender();
}, CONST.ANIMATED_TRANSITION)
}, [state.index]); result20231005103606957.mp4old proposalI think using Solution 1: use translateX with const getTranslateX = (position, routesLength, TabWidth) => {
const inputRange = Array.from({length: routesLength}, (v, i) => i);
return position.interpolate({
inputRange,
outputRange: _.map(inputRange, (i) => i * TabWidth),
});
};
function TabSelector({state, navigation, onTabPress, position}) {
const {translate} = useLocalize();
const [width, setWidth] = React.useState(0);
const TabWidth = (width - 40) / state.routes.length;
return (
<View onLayout={(event)=> setWidth(event.nativeEvent.layout.width)} style={styles.tabSelector}>
<Animated.View
style={{
position : 'absolute',
width : TabWidth,
height : 40,
borderRadius : 20,
backgroundColor : themeColors.border,
transform: [{translateX: getTranslateX(position, state.routes.length, TabWidth)}]
}} />
{_.map(state.routes, (route, index) => {
...
return (
<TabSelectorItem
...
// activeOpacity={activeOpacity}
// inactiveOpacity={inactiveOpacity}
// backgroundColor={backgroundColor}
/>
);
... Screen.Recording.2023-09-10.at.5.46.31.PM.movSolution 2: use backgroundColor and opacity directly in props, this will work fine in clicks but not affected by slow swipe because there is no <TabSelectorItem
...
activeOpacity={isFocused ? 1 : 0}
inactiveOpacity={isFocused ? 0 : 1}
backgroundColor={isFocused ? themeColors.midtone : themeColors.appBG}
/> Screen.Recording.2023-09-10.at.6.01.44.PM.movWhat alternative solutions did you explore? (Optional)N/A |
Job added to Upwork: https://www.upwork.com/jobs/~01a90de5f335cc93e3 |
Triggered auto assignment to @sakluger ( |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to @sonialiap ( |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @burczu ( |
@Pluto0104 this issue not related to the mentioned issues above. |
I didn't mention that this issue is related to other problems. What I meant is that the underlying cause for all these problems is the module issue. If you don't update the module, you won't be able to fully resolve this issue. Furthermore, your proposed solution is incorrect. It only addresses the tab selector background color. You can observe that the tab content is misaligned when switching from 'manual' to "distance". |
@aldo-expensify @s77rt how do you think about this problem? |
I still disagree with you about this issue root cause, but let us wait for C+ to decide about that. |
Hey @ahmedGaber93, I noticed that I can still see this issue in your video demonstrating your solution. The issue is visible not only in the tab selector but also in the tab content. Please take a closer look. |
@Pluto0104 I think it's natural that the tab content gets visible for a brief moment since we are passing by it. The tab styling however feels broken, it feels like we go to step 2 stop for a brief moment then continue. The tab animation is from our side so I think we can fix that. The animation provided by @ahmedGaber93 in his first solution looks better but it's missing the opacity.
|
@s77rt should @ahmedGaber93 update their proposal to fix the opacity? |
Thanks @Pluto0104 for helping around. My opinion on this is that this is not a bug, I don't see a problem with the tab in the middle to become "focused" as we move from Distance to Manual. The example from the library page does exactly that: https://snack.expo.dev/?platform=web Screen.Recording.2023-09-18.at.5.56.01.PM.movOr am I getting it wrong what is described here as a bug? |
@aldo-expensify I think the example is just a fast demo for explanation, but famous apps don't do that. |
Ok. This might be a regression from this PR: #26022, but during the discussion in the issue we agreed not to change anything with animation while switching tabs, so I think this may not be a bug at all. |
Yes, I think so. But @shawnborton may be the best to ask about the expected behaviour here. |
@aldo-expensify The item being focused is okay I think (or not too much concerning) but the background pill feels broken on our App. In your linked video check the bottom blue bar, it scrolls smoothly, the background pill should do the same instead of partially fading. Check #27563 (comment) |
Ah interesting. I agree that it is weird that the middle tab gets a flash highlight when navigating to the outer tab. @AndrewGable I think you implemented this, any idea what is going on here? cc @neil-marcellini as well. |
In terms of expected behavior, yes, I would imagine clicking on a tab just highlights the new tab without highlighting the middle tab first |
Sounds good, reviewed! Assigning @ahmedGaber93 |
📣 @ahmedGaber93 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
📣 @aman-atg 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app! |
Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:
On to the next one 🚀 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.87-12 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2023-10-27. 🎊 After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue:
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
|
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
I completed payments for @aman-atg and @ahmedGaber93. @burczu do you mind completing the BZ checklist before we close the issue? Thanks! |
Trying to remove overdue, one more comment should do it. |
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
Thanks! |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
Expected Result:
The focus should seamlessly transition to "Distance" option
Actual Result:
The focus unexpectedly jumps to "Scan" option
Workaround:
Can the user still use Expensify without this being fixed? Have you informed them of the workaround?
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.70-5
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
81e4953d-72f3-4184-87df-691373f8670c.MP4
az_recorder_20230915_155305.1.mp4
Expensify/Expensify Issue URL:
Issue reported by: @aman-atg
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1694026046030719
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @saklugerThe text was updated successfully, but these errors were encountered: