Skip to content

Conversation

@IvanIhnatsiuk
Copy link
Contributor

Description

If we change the HTML styles on Android, they will not be applied in any way until we first enter any styles. We also got a bug with the initial defaultValue, because everything started to depend on who was the first to be counted (it depends on who was the first to be passed from JS to the component).
Thus, I added the calculation of the lead when changing the HTML style on Android.

Videos

Before:

Screen.Recording.2025-11-07.at.19.24.38.mov
Screen.Recording.2025-11-07.at.19.16.29.mov

After:

Screen.Recording.2025-11-07.at.19.25.20.mov

@exploIF
Copy link
Collaborator

exploIF commented Nov 10, 2025

@IvanIhnatsiuk thanks for this, as this PR can have some impact on apps which are already using library, I would like to discuss this a little bit more. It would be super cool if you can catch up with me on discord (username exploif) or on x.com (username is linked in my profile )

Copy link
Collaborator

@exploIF exploIF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested how it works when htmlStyle is defined inside render? Even if it's memoized it can be re-rendered. I'm afraid it may not work properly in such scenario, because of pretty simple detection if html style has been updated

}
}

private fun reapplyTextWithNewStyles() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't exactly get main idea here. Why do we have to parse text twice just to update span styles? Isn't it enough to iterate over spans and update their style?

val currentSelectionStart = selectionStart
val currentSelectionEnd = selectionEnd

setText(newText)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect, for manually setting text we setValue, which also handles applying necessary listeners

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants