Skip to content
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

Slider's minimumTrackTintColor & maximumTrackTintColor props are reversed on Android #16672

Closed
dekelev opened this issue Nov 4, 2017 · 3 comments
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@dekelev
Copy link

dekelev commented Nov 4, 2017

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
    OS: Windows 10
    Node: 6.11.4
    Yarn: 1.1.0
    npm: 4.6.1
    Android Studio: Android Studio 2.3.2, Build #AI-162.3934792

  Packages: (wanted => installed)
    react-native: 0.47.2 => 0.47.2
    react: 16.0.0-alpha.12 => 16.0.0-alpha.12

Steps to Reproduce

  1. Set minimumTrackTintColor & maximumTrackTintColor props on the Slider component
  2. Run on Android

Expected Behavior

minimumTrackTintColor should set the progress color while the maximumTrackTintColor should set the background color.

Actual Behavior

On Android, minimumTrackTintColor sets the background color while the maximumTrackTintColor sets the progress color.

From ReactSliderManager.java

@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);
    if (color == null) {
      background.clearColorFilter();
    } else {
      background.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);
    if (color == null) {
      progress.clearColorFilter();
    } else {
      progress.setColorFilter(color, PorterDuff.Mode.SRC_IN);
    }
  }

Reproducible Demo

import { Slider } from 'react-native';
...
<Slider
        minimumTrackTintColor="white"
        maximumTrackTintColor="gray"
      />
@maggialejandro
Copy link

Same problem here
RN 0.48.4

iOS:
captura de pantalla 2017-12-12 a la s 12 48 58

Android:
captura de pantalla 2017-12-12 a la s 12 48 49

Code:

<Slider
  style={{ marginBottom: 10 }}
  minimumtracktintcolor="green"
  maximumTrackTintColor="red"
  thumbTintColor="#3f78c3"
/>

@maggialejandro
Copy link

related PR #16053

@stale
Copy link

stale bot commented Feb 10, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Feb 10, 2018
@stale stale bot closed this as completed Feb 17, 2018
@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

2 participants