Creating a TextView dynamically with a hint fails



I’m trying to dynamically add a TextView to a StackLayout.

The App will add the TextView but if i try to add a ‘hint’ value then it fails, but doesn’t show any errors in the terminal or console.

I can set the Text value but the hint doesn’t work.
let inrooms = this.inside_rooms.nativeElement;

               let tv = new TextView();
               tv.hint ='This';

the console.log shows the hint value, but when it gets to the addChild part, it doesn’t do anything.


I’m not able to reproduce the issue you mentioned neither in iOS nor Android.


Thank you for the test app.

Maybe it’s something else with other files being added.


After putting your code into a test page of my app i was getting an error with UIColor.blackColor.colorWithAlphaComponent’ is undefined

I found that there was no color set for the TextView, as my app doesn’t use the nativescript theme styles.

After added the color to my stylesheet my original code now works.
Looking at the way other TextView were put into the html files, they have color=“black”

Why doesn’t the TextView just have a default color set?