Check initialIndex in callback (#3025)
This commit is contained in:
parent
ebe8d45711
commit
78bdf0e4e2
1 changed files with 3 additions and 6 deletions
|
|
@ -201,10 +201,8 @@ export default class PostList extends PureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
handleScrollToIndexFailed = () => {
|
handleScrollToIndexFailed = () => {
|
||||||
requestAnimationFrame(() => {
|
this.hasDoneInitialScroll = false;
|
||||||
this.hasDoneInitialScroll = false;
|
this.scrollToInitialIndexIfNeeded(1, 1);
|
||||||
this.scrollToInitialIndexIfNeeded(1, 1);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
handleSetScrollToBottom = () => {
|
handleSetScrollToBottom = () => {
|
||||||
|
|
@ -290,11 +288,10 @@ export default class PostList extends PureComponent {
|
||||||
if (
|
if (
|
||||||
width > 0 &&
|
width > 0 &&
|
||||||
height > 0 &&
|
height > 0 &&
|
||||||
this.props.initialIndex > 0 &&
|
|
||||||
!this.hasDoneInitialScroll
|
!this.hasDoneInitialScroll
|
||||||
) {
|
) {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
if (this.flatListRef?.current) {
|
if (this.props.initialIndex > 0 && this.flatListRef?.current) {
|
||||||
this.flatListRef.current.scrollToIndex({
|
this.flatListRef.current.scrollToIndex({
|
||||||
animated: false,
|
animated: false,
|
||||||
index: this.props.initialIndex,
|
index: this.props.initialIndex,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue