nativescript-community / ui-material-components

Monorepo that contains all of the NativeScript Material Design plugins.
https://nativescript-community.github.io/ui-material-components/
Apache License 2.0
216 stars 80 forks source link

Imposible to change the color of hint-inactive #349

Open cuzzea opened 2 years ago

cuzzea commented 2 years ago

I am trying to set the hint text color when the input is inactive.

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

I am trying to set the hint text color when the input is inactive.

want it to be red

image

like it is here, on focus

image

Is there any code involved?

HTML

      <MDTextField
        variant="underline"
        hint="Hint text"
        secure="false"
        keyboardType="number"
        returnKeyType="next"
        autocorrect="false"
        text=""
        class="test"
      >
      </MDTextField>

CSS

.test {
  ripple-color: #04bfad;
  elevation: 4;
  stroke-color: #04bfad; /* the border color when active */
  stroke-inactive-color: #fff; /* the border color when inactive */
  floating-color: #04bfad; /* the floating placeholder color when active */
  floating-inactive-color: #04bfad; /* the floating placeholder color when inactive */
  placeholder-color: #fff;
  placeholder-inactive-color: #fff;
  background-color: transparent;
  color: #fff;
  font-size: 15;
  margin-bottom: 10;

  /* TEST VALUES */

  selected-background-color: #f00;
  tab-text-color: #f00;
  -webkit-focus-ring-color: #f00;
  separator-color: #f00;
  error-color: #f00;
  helper-color: #f00;
  link-color: #f00;
  tint-color: #f00;
  ripple-color: #f00;
  elevation: 4;
  stroke-color: #f00;
  stroke-disabled-color: #f00;
  stroke-inactive-color: #f00;
  floating-color: #f00;
  floating-inactive-color: #f00;
  placeholder-color: #f00;
  placeholder-disabled-color: #f00;
  placeholder-active-color: #f00;
  placeholder-inactive-color: #f00;
}
farfromrefug commented 2 years ago

@cuzzea there is no.prop.to that but you can do.it with css pseudo selector (css depending on object property). set a focused property on the textfield. plug that prop on focus events. now set hint color in css based on thar prop

cuzzea commented 2 years ago

When it's focused is not an issue. I can change the color of the hint. The problem is when it's not selected and empty. In that case I can't change the color. In the image and code on top, I set all the properties of the css color (that I could find/think) to red, as you can see in the first image, the Hint text is not red. That is the issue.

farfromrefug commented 2 years ago

@cuzzea yes i understand that s why i gave you the hint to do it with pseudo selector css.

vallemar commented 1 year ago

@cuzzea this pr fix this! https://github.com/nativescript-community/ui-material-components/pull/423

vallemar commented 1 year ago

@farfromrefug well this fixes setting it by code but by css i have not been able to apply any styling of the component, i can't help with this because i don't know how to bind a component with css

farfromrefug commented 1 year ago

@vallemar thanks I ll have to take a look at this