1

Using WebStorm, I have a Progress element :

<Progress  id="prgressid" ></Progress>

I want to increase its height. It can be done via scaleY=".." attribute or via native code :

mProgressBar.setScaleY(3);

I've decided to do it via code but the intellisene shows me :

enter image description here

Another try without .android.

It doesn't have the setScaleY method.
(if I try to use setScale method - it fails at runtime - But if I try setScaleY - it does work.)

Question:

Why isn't the method shown ? And what should I see in order to see all accessible methods ?

tns info :

enter image description here

Sdk manager

Royi Namir
  • 131,490
  • 121
  • 408
  • 714
  • Do you get the auto completion for `this.page.getViewById( id: "prgressid" ).setScale...`? The NativeScript View class should also have those methods, so you don't need `.android` for that. I have no idea where the `setScale()` is coming from though. – xander Dec 07 '17 at 10:51
  • @xander No I don't : https://i.stack.imgur.com/J62o8.png , Also it shows an error ( if I don't specify android : https://i.stack.imgur.com/EObaj.png) – Royi Namir Dec 07 '17 at 10:59

1 Answers1

3

EDIT: the initial snippet had an error - in fact, you can access the public methods setScaleY and setScaleX but you will need the typings (via tns-platform-declarations) and also we would need to cast the native component to android.widget.ProgressBar (otherwise it would be of type any)

For example:

<Progress value="50" loaded="onPbLoaded" />

TypeScript

export function onPbLoaded(args) {
    let pb = <Progress>args.object;

    if(isAndroid) {
        let nativeProgress = <android.widget.ProgressBar>pb.android; // android.widget.ProgressBar{d26eea9 V.ED..... ......ID 0,0-0,0}
        console.log("nativeProgress Android: " + nativeProgress); 

        nativeProgress.setScaleX(3);
        nativeProgress.setScaleY(5);
    }
}
Nick Iliev
  • 9,295
  • 2
  • 31
  • 85