Replies: 3 comments 11 replies
-
|
This bug is a big problem for AI chat apps right now: facebook/react-native#54123 |
Beta Was this translation helpful? Give feedback.
-
|
Hey @trcoffman Thank you for raising such a detailed issue! Appreciate the effort ❤️
Yes, you are right.
Not sure if I get it correctly, don't you mind to elaborate a little bit more? I read blogpost and I think a correct flow would be adding a property like So I think theoretically we could add another property to In fact I already experimenting with that here: #1332 I added new property
At the moment it solves a problem of auto-scroll when input grows: Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-02-28.at.00.22.26.movBut I'm just curious - can we utilize similar approach or maybe re-use this functionality partially? Because from the underlying mechanism everything looks very similar: extend Anyway, let me know what do you think about this 😊 |
Beta Was this translation helpful? Give feedback.
-
|
Closing because #1344 has been merged! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
On twitter you requested that I raise this as a feature request github issue, so here I am. I don't have a clear feature request yet so I started a discussion instead.
I'm not yet certain if any changes are even needed to KeyboardChatScrollView to facilitate this. I'm just getting the discussion started on how best to achieve this UX in react-native.
Is your feature request related to a problem? Please describe.
All of the top AI Chat apps push new user messages to the top of the screen to allow plenty of screen real estate for the AI response to stream in without layout shifting during streaming.
https://vercel.com/blog/how-we-built-the-v0-ios-app#sending-messages-in-an-existing-chat
ScreenRecording_02-27-2026.09-50-31_1.MP4
Describe the solution you'd like
I am not sure yet what the solution is now that KeyboardChatScrollView has arrived. Before KeyboardChatScrollView arrived, I managed to get this working in LegendList by modifying the previous version of KeyboardAvoidingLegendList. It's been updated to use KeyboardChatScrollView so I need to experiment again to see if I can adapt my solution to KeyboardChatScrollView.
My previous solution involved hooking into LegendList's
onItemSizeChangedcallback, and then I wouldgetState()on the list in that callback so that I could access all the sizes of the list items and compute the contentInset that would position the latest user message at the top of the screen.The KeyboardChatScrollView isn't really aware of individual 'messages'. That seems more in the domain of something like the KeyboardAvoidingLegendList that wraps it.
But perhaps KeyboardChatScrollView could perhaps be smart enough such that if it receives a contentInset greater than the height of the keyboard, it doesn't add additional contentInset?
It's not yet clear to me if any changes are actually needed in KeyboardChatScrollView, so I'll be investigating this. It seems to me more like something that should be added to KeyboardAvoidingLegendList, like a prop called
insetItemAtIndexortopItemIndex(i do not love either name) that adds extra contentInset to make sure that if you scroll to the bottom that item renders at the top of the screen. This is what I implemented before KeyboardAvoidingLegendList moved to KeyboardChatScrollView.Describe alternatives you've considered
The alternative solution is to not use KeyboardChatScrollView and instead use my own fork of the old KeyboardAvoidingLegendList, but on android use ClippingScrollViewDecorator instead of the unholy hacks i came up with to make this work with padding on the contentContainerStyle.
Here's a screen recording of what I came up with before KeyboardChatScrollView was released. It relies on timeouts to scroll to end 200ms after adding the new user message. Not really sure how exactly to know when to scroll to end without just guessing about an arbitrary timeout value which I don't love.
ScreenRecording_02-27-2026.10-44-50_1.MP4
I'll try to adapt it to the new KeyboardChatScrollView version of KeyboardAvoidingLegendList, but @kirillzyusko I'd love to know your thoughts on this.
Beta Was this translation helpful? Give feedback.
All reactions