How to do Reactive.TextInput in React Native properly? #418
Unanswered
thiagobrez
asked this question in
Q&A
Replies: 1 comment
-
Fixed it by using a regular But I feel like it's a good discussion anyway since I couldn't really make it work with |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey! I believe I'm doing something wrong due to being very new to Legend State and observables, so I'd like to ask :)
I'm trying to render a list of
Reactive.TextInput
s, and every time you change the input, it syncs with Supabase using the available integration.The problem I have is that as the input auto-saves, the list items seem to re-render and the text value in the TextInput gets replaced, so you loose the text you were typing, and it becomes a very jarring UX.
This is what I have currently:
[id].tsx (an Expo Router page)
PostItem.tsx (list item)
I've tried different variations of this that I can't count anymore, with/without
observer
, with/without Supabaserealtime
, using the Memo component, etc.I've also tried removing the list entirely, and just rendering a single
Reactive.TextInput
to see if it would work correctly, but it didn't.I believe this is not a very uncommon use case, and I might be doing something very wrong that I'm not aware of.
Questions:
posts$
observable in the page component as I'm doing? I found no other better way since I need access to certain data to use infilter
<PostItem post$={posts$[item.id]} />
Any tips appreciated. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions