Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Fix TextInput selection crash and feedback loop",
"packageName": "react-native-windows",
"email": "74712637+iamAbhi-916@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -1225,8 +1225,11 @@ void WindowsTextInputComponentView::updateState(
if (m_mostRecentEventCount == m_state->getData().mostRecentEventCount) {
m_comingFromState = true;
auto &fragments = m_state->getData().attributedStringBox.getValue().getFragments();
UpdateText(fragments.size() ? fragments[0].string : "");

{
// DrawBlock defers DrawText() until after UpdateText completes
DrawBlock db(*this);
UpdateText(fragments.size() ? fragments[0].string : "");
}
m_comingFromState = false;
}
}
Expand Down Expand Up @@ -1375,7 +1378,7 @@ void WindowsTextInputComponentView::EmitOnScrollEvent() noexcept {
}

void WindowsTextInputComponentView::OnSelectionChanged(LONG start, LONG end) noexcept {
if (m_eventEmitter && !m_comingFromState /* && !m_comingFromJS ?? */) {
if (m_eventEmitter && !m_comingFromState && !m_comingFromJS) {
auto emitter = std::static_pointer_cast<const facebook::react::WindowsTextInputEventEmitter>(m_eventEmitter);
facebook::react::WindowsTextInputEventEmitter::OnSelectionChange onSelectionChangeArgs;
onSelectionChangeArgs.selection.start = start;
Expand Down
Loading