Fork me on GitHub

I just tried parinfer for the first time


it's a completely different experience dealing with lisp code. I thought slurping and barfing is the way to go but man is parinfer good


Does anybody know the React Native way to restore UI controls' values (e.g., textinput text) upon changing back to a previous screen? I tried setting 'value' but then the cursor gets moved to before the beginning of the text after each character the user actually enters in the box [as there's no way to determine if the current render cycle is due to a) changing back to the screen from another 'modal'/popup if you will or b) the user actually entering text]). I tried a workaround where I kept some side state in another atom (that isn't being observed by Om Next) to store whether a screen change was occurring or not and that worked but only for the first render cycle-- if the user did something else on the page after changing back to the screen (like say checking a checkbox), then the side state had been cleared and my logic didn't set the 'value' of the textinput to that stored in app-state.


Looks like this issue may be related (but also seems kinda bizarre that I'd hit this issue for such a basic thing as this):


There's also this warning on the doc for TextInput itself:

The value to show for the text input. TextInput is a controlled component, which means the native value will be forced to match this value prop if provided. For most uses this works great, but in some cases this may cause flickering - one common cause is preventing edits by keeping value the same. In addition to simply setting the same value, either set editable={false}, or set/update maxLength to prevent unwanted edits without flicker.


Maybe the opposite of my workaround will work: set a flag in the onChange of the textinput and don't set 'value' of the textinput in only that case (but set it on all others-- including a full screen/view change).