-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Adding fix for Manual set value clearTextOnSubmit-style behavior not working on Fabric #15277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a regression in TextInput behavior between Paper and Fabric architectures where manual value clearing on submit (clearTextOnSubmit-style behavior) was not working correctly. The issue occurred when JavaScript immediately updated the text value during onSubmitEditing, causing synchronization problems between native and JS state.
Key Changes:
- Modified event count validation to accept immediate JS updates by changing the condition from
eventCount >= m_nativeEventCounttoeventCount >= m_nativeEventCount - 1 - Added state synchronization when clearing text to ensure React state stays consistent with native TextInput state
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp |
Modified event count check and added state update logic when clearing text on submit |
change/react-native-windows-daac39ef-4292-4f66-81ae-708b1c0f6676.json |
Added change file for versioning |
vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp
Outdated
Show resolved
Hide resolved
change/react-native-windows-daac39ef-4292-4f66-81ae-708b1c0f6676.json
Outdated
Show resolved
Hide resolved
…76.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
In the video when you pressed enter in last text input why did it have the value "backslash" instead of empty? |
I pressed back slash key by mistake after pressing enter from my keyboard |
vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp
Outdated
Show resolved
Hide resolved
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Okay can you please re-record and attach correct before and after videos? |
|
Description Summary missing in the end. |
|
E2ETestAppFabric Unit Test verification? |
vnext/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp
Outdated
Show resolved
Hide resolved
reuploaded before and after videos |
Added in next commit |
It's already there in description |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
91e1cdd to
2068ef7
Compare
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
ebb1b41 to
73dc3d1
Compare
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
07a9743 to
877fd6a
Compare
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
4fdf14e to
b1ef624
Compare
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
3f9b801 to
802abdf
Compare
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
This same issue seems to repro on iOS. So I think we can wont fix this issue. |
Description
TextInput regression between Paper and Fabric: Manual set value clearTextOnSubmit-style behavior not working
Type of Change
Why
The issue is that JavaScript receives onSubmitEditing with eventCount N, but when it immediately calls setValue(''), native has already moved to N+1, so the JS command gets rejected. This causes mismatch between JS and Native side
Resolves [https://github.com//issues/15168]
What
The issue is that JavaScript receives onSubmitEditing with eventCount N, but when it immediately calls setValue('') native has already moved to N+1, so the JS command gets rejected. To fix the issue the solution taken is don't increment the event count until AFTER the JavaScript has had a chance to respond to the submit event.
Screenshots
Before
15168-before.mp4
After
15168-after.mp4
Testing
yarn build passed successfully, added a sample textInput field in RNTester-Fabric app to repro the issue.
Ran E2ETestAppFabric Unit Test

Changelog
Should this change be included in the release notes: yes
Added synchroinization logic betwwen JS and native layer onClearSubmit is not working
Microsoft Reviewers: Open in CodeFlow
Microsoft Reviewers: Open in CodeFlow