Closed Taremeh closed 7 years ago
Encountering this too
When trying
Toast.makeText("Hello World", Toast.duration.long).show();
...this runtime error shows up:
ERROR TypeError: Cannot read property 'long' of undefined
For now, I just edited nativescript-toast's index.d.ts to:
export function makeText(text: string, duration?: string): Toast;
I'm guessing duration's type is at fault as Typescript enums are number based (quoted here), so the duration argument should be changed either to constant strings or string-safe Typescript enums (manual example here ; npm package implementation here)
Hi, I tried to create a long Toast (as shown on the example page):
Toast.makeText("Hello World", "long").show();
However, I get an error, when compiling it:
error TS2345: Argument of type '"long"' is not assignable to parameter of type 'duration'.
I'm using Nativescript 2.5 (and newest TNS Android). I think there's something wrong with the declaration of the parameter 'duration'...