mirror of
https://github.com/status-im/react-native.git
synced 2025-03-01 09:30:33 +00:00
Fix slider colors in Android
Summary: Hey ! I noticed that the `minimumTrackTintColor` and `maximumTrackTintColor` are exchanged in iOS and Android. In iOS, `minimumTrackTintColor` is the left color and `maximumTrackTintColor` is the right color. In Android, `minimumTrackTintColor` is the right color and `maximumTrackTintColor` is the left color. With this code : ```jsx <Slider style={{ width: 300 }} minimumTrackTintColor="red" maximumTrackTintColor="blue" /> ``` |iOS|Android| |----|----| ||| |iOS|Android| |----|----| | (same)|| Closes https://github.com/facebook/react-native/pull/16053 Differential Revision: D5910299 Pulled By: shergin fbshipit-source-id: 74851e4cc6d54f72ea2755200e26b0d921890b48
This commit is contained in:
parent
979629504b
commit
31904d523d
@ -160,22 +160,22 @@ public class ReactSliderManager extends SimpleViewManager<ReactSlider> {
|
||||
@ReactProp(name = "minimumTrackTintColor", customType = "Color")
|
||||
public void setMinimumTrackTintColor(ReactSlider view, Integer color) {
|
||||
LayerDrawable drawable = (LayerDrawable) view.getProgressDrawable().getCurrent();
|
||||
Drawable background = drawable.findDrawableByLayerId(android.R.id.background);
|
||||
Drawable progress = drawable.findDrawableByLayerId(android.R.id.progress);
|
||||
if (color == null) {
|
||||
background.clearColorFilter();
|
||||
progress.clearColorFilter();
|
||||
} else {
|
||||
background.setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
||||
progress.setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
}
|
||||
|
||||
@ReactProp(name = "maximumTrackTintColor", customType = "Color")
|
||||
public void setMaximumTrackTintColor(ReactSlider view, Integer color) {
|
||||
LayerDrawable drawable = (LayerDrawable) view.getProgressDrawable().getCurrent();
|
||||
Drawable progress = drawable.findDrawableByLayerId(android.R.id.progress);
|
||||
Drawable background = drawable.findDrawableByLayerId(android.R.id.background);
|
||||
if (color == null) {
|
||||
progress.clearColorFilter();
|
||||
background.clearColorFilter();
|
||||
} else {
|
||||
progress.setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
||||
background.setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user