-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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] [Search v2.2] - List does not scroll down and "To" field is hidden when "Save search" button appears #49257
Comments
Triggered auto assignment to @VictoriaExpensify ( |
Triggered auto assignment to @Gonals ( |
We think that this bug might be related to #wave-control |
👋 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:
|
Not a blocker, it's a minor UI bug. Putting the external label. |
Job added to Upwork: https://www.upwork.com/jobs/~021835635471984345939 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @akinwale ( |
Edited by proposal-police: This proposal was edited at 2023-10-09T08:43:00Z. ProposalPlease re-state the problem that we are trying to solve in this issue.List does not scroll down and "To" field is hidden when "Save search" button appears What is the root cause of that problem?After applying the App/src/pages/Search/AdvancedSearchFilters.tsx Lines 310 to 317 in 19d037b
What changes do you think we should make in order to solve the problem?We should calculate the current offset of the scroll and add the height of the // .src/pages/Search/AdvancedSearchFilters.tsx#L231
+ const {saveScrollOffset, getScrollOffset} = useContext(ScrollOffsetContext);
+ const route = useRoute();
+ const scrollViewRef = useRef<RNScrollView>(null);
+ const saveSearchRef = useRef<RefObject<View>>(null);
+ const onScroll = useCallback<NonNullable<ScrollViewProps['onScroll']>>((e) => {
+ if (e.nativeEvent.layoutMeasurement.height === 0) {
+ return;
+ }
+ saveScrollOffsetByName(route, e.nativeEvent.contentOffset.y);
+ }, []);
// .src/pages/Search/AdvancedSearchFilters.tsx#L289
+ function isScrollingPossible(scrollOffset: number | null): boolean {
+ return !!scrollOffset && !!scrollViewRef.current && !!saveSearchRef.current;
+ }
+ function measureAndScroll(scrollOffset: number, bufferHeight: number): void {
+ saveSearchRef.current?.measure((_, __, ___, height) => {
+ scrollViewRef.current?.scrollTo({
+ y: scrollOffset + height + bufferHeight,
+ animated: false,
+ });
+ });
+ }
// .src/pages/Search/AdvancedSearchFilters.tsx#L290
<ScrollView
+ ref={scrollViewRef}
+ onScroll={onScroll}
+ onLayout={() => {
+ const scrollOffset = getScrollOffsetByName(route);
+ if (!scrollOffset || !isScrollingPossible(scrollOffset)) {
+ return;
+ }
+ const BUFFER_HEIGHT = 16;
+ measureAndScroll(scrollOffset, BUFFER_HEIGHT);
+ }}
+ scrollEventThrottle={16}
contentContainerStyle={[styles.flexGrow1, styles.justifyContentBetween]}
>
// .src/pages/Search/AdvancedSearchFilters.tsx#L312
<Button
text={translate('search.saveSearch')}
onPress={onSaveSearch}
style={[styles.mh4, styles.mt4]}
large
+ ref={saveSearchRef}
/>
.src/components/ScrollOffsetContextProvider.tsx#L87
+ const saveScrollOffsetByName: ScrollOffsetContextValue['saveScrollOffsetByName'] = useCallback((name, scrollOffset) => {
+ scrollOffsetsRef.current[name] = scrollOffset;
+ }, []);
+ const getScrollOffsetByName: ScrollOffsetContextValue['getScrollOffsetByName'] = useCallback((name) => {
+ if (!scrollOffsetsRef.current) {
+ return;
+ }
+ return scrollOffsetsRef.current[name];
+ }, []);
+ const clearScrollOffsetByName: ScrollOffsetContextValue['clearScrollOffsetByName'] = useCallback((name) => {
+ if (!scrollOffsetsRef.current) {
+ return;
+ }
+ delete scrollOffsetsRef.current[name];
+ }, []);
// .src/components/ScrollOffsetContextProvider.tsx#L82
- if (!scrollOffsetkeysOfExistingScreens.includes(key)) {
+ if (
+ !scrollOffsetkeysOfExistingScreens.includes(key) &&
+ key !== ADVANCED_SEARCH_FILTER)
+ ) {
delete scrollOffsetsRef.current[key];
}
// .src/components/Search/index.tsx#L132
+ useFocusEffect(
+ useCallback(() => {
+ clearScrollOffsetByName(ADVANCED_SEARCH_FILTER);
+ }, []),
+ ); Here is test branch POC
Screen.Recording.2024-09-16.at.21.59.31.mov |
ProposalPlease re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
What changes do you think we should make in order to solve the problem?
<Button
text={translate('search.saveSearch')}
onPress={onSaveSearch}
style={[styles.mh4, styles.mt4]}
large
isDisabled={SearchUtils.isCannedSearchQuery(queryJSON)}
/> App/src/pages/Search/AdvancedSearchFilters.tsx Lines 310 to 317 in 1f66401
What alternative solutions did you explore? (Optional)Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job. |
ProposalPlease re-state the problem that we are trying to solve in this issue.List does not scroll down and "To" field is hidden when "Save search" button appears What is the root cause of that problem?The "Save search" button make scroll view layout change What changes do you think we should make in order to solve the problem?Auto-scroll to last visible position when layout changed <ScrollView
ref={scrollViewRef}
onLayout={(e) => {
const newPosition = positionRef.current - e.nativeEvent.layout.height;
if (newPosition < 0) {
return;
}
scrollViewRef.current?.scrollTo({
y: newPosition,
animated: false,
});
}}
onScroll={(e) => {
positionRef.current = e.nativeEvent.contentOffset.y + e.nativeEvent.layoutMeasurement.height;
}}
contentContainerStyle={[styles.flexGrow1, styles.justifyContentBetween]}
> What alternative solutions did you explore? (Optional)N/A |
Proposal update
|
Hey @akinwale - can you please review these proposals and let us know what you think? |
Note Here's the reason why I have recommended to always show the save button over the other approaches.(My Proposal)
https://github.com/user-attachments/assets/24e76771-4917-4157-a31d-8d58840ecfc2
|
Thank you for your note, @ChavdaSachin , + const onScroll = useCallback<NonNullable<ScrollViewProps['onScroll']>>((event) => {
+ const { layoutMeasurement, contentOffset, contentSize } = event.nativeEvent;
+ if (layoutMeasurement.height === 0) return;
+ const isAtBottom = layoutMeasurement.height + contentOffset.y >= contentSize.height;
+ if (isAtBottom) {
+ saveScrollOffsetByName(ADVANCED_SEARCH_FILTER, contentOffset.y);
+ } else {
+ getScrollOffsetByName(ADVANCED_SEARCH_FILTER) && clearScrollOffsetByName(ADVANCED_SEARCH_FILTER);
+ }
+}, []);
POC
Screen.Recording.2024-09-19.at.13.44.58.movcc @akinwale |
@huult let me help you with the test cases here.
Note Perform all of the above test with and without saving. |
@ChavdaSachin Could you post a test video of your proposed solution? |
Make Screen.Recording.2024-09-19.at.11.04.59.AM.mov |
@akinwale my solution does not need the steps I mentioned above. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
This is the expected behavior and not an issue. Closing this issue |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 9.0.35-4
Reproducible in staging?: Y
Reproducible in production?: N
Email or phone of affected tester (no customers): applausetester+kh010901@applause.expensifail.com
Issue reported by: Applause Internal Team
Action Performed:
Expected Result:
The list will auto scroll down to show "To" field when "Save search" button appears.
Actual Result:
The list does not auto scroll down and "To" field is hidden when "Save search" button appears.
Workaround:
Unknown
Platforms:
Screenshots/Videos
Bug6605317_1726482606930.20240916_182646.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @akinwaleThe text was updated successfully, but these errors were encountered: