-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
bug: infinite-scroll with position="top" causes flicker when restoring scroll position #28182
Comments
Thank you for the issue. Can you give details on your use case for reversing the content's direction? |
When creating a chat for example. We could have a footer where we put in a text and in the ion content we may only have messages. When the ion-content is reversed, the messages will also be shown reversed, also the scrollbar will automatically be at the end. |
Thank you, that makes sense. I am able to replicate the described behavior, but it sounds like a better fit for your use case would be to use the One way to accomplish this pattern would be to place the infinite scroll element at the top of the content, then wrap the chat items in a separate element and apply Can you give that pattern a try and let me know if it works for your use case? |
Thank you for checking. I won't be able to check this this weekend. Sorry for that, monday I can check if this works for my use case. |
I have checked your solution. There are a few things that do not work as I expect.
|
For item 1, could you provide a Stackblitz link or Github repo demonstrating this? You can use another For item 2, I was able to replicate that behavior by scrolling fast enough, but it also occurs with |
Thank you for looking! |
Apologies for the delay; I'm able to replicate item 1 but I'm still digging into what the best fix would be. For item 2, we now have #18071 to track that, so I'll use this issue solely to track item 1. |
Alright, so, the solution to item 1 is to call There are a few notable pieces to this:
Can you see if this pattern works for you? Let me know if you have any questions. |
Thank you for further looking into the problem. It seems to work now. But it seems that there are two things that I don't like about this approach.
|
Using As for the flicker, we may be able to improve the experience there. I'll update this issue to track investigating that, and we'll let you know when we have more to share. |
I know that the calculation of the position bottom is different from the top one. But I created a simple infinite scroll based on the Ionic infinite scroll code. What I noticed is that the calculation for the bottom position is fine when used with If the flicker can be resolved that would also be great! |
Applying Therefore, I suggest Ionic team to add a property to |
Having the same problem right here. +1 |
Prerequisites
Ionic Framework Version
v4.x, v5.x, v6.x, v7.x
Current Behavior
When using the
ion-infinite-scroll
element in anion-content
element that has styling todisplay: flex
andflex-direction: column-reverse
. The ionInfinite emitter will never be triggered.Expected Behavior
I expect that the ion-infinite-scroll emitter to be called like normal when position is bottom. Because when column-reverse is used the bottom is the top, so I think the ion-infinite-scroll element should account for that.
Steps to Reproduce
Code Reproduction URL
No response
Ionic Info
Ionic:
Ionic CLI : 7.1.1
Ionic Framework : @ionic/angular 7.2.3
@angular-devkit/build-angular : 16.2.0
@angular-devkit/schematics : 16.2.0
@angular/cli : 16.2.0
@ionic/angular-toolkit : 9.0.0
Capacitor:
Capacitor CLI : 5.1.1
@capacitor/android : 5.1.1
@capacitor/core : 5.1.1
@capacitor/ios : 5.1.1
Utility:
cordova-res : not installed globally
native-run : 1.7.2
System:
NodeJS : v16.19.0
npm : 8.19.3
OS : macOS Unknown
Additional Information
The scrollTop of the scrollElement is negative in the infinite scroll element. That is why the distanceFromInfinite is not correctly determined. What we could do, is use the absolute value of the scrollTop value. When this is implemented bottom position will work when flex-direction: column-reverse is used.
The text was updated successfully, but these errors were encountered: