Skip to content

Conversation

@IvanIhnatsiuk
Copy link
Contributor

Summary

In this PR, I added foreground color style support for iOS. Currently, it allows changing color in any kind of style, and it uses the font tag to identify colored parts of attributed text from HTML. To track color in already colored styles, we need to check that the current location is in this style and the color is not the same as the configured one.

Also, I'm not sure about the onSelectionColor event, do we need to run it only when we're in the color style, or would it be better to do it always?

Test Plan

  1. Open an app
  2. Try to add any colored text
  3. Check the HTML output

Screenshots / Videos

Screen.Recording.2025-11-19.at.23.18.54.mov

Include any visual proof that helps reviewers understand the change — UI updates, bug reproduction or the result of the fix.

Compatibility

OS Implemented
iOS
Android

@IvanIhnatsiuk IvanIhnatsiuk changed the title feat: add foreground color style for iOS feat: add foreground color style on iOS Nov 20, 2025
@szydlovsky
Copy link
Collaborator

Hey @IvanIhnatsiuk, it's super nice to get such verbose contribution from the community! While the feature is potentially interesting for us we cannot really proceed with it for now; we want the API and new features to be working on both mobile platforms from the get-go. Either way, great work!

@IvanIhnatsiuk IvanIhnatsiuk force-pushed the feat/foreground-color-style-for-iOS branch 2 times, most recently from 2605503 to e3133c6 Compare November 27, 2025 09:59
@IvanIhnatsiuk IvanIhnatsiuk force-pushed the feat/foreground-color-style-for-iOS branch from 910ce22 to cae71fd Compare December 2, 2025 11:01
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.

I've added couple general comments. iOS part is still not reviewed.

Our main goal currently is to have consistent behavior and functionality between platforms. So I'm afraid we won't be able to ship that until Android part is implemented.
However, if this feature is something that community would like to see, we may consider implementing Android part ourselves

Copy link
Collaborator

Choose a reason for hiding this comment

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

Those changes seems completely unrelated to PR scope

Copy link
Collaborator

Choose a reason for hiding this comment

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

Redundant change

Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here, let's keep this comment

color: string;
};

const ColorPreview: React.FC<Props> = ({ color }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

As a convention, we do not rely on global variables. so FC should be imported from React

},
});

export default ColorPreview;
Copy link
Collaborator

Choose a reason for hiding this comment

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

As a convention, we use named exports

Comment on lines +21 to +27
const containerStyle = useMemo(
() => [
styles.container,
{ backgroundColor: isActive ? color : 'rgba(0, 26, 114, 0.8)' },
],
[isActive, color]
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

useMemo seems redundant here, it's simple computation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. I added this because of the warning about embedded styles.
  2. useMemo is useful here because it is an array that will create a new reference each time it is re-rendered and cause re-rendering in child components. Ideally, all values that arecallbacks, arrays and objects should be wrapped with useCallback/useMemo if you are not using react-compiler (sometimes even if you are using it).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Out of scope change

text: string,
payload: string
) => void;
toggleColor: (
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it should be rather called setColor, as we are explicitly passing color that should be used. We use toggle for two state styles (which is either enabled or disabled)

@IvanIhnatsiuk IvanIhnatsiuk force-pushed the feat/foreground-color-style-for-iOS branch from cae71fd to 910ce22 Compare December 5, 2025 21:37
@IvanIhnatsiuk IvanIhnatsiuk force-pushed the feat/foreground-color-style-for-iOS branch from 83c7f25 to 7e1cbde Compare December 5, 2025 22:20
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.

3 participants