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|
|----|----|
|![image](https://user-images.githubusercontent.com/17292331/30700555-2b8ae828-9ee8-11e7-94a3-f1d3adee7fd5.png)|![screenshot_2017-09-21-15-59-59](https://user-images.githubusercontent.com/17292331/30699855-246c1280-9ee6-11e7-9653-e61c4798a50f.png)|

|iOS|Android|
|----|----|
|![image](https://user-images.githubusercontent.com/17292331/30700563-2fc8c25c-9ee8-11e7-9c0d-955d9921660f.png) (same)|![screenshot_2017-09-21-16-12-04](https://user-images.githubusercontent.com/17292331/30700418-def3e136-9ee7-11e7-982b-48aeba23a5ea.png)|
Closes https://github.com/facebook/react-native/pull/16053

Differential Revision: D5910299

Pulled By: shergin

fbshipit-source-id: 74851e4cc6d54f72ea2755200e26b0d921890b48
This commit is contained in:
Guizmo Martinez 2017-09-26 02:13:32 -07:00 committed by Facebook Github Bot
parent 979629504b
commit 31904d523d
1 changed files with 6 additions and 6 deletions

View File

@ -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);
}
}