-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
[iOS] Opacity prop of Text applies double times. #24229
Comments
cc @ericlewis |
I think the problem exists in text attributes file where |
@lukewalczak Perhaps you're right. Would you mind sending a PR with your proposal? |
Another angle to look at this would be how we solved semi-transparent backgrounds here: #23872 It’s likely we can apply a similar solution for opacities. |
Hmm, but what can be the reason to keep that |
@lukewalczak indeed, the multiplication does seem like a mistake that probably needs to be fixed. If it addresses the issue at hand then cool. I can open a PR if you like, it’s a relatively simple thing to test. |
Seems like the * was meant to be a comment like the rest, just bad copy paste or something. |
I've also tested your approach and setting the initial value for |
@lukewalczak Nice, both solutions solve the problem. Thanks for work. |
Let's discuss that in a PR! |
Unfortunately, the solution above is fixing the problem only for |
I reread everything one more time, and now I actually think that iOS behavior is correct, and Android one is not. @PaxLyj From the code example in the description is not clear which kind of nesting of components we have, can you improve the example? @ericlewis, @lukewalczak What makes you think that we should NOT multiply |
cc @rigdern |
Oh, I see now, the issue is not about nested text components at all! So, the solution should be pretty simple, we should just add Who wants to contribute? 😉 |
@lukewalczak Well, you may thought that text with color: '#000000',
backgroundColor: '#ff0000',
opacity: 0.5, and I think it's reasonable that applying opacity to On the other hand, the text components of both |
Summary: This PR fixes #24229. Seems currently `opacity` props for Text is being applied twice (one for text color and one for the whole view). This PR disables applying the prop to the text. [CATEGORY] [TYPE] - Fixed double applying opacity prop for Text Pull Request resolved: #24435 Differential Revision: D14932795 Pulled By: cpojer fbshipit-source-id: f9280fc75f788424cb5f1e42d2e79efdb354d645
🐛 Bug Report
On iOS,
Text
component with style propopacity
applies twice.It seems the base class of
RCTTextView
isRCTView
, and it causes the style propopacity
applies double times toRCTTevtView
.Roughly, delete this line in
RCTBaseTextViewManager.m
fix this issue.To Reproduce
Expected Behavior
It should be rendered as same as Android (right image above).
Code Example
https://snack.expo.io/Hy8RhMkYN
In iOS environment, compare the rendered colors of Text component with style
{ opacity: 0.5 }
and{ color: 'rgba(0, 0, 0, 0.25)' }
- those are seems same.Environment
The text was updated successfully, but these errors were encountered: