Skip to content

Commit

Permalink
fix: check if its first render before updating from props
Browse files Browse the repository at this point in the history
  • Loading branch information
hannojg committed Jul 5, 2024
1 parent 5d4e106 commit 1d33c03
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions ios/MarkdownCommitHook.mm
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,12 @@
stateData.attributedStringBox);

// Handles the first render, where the text stored in props is
// different than the one stored in state The one in state is empty,
// while the one in props is passed from JS If we don't update the
// state here, we'll end up with a one-default-line-sized text
// input. A better condition to do that can be probably chosen, but
// this seems to work
// different than the one stored in state. The one in state is empty,
// while the one in props is passed from JS. If we don't update the
// state here, we'll end up with a one-default-line-sized text input
auto plainString =
std::string([[nsAttributedString string] UTF8String]);
if (plainString != textInputProps.text) {
if (textInputState.getRevision() == State::initialRevisionValue && plainString != textInputProps.text) {
// creates new AttributedString from props, adapted from
// TextInputShadowNode (ios one, text inputs are
// platform-specific)
Expand Down

0 comments on commit 1d33c03

Please sign in to comment.