-
Notifications
You must be signed in to change notification settings - Fork 22
feat: add foreground color style on iOS #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: add foreground color style on iOS #266
Conversation
|
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! |
2605503 to
e3133c6
Compare
910ce22 to
cae71fd
Compare
exploIF
left a comment
There was a problem hiding this 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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant change
There was a problem hiding this comment.
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 }) => { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
| const containerStyle = useMemo( | ||
| () => [ | ||
| styles.container, | ||
| { backgroundColor: isActive ? color : 'rgba(0, 26, 114, 0.8)' }, | ||
| ], | ||
| [isActive, color] | ||
| ); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I added this because of the warning about embedded styles.
- 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).
There was a problem hiding this comment.
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: ( |
There was a problem hiding this comment.
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)
cae71fd to
910ce22
Compare
83c7f25 to
7e1cbde
Compare
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
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