mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Comparison of AttributedString false more often than true in TextInput, resulting in janky editing behavior
Summary: Instead of comparing the entire AttributedString, compare just the strings and the TextAttributes of Fragments. Concretely what I'm seeing is that the Frame of the associated parent ShadowViews are changing very frequently, making it impossible to actually modify the TextInput in some cases. However, we shouldn't forcibly reset the content of the TextInput if the frame of the parent is changing and not the actual child contents. Changelog: [Internal] Fabric TextInput bug fix Reviewed By: shergin Differential Revision: D20319359 fbshipit-source-id: 2f51f521ad76fff9da6f6c8b5e795f03c33e496f
This commit is contained in:
committed by
Facebook Github Bot
parent
074a2fab74
commit
c18cc76e58
+10
-3
@@ -94,10 +94,17 @@ AttributedString AndroidTextInputShadowNode::getMostRecentAttributedString()
|
||||
|
||||
auto reactTreeAttributedString = getAttributedString();
|
||||
|
||||
// Sometimes the treeAttributedString will only differ from the state
|
||||
// not by inherent properties (string or prop attributes), but by the frame of
|
||||
// the parent which has changed Thus, we can't directly compare the entire
|
||||
// AttributedString
|
||||
bool treeAttributedStringChanged =
|
||||
!state.reactTreeAttributedString.compareTextAttributesWithoutFrame(
|
||||
reactTreeAttributedString);
|
||||
|
||||
return (
|
||||
state.reactTreeAttributedString == reactTreeAttributedString
|
||||
? state.attributedString
|
||||
: reactTreeAttributedString);
|
||||
!treeAttributedStringChanged ? state.attributedString
|
||||
: reactTreeAttributedString);
|
||||
}
|
||||
|
||||
void AndroidTextInputShadowNode::updateStateIfNeeded() {
|
||||
|
||||
Reference in New Issue
Block a user