-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename and extend new maintain visible content position feature
Summary: Builds off of cae7179 - Make the prop a dictionary for more configuration options - Rename `maintainPositionAtOrBeyondIndex` -> `maintainVisibleContentPosition` + `minIndexForVisible` - Add autoscroll threshold feature Given the async native of RN JS and background layout, there is no way to trigger the scrollTo from JS without risking a delay, so we add the feature in native code. == Test Plan == ScrollViewExample: https://youtu.be/pmY8pxC9PRs Reviewed By: shergin Differential Revision: D6729160 fbshipit-source-id: 70f9bae460ce84567857a4f696da78ce9b3b834c
- Loading branch information
1 parent
7e7d00a
commit 65184ec
Showing
5 changed files
with
56 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @janicduplessis, @erictraut, @browniefed: y'all might be interested in this. Working on Android now.
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if you have any feedback on the API or anything.
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sahrens Nice, I'll have to implement proper pagination on comment threads to make use of this now 😀
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that depending on the application, you might want to use LayoutAnimation instead - e.g. tapping "show more" explicitly vs. automatically loading on scroll.
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sahrens any plans to integrate this into VirtualizedList somehow?
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It already works - FlatList and friends use ScrollView under the hood so almost all ScrollView features work out of the box.
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Will have to try it.
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a plan to implement it on Android soon?
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sahrens this is amazing, we tried to implement something similar but with no success..
Are you actively working on the Android solution? Is there a way to assist?
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sahrens Thank you very much for your solution, A better experience would be for the user to pull down to the top to load the history chat and the message won't beat, like
onEndReached
the effect of overlapping the bottom of the data is the same.65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking forward to the android version!!
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sahrens
maintainVisibleContentPosition={{ minIndexForVisible: 0, }}
isn't working for prepending the first set of data. It works well after that.65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sahrens I am running into the same issue with @bishalshr , I had reported the issue [FlatList] The
maintainVisibleContentPosition
doesn't work for the 1st time change. #19621 but nobody cares my complain.65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sahrens what can we do to help get this functionality into Android? This is a life-saver for the scrolling issue that we've been facing but we need it on Android as well!
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah actually this feature for android will be amazing, now our iOS app is using it and is really missed in android
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sahrens if you could just point us to the relevant code in Android then I'd be happy to take a look at it and see if I can make a PR. I'm just not sure where to start.
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy new year @sahrens ! We're digging in on figuring this out for Android but if you could give any of us any pointers on what you have already found that would be amazing. Thanks!
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry guys, there is no work planned here and I haven't looked into an Android solution. @janicduplessis or @kmagiera might be able to help out on Android though? I think they might have the most context on Android scrolling stuff.
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello all, do anyone resolved this for android somehow?
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+++ Need this for Android
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would love to see this functionality come to Android as well. Is anyone working on this currently?
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They clearly stated that this is not a priority for Facebook. I think if anyone wants to see this done, they'll need to work on a pull request.
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any workaround for prepending the first set of data (#19621) ?
Did anybody start to implement a solution for android?
65184ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@friedolinfoerder @chinalwb I got the #19621 on RN 0.60 too... Did you find workaround? @sahrens do you have plan to fix it?