Skip to content

Commit ddeaa1c

Browse files
hryhoriiK97claude
andcommitted
Compare with the last drawn state
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 6d5de49 commit ddeaa1c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,10 @@ - (void)updateState:(const State::Shared &)state oldState:(const State::Shared &
150150
// string records fragment layout metrics); redraw only when content or
151151
// paragraph attributes changed. Attachments are sized from those metrics.
152152
BOOL needsDisplay = YES;
153-
if (newState && oldState && _textView.state) {
153+
if (newState && _textView.state) {
154154
const auto &newData = newState->getData();
155-
const auto &oldData = std::static_pointer_cast<const ParagraphShadowNode::ConcreteState>(oldState)->getData();
155+
// Compare with the state the view last drew, which recycling can make differ from `oldState`.
156+
const auto &oldData = _textView.state->getData();
156157
needsDisplay = !newData.attributedString.isContentEqual(oldData.attributedString) ||
157158
newData.paragraphAttributes != oldData.paragraphAttributes ||
158159
RCTAttributedStringHasAttachments(newData.attributedString);

0 commit comments

Comments
 (0)