Skip to content

Commit 33ef01d

Browse files
authored
fix: patch flashlist autoscroll behaviour (#3614)
## 🎯 Goal This is a forward fix of [this PR](#3609) towards V9. ## 🛠 Implementation details <!-- Provide a description of the implementation --> ## 🎨 UI Changes <!-- Add relevant screenshots --> <details> <summary>iOS</summary> <table> <thead> <tr> <td>Before</td> <td>After</td> </tr> </thead> <tbody> <tr> <td> <!--<img src="" /> --> </td> <td> <!--<img src="" /> --> </td> </tr> </tbody> </table> </details> <details> <summary>Android</summary> <table> <thead> <tr> <td>Before</td> <td>After</td> </tr> </thead> <tbody> <tr> <td> <!--<img src="" /> --> </td> <td> <!--<img src="" /> --> </td> </tr> </tbody> </table> </details> ## 🧪 Testing <!-- Explain how this change can be tested (or why it can't be tested) --> ## ☑️ Checklist - [ ] I have signed the [Stream CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) (required) - [ ] PR targets the `develop` branch - [ ] Documentation is updated - [ ] New code is tested in main example apps, including all possible scenarios - [ ] SampleApp iOS and Android - [ ] Expo iOS and Android
1 parent 5f72b09 commit 33ef01d

4 files changed

Lines changed: 133 additions & 10 deletions

File tree

examples/SampleApp/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"lint-fix": "eslint . --fix",
2222
"extract-changelog": "FILTER_PATH='examples/SampleApp' TAG_FORMAT=$npm_package_name'@v${version}' node ../../release/extract-changelog.js",
2323
"bootstrap": "yarn install",
24+
"postinstall": "patch-package",
2425
"release": "FILTER_PATH='examples/SampleApp' TAG_FORMAT=$npm_package_name'@v${version}' node ../../release/prod",
2526
"release-next": "echo \"Skipping next release for SampleApp\"",
2627
"test:unit": "echo \"Skipping unit tests for SampleApp\"",
@@ -102,6 +103,8 @@
102103
"eslint-plugin-react-hooks": "^5.2.0",
103104
"eslint-plugin-react-native": "^5.0.0",
104105
"jest": "^30.0.0",
106+
"patch-package": "^8.0.1",
107+
"postinstall-postinstall": "^2.1.0",
105108
"prettier": "^3.5.3",
106109
"react-test-renderer": "19.1.0",
107110
"typescript": "5.8.3",
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
diff --git a/node_modules/@shopify/flash-list/dist/recyclerview/hooks/useBoundDetection.js b/node_modules/@shopify/flash-list/dist/recyclerview/hooks/useBoundDetection.js
2+
index 767fc5d..f8d4644 100644
3+
--- a/node_modules/@shopify/flash-list/dist/recyclerview/hooks/useBoundDetection.js
4+
+++ b/node_modules/@shopify/flash-list/dist/recyclerview/hooks/useBoundDetection.js
5+
@@ -100,6 +100,14 @@ export function useBoundDetection(recyclerViewManager, scrollViewRef) {
6+
}
7+
}, [recyclerViewManager]);
8+
const runAutoScrollToBottomCheck = useCallback(() => {
9+
+ // Suppress MVCP autoscroll while a programmatic scrollToIndex is in
10+
+ // flight. FlashList disables offset projection at the start of
11+
+ // scrollToIndex and re-enables it ~200-300ms after settling. Without
12+
+ // this guard, the sticky pendingAutoscrollToBottom ref races against
13+
+ // scrollToIndex and fires scrollToEnd mid-flight.
14+
+ if (!recyclerViewManager.isOffsetProjectionEnabled) {
15+
+ return;
16+
+ }
17+
if (pendingAutoscrollToBottom.current) {
18+
pendingAutoscrollToBottom.current = false;
19+
requestAnimationFrame(() => {

examples/SampleApp/yarn.lock

Lines changed: 107 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3319,6 +3319,11 @@
33193319
resolved "https://registry.yarnpkg.com/@vscode/sudo-prompt/-/sudo-prompt-9.3.1.tgz#c562334bc6647733649fd42afc96c0eea8de3b65"
33203320
integrity sha512-9ORTwwS74VaTn38tNbQhsA5U44zkJfcb0BdTSyyG6frP4e8KMtHuTXYmwefe5dpL8XB1aGSIVTaLjD3BbWb5iA==
33213321

3322+
"@yarnpkg/lockfile@^1.1.0":
3323+
version "1.1.0"
3324+
resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31"
3325+
integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==
3326+
33223327
abort-controller@^3.0.0:
33233328
version "3.0.0"
33243329
resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392"
@@ -3935,7 +3940,7 @@ ci-info@^2.0.0:
39353940
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46"
39363941
integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==
39373942

3938-
ci-info@^3.2.0:
3943+
ci-info@^3.2.0, ci-info@^3.7.0:
39393944
version "3.9.0"
39403945
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4"
39413946
integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==
@@ -5036,6 +5041,13 @@ find-up@^5.0.0:
50365041
locate-path "^6.0.0"
50375042
path-exists "^4.0.0"
50385043

5044+
find-yarn-workspace-root@^2.0.0:
5045+
version "2.0.0"
5046+
resolved "https://registry.yarnpkg.com/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz#f47fb8d239c900eb78179aa81b66673eac88f7bd"
5047+
integrity sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==
5048+
dependencies:
5049+
micromatch "^4.0.2"
5050+
50395051
firebase@11.3.1:
50405052
version "11.3.1"
50415053
resolved "https://registry.yarnpkg.com/firebase/-/firebase-11.3.1.tgz#1507b2b1e3af17418fbe009e82d7bc30a6b5117c"
@@ -5150,6 +5162,15 @@ fresh@0.5.2:
51505162
resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7"
51515163
integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==
51525164

5165+
fs-extra@^10.0.0:
5166+
version "10.1.0"
5167+
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf"
5168+
integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==
5169+
dependencies:
5170+
graceful-fs "^4.2.0"
5171+
jsonfile "^6.0.1"
5172+
universalify "^2.0.0"
5173+
51535174
fs-extra@^8.1.0:
51545175
version "8.1.0"
51555176
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
@@ -5333,7 +5354,7 @@ gopd@^1.0.1, gopd@^1.2.0:
53335354
resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1"
53345355
integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==
53355356

5336-
graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.9:
5357+
graceful-fs@^4.1.11, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.9:
53375358
version "4.2.11"
53385359
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
53395360
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==
@@ -6421,6 +6442,17 @@ json-stable-stringify-without-jsonify@^1.0.1:
64216442
resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"
64226443
integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==
64236444

6445+
json-stable-stringify@^1.0.2:
6446+
version "1.3.0"
6447+
resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.3.0.tgz#8903cfac42ea1a0f97f35d63a4ce0518f0cc6a70"
6448+
integrity sha512-qtYiSSFlwot9XHtF9bD9c7rwKjr+RecWT//ZnPvSmEjpV5mmPOCN4j8UjY5hbjNkOwZ/jQv3J6R1/pL7RwgMsg==
6449+
dependencies:
6450+
call-bind "^1.0.8"
6451+
call-bound "^1.0.4"
6452+
isarray "^2.0.5"
6453+
jsonify "^0.0.1"
6454+
object-keys "^1.1.1"
6455+
64246456
json5@^2.2.3:
64256457
version "2.2.3"
64266458
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
@@ -6433,6 +6465,20 @@ jsonfile@^4.0.0:
64336465
optionalDependencies:
64346466
graceful-fs "^4.1.6"
64356467

6468+
jsonfile@^6.0.1:
6469+
version "6.2.1"
6470+
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.2.1.tgz#b6e31717f22cc37330b081ce0051ed5de53af2f6"
6471+
integrity sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==
6472+
dependencies:
6473+
universalify "^2.0.0"
6474+
optionalDependencies:
6475+
graceful-fs "^4.1.6"
6476+
6477+
jsonify@^0.0.1:
6478+
version "0.0.1"
6479+
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.1.tgz#2aa3111dae3d34a0f151c63f3a45d995d9420978"
6480+
integrity sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==
6481+
64366482
jsonwebtoken@^9.0.2:
64376483
version "9.0.2"
64386484
resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz#65ff91f4abef1784697d40952bb1998c504caaf3"
@@ -6516,6 +6562,13 @@ keyv@^4.5.4:
65166562
dependencies:
65176563
json-buffer "3.0.1"
65186564

6565+
klaw-sync@^6.0.0:
6566+
version "6.0.0"
6567+
resolved "https://registry.yarnpkg.com/klaw-sync/-/klaw-sync-6.0.0.tgz#1fd2cfd56ebb6250181114f0a581167099c2b28c"
6568+
integrity sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==
6569+
dependencies:
6570+
graceful-fs "^4.1.11"
6571+
65196572
kleur@^3.0.3:
65206573
version "3.0.3"
65216574
resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"
@@ -6948,7 +7001,7 @@ metro@0.83.5, metro@^0.83.1:
69487001
ws "^7.5.10"
69497002
yargs "^17.6.2"
69507003

6951-
micromatch@^4.0.0, micromatch@^4.0.4, micromatch@^4.0.8:
7004+
micromatch@^4.0.0, micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.8:
69527005
version "4.0.8"
69537006
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202"
69547007
integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==
@@ -7019,6 +7072,11 @@ minimatch@^9.0.4:
70197072
dependencies:
70207073
brace-expansion "^2.0.1"
70217074

7075+
minimist@^1.2.6:
7076+
version "1.2.8"
7077+
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
7078+
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
7079+
70227080
"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.1.2:
70237081
version "7.1.2"
70247082
resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707"
@@ -7236,7 +7294,7 @@ open@^6.2.0:
72367294
dependencies:
72377295
is-wsl "^1.1.0"
72387296

7239-
open@^7.0.3:
7297+
open@^7.0.3, open@^7.4.2:
72407298
version "7.4.2"
72417299
resolved "https://registry.yarnpkg.com/open/-/open-7.4.2.tgz#b8147e26dcf3e426316c730089fd71edd29c2321"
72427300
integrity sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==
@@ -7340,6 +7398,26 @@ parseurl@~1.3.3:
73407398
resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4"
73417399
integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==
73427400

7401+
patch-package@^8.0.1:
7402+
version "8.0.1"
7403+
resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-8.0.1.tgz#79d02f953f711e06d1f8949c8a13e5d3d7ba1a60"
7404+
integrity sha512-VsKRIA8f5uqHQ7NGhwIna6Bx6D9s/1iXlA1hthBVBEbkq+t4kXD0HHt+rJhf/Z+Ci0F/HCB2hvn0qLdLG+Qxlw==
7405+
dependencies:
7406+
"@yarnpkg/lockfile" "^1.1.0"
7407+
chalk "^4.1.2"
7408+
ci-info "^3.7.0"
7409+
cross-spawn "^7.0.3"
7410+
find-yarn-workspace-root "^2.0.0"
7411+
fs-extra "^10.0.0"
7412+
json-stable-stringify "^1.0.2"
7413+
klaw-sync "^6.0.0"
7414+
minimist "^1.2.6"
7415+
open "^7.4.2"
7416+
semver "^7.5.3"
7417+
slash "^2.0.0"
7418+
tmp "^0.2.4"
7419+
yaml "^2.2.2"
7420+
73437421
path-exists@^4.0.0:
73447422
version "4.0.0"
73457423
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
@@ -7418,6 +7496,11 @@ possible-typed-array-names@^1.0.0:
74187496
resolved "https://registry.yarnpkg.com/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz#93e3582bc0e5426586d9d07b79ee40fc841de4ae"
74197497
integrity sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==
74207498

7499+
postinstall-postinstall@^2.1.0:
7500+
version "2.1.0"
7501+
resolved "https://registry.yarnpkg.com/postinstall-postinstall/-/postinstall-postinstall-2.1.0.tgz#4f7f77441ef539d1512c40bd04c71b06a4704ca3"
7502+
integrity sha512-7hQX6ZlZXIoRiWNrbMQaLzUUfH+sSx39u8EJ9HYuDc1kLo9IXKWjM5RSquZN1ad5GnH8CGFM78fsAAQi3OKEEQ==
7503+
74217504
prelude-ls@^1.2.1:
74227505
version "1.2.1"
74237506
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
@@ -8184,6 +8267,11 @@ sisteransi@^1.0.5:
81848267
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed"
81858268
integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==
81868269

8270+
slash@^2.0.0:
8271+
version "2.0.0"
8272+
resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44"
8273+
integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==
8274+
81878275
slash@^3.0.0:
81888276
version "3.0.0"
81898277
resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
@@ -8530,6 +8618,11 @@ throat@^5.0.0:
85308618
resolved "https://registry.yarnpkg.com/throat/-/throat-5.0.0.tgz#c5199235803aad18754a667d659b5e72ce16764b"
85318619
integrity sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==
85328620

8621+
tmp@^0.2.4:
8622+
version "0.2.5"
8623+
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.5.tgz#b06bcd23f0f3c8357b426891726d16015abfd8f8"
8624+
integrity sha512-voyz6MApa1rQGUxT3E+BK7/ROe8itEx7vD8/HEvt4xwXucvQ5G5oeEiHkmHZJuBO21RpOf+YYm9MOivj709jow==
8625+
85338626
tmpl@1.0.5:
85348627
version "1.0.5"
85358628
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc"
@@ -8716,6 +8809,11 @@ universalify@^0.1.0:
87168809
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
87178810
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==
87188811

8812+
universalify@^2.0.0:
8813+
version "2.0.1"
8814+
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d"
8815+
integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==
8816+
87198817
unpipe@1.0.0, unpipe@~1.0.0:
87208818
version "1.0.0"
87218819
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
@@ -9034,6 +9132,11 @@ yaml@^2.2.1:
90349132
resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.7.0.tgz#aef9bb617a64c937a9a748803786ad8d3ffe1e98"
90359133
integrity sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA==
90369134

9135+
yaml@^2.2.2:
9136+
version "2.9.0"
9137+
resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.9.0.tgz#78274afd93598a1dfdd6130df6a566defcbf9aa4"
9138+
integrity sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==
9139+
90379140
yaml@^2.6.1:
90389141
version "2.8.3"
90399142
resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.8.3.tgz#a0d6bd2efb3dd03c59370223701834e60409bd7d"

package/src/components/MessageList/MessageFlashList.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
431431
if (indexOfParentInMessageList === -1) {
432432
loadChannelAroundMessage({ messageId: targetedMessage, setTargetedMessage });
433433
} else {
434-
scrollToDebounceTimeoutRef.current = setTimeout(() => {
434+
scrollToDebounceTimeoutRef.current = setTimeout(async () => {
435435
clearTimeout(scrollToDebounceTimeoutRef.current);
436436

437437
const scrollToIndex = async () => {
@@ -442,20 +442,18 @@ const MessageFlashListWithContext = (props: MessageFlashListPropsWithContext) =>
442442
}
443443

444444
await list.scrollToIndex({
445-
index: indexOfParentInMessageList,
446445
animated: true,
446+
index: indexOfParentInMessageList,
447447
viewPosition: 0.5,
448448
});
449449

450450
return true;
451451
};
452452

453+
await scrollToIndex();
453454
requestAnimationFrame(async () => {
454455
await scrollToIndex();
455-
requestAnimationFrame(async () => {
456-
await scrollToIndex();
457-
setTargetedMessage(undefined);
458-
});
456+
setTargetedMessage(undefined);
459457
});
460458
}, WAIT_FOR_SCROLL_TIMEOUT);
461459
}

0 commit comments

Comments
 (0)