Open inONEL opened 4 years ago
Just in case someone still needs this. Not sure if this is the right way to do it tho. Tested on Android 9 - NS 6.x
import { android as androidApp } from 'tns-core-modules/application'
...
// loaded event
textFieldLoaded({ object }) {
// Grab Native view
const inputLayout = object.android
// Grab icon from res (replace "com.example.app" with your package name. "ic_add" with your icon name)
const icon = com.example.app.R.drawable.ic_add
// Convert it into a drawable for android
const iconDrawable = androidApp.context.getResources().getDrawable(icon)
inputLayout.setPrefixText("+63 ")
inputLayout.setStartIconDrawable(iconDrawable)
}
@kryoware I think it is the right way. Want to make a PR to add that both on iOS and Android ?
It would be nice if we could add material icons to the textfield