Ali Khaleqi Yekta
10/03/2022, 5:06 AMBasicTextField
.
A solution I'm currently using is using the onTextLayout
callback and from there, accessing textLayoutResult.getCursorRect(textFieldValue.selection.end).top
. 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
?Zach Klippenstein (he/him) [MOD]
10/04/2022, 10:47 AMsnapshotFlow
function - assuming your textFieldValue
and textLayoutResult
are stored in snapshot state objects, that should trigger a recalculation whenever either of them change.