fix: Linear gradient border styles with BackgroundStyleApplicator#46084
Conversation
|
|
||
| @JvmStatic | ||
| public fun setBackgroundImage(view: View, gradients: Array<Gradient>?): Unit { | ||
| if (!gradients.isNullOrEmpty()) { |
There was a problem hiding this comment.
If input is null or empty we should clear any existing gradients
| ensureCSSBackground(view).color = color ?: Color.TRANSPARENT | ||
| } | ||
|
|
||
| @JvmStatic |
There was a problem hiding this comment.
- We might eventually support background images based on URI, in which case we’d need to change this public API. Can we design in a way that will be future proof to that? Like maybe having a type for background image layer, that can be gradient type now, and uri later?
- Can we accept by list instead of array for consistency?
| gradients[i] = new Gradient(gradientMap); | ||
| } | ||
| view.setGradients(gradients); | ||
| view.setBackgroundImage(gradients); |
There was a problem hiding this comment.
The greater context behind BackgroundStyleApplicator is that it works on any view (e.g. Text instead of just View). Once the flag has been enabled a bit longer, my plan has been to start moving all the setters to BaseViewMansger.
This is why the current view managers use BackgroundStyleApplicator directly when the gate is on, instead of calling through any specific underlying views.
|
@NickGerleman pushed all the mentioned changes. Thanks! |
|
@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@NickGerleman merged this pull request in 20e3f45. |
|
This pull request was successfully merged by @intergalacticspacehighway in 20e3f45 When will my fix make it into a release? | How to file a pick request? |
Summary:
Fix linear gradient borders with BackgroundStyleApplicator.
After fix
Changelog:
[ANDROID] [FIXED] - Linear gradient border styles
Test Plan:
Test border examples in LinearGradientExample.js