This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-16
Channels
- # announcements (33)
- # asami (37)
- # autochrome-github (1)
- # aws (5)
- # babashka (26)
- # babashka-sci-dev (18)
- # beginners (63)
- # biff (1)
- # calva (66)
- # cider (15)
- # clj-kondo (24)
- # cljs-dev (2)
- # cljsrn (14)
- # clojure (62)
- # clojure-doc (1)
- # clojure-europe (15)
- # clojure-nl (11)
- # clojure-spec (12)
- # clojure-uk (4)
- # clojurescript (45)
- # community-development (2)
- # cursive (34)
- # datahike (7)
- # datomic (7)
- # events (1)
- # figwheel-main (5)
- # fulcro (19)
- # gratitude (7)
- # holy-lambda (85)
- # hyperfiddle (4)
- # jobs (7)
- # jobs-discuss (25)
- # kaocha (4)
- # lsp (11)
- # off-topic (1)
- # polylith (20)
- # portal (14)
- # practicalli (6)
- # proletarian (5)
- # rdf (52)
- # re-frame (13)
- # reagent (48)
- # releases (1)
- # remote-jobs (3)
- # shadow-cljs (7)
- # tools-deps (17)
What approaches there are to find out why https://callstack.github.io/react-native-paper/text-input.html this is "flickering" when I do the basic adapt-react-class
to it and use re-frame subscription as the value and dispatch the value on-change-text? I've been able to get it to work properly if I use a functional component (reagent 1.1.0 feature) and use local hook state instead of re-frame. So – basically it seems to mount a new component every time instead of reusing the current when the value changes?e
So just doing
[:> TextInput
{:label (t/translate :company-mobile.login/username)
:value @username
:onChangeText (fn [t] (re/dispatch [::login/set-username t]))}]
causes the flickertry to remove the :value if i am not mistaken it should prevent constant re-rendering
Yeah, that might work but if we want to get the initial value through the subscription that does not work. It has the render
prop that can be used to give it a textfield to use – I'll try to use that.
I think the issue is the same as with web side when using material-ui we need to provide our own input field to it in order for it not to flicker
OK. I think I solved it 🙂 I just use
(fn [t]
(re/dispatch-sync (conj dispatch t))
(r/flush))
And the flickering stops@U45SLGVHV sure, removing :value works but if we want the field to be managed and use the value from the state it can't be removed. If eg. we have an initial value we want there then it's a hassle to get in
Try with :default-value
@U32ST9GR5 Re the pointers to default-value
above, see a full explanation here: https://increasinglyfunctional.com/2019/03/28/why-clojurescript-react-native-text-input-slow.html
Thanks all 🙂 I opted for the dispatch-sync & flush option since the component I'm using does not seem to have a default-value property (at least according to the docs) – and maybe I can provide my own textfield to the game but for now I'll stick to the first option