PeterStaev / NativeScript-Drop-Down

A NativeScript DropDown widget.
Apache License 2.0
105 stars 65 forks source link

iOS - Selected Item text color issue #71

Closed shivapersad closed 7 years ago

shivapersad commented 7 years ago

On iOS I have created a Dropdown instance. I have a hint being displayed for the Dropdown. When I interact with the Dropdown and select a value the color of the text does not change from gray to black (I have a CSS property set on color to black).

Dropdown with hint displayed: image

Dropdown with value changed: image

What could be the reason for this as the Android version works perfectly. Thanks.

shivapersad commented 7 years ago

Update:

I am able to get the text to display "black" when I set a numeric value for the selectedIndex property in the constructor of the Component. If I use "undefined" or "null" the text remains gray.

I am doing this as the implementation for iOS and Android differ slightly. In iOS the hint isn't displayed in the spinner object but in Android the hint is displayed. I tried an approach where I would include the hint in the list of items but this lead to duplicate list items in Android but worked fine for iOS. I am also checking the value of the "selectedIndex" property to perform validation on the inputs for a form. Any advice on a solution to this issue is appreciated.

shivapersad commented 7 years ago

Is it possible to hide the "hint" text when I click in the Dropdown for Android? I think that would be the best solution at this point in time.

PeterStaev commented 7 years ago

Hey @shivapersad , i cannot simulate this color problem with the demo app. I've tried both setting the selected index from code and from the user selecting something. In both cases the color was correctly changed to whatever I have in CSS.

As for the hint not displaying on android, you need to set the hint to null. See https://github.com/PeterStaev/NativeScript-Drop-Down/issues/67 for more details.

shivapersad commented 7 years ago

Your suggestion works. Thanks for the assistance.