. This works perfectly fine, but, It's only re-evaluated during a change in text layout and moving the cursor doesn't trigger that. So a solution I could think of is forcefully trigger
onTextLayout
on each change of cursor; but I don't know how and plus, it's probably inefficient and definitely hacky. Can anyone provide another solution or maybe an idea for triggering
onTextLayout
?
👀 1
z
Zach Klippenstein (he/him) [MOD]
10/04/2022, 10:47 AM
Just take what you’re doing and run the calculation inside the
snapshotFlow
function - assuming your
textFieldValue
and
textLayoutResult
are stored in snapshot state objects, that should trigger a recalculation whenever either of them change.