Skip to content

Instantly share code, notes, and snippets.

@EddyVerbruggen
Last active March 17, 2020 13:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EddyVerbruggen/c63f5bdaa79eac0a884fbd43707362a7 to your computer and use it in GitHub Desktop.
Save EddyVerbruggen/c63f5bdaa79eac0a884fbd43707362a7 to your computer and use it in GitHub Desktop.
Changing the caret (cursor) color in NativeScript iOS
export class MyComponent implements AfterViewInit {
// assuming your view has this: <TextField #myTextField text="I have a red caret"></TextField>
@ViewChild("myTextField") myTextField: ElementRef;
ngAfterViewInit(): void {
// note that if you don't have iOS typings you can change 'UITextField' to 'any'
let textField: UITextField = (<TextField>this.myTextField.nativeElement).ios;
textField.tintColor = new Color("red").ios;
}
}
@mrcretu
Copy link

mrcretu commented Mar 17, 2020

(this.myTextField.nativeElement).ios is always undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment