ui-material-components icon indicating copy to clipboard operation
ui-material-components copied to clipboard

[Feature Request] Posibility of mat-prefix and mat-suffix icons in textfield

Open inONEL opened this issue 6 years ago • 2 comments
trafficstars

It would be nice if we could add material icons to the textfield

inONEL avatar Jul 16 '19 13:07 inONEL

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

Code


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)
}

Result

Screenshot_20201109-114631

kryoware avatar Nov 09 '20 03:11 kryoware

@kryoware I think it is the right way. Want to make a PR to add that both on iOS and Android ?

farfromrefug avatar Nov 09 '20 07:11 farfromrefug