Skip to content

Instantly share code, notes, and snippets.

@amizz
Last active January 29, 2018 07:50
Show Gist options
  • Save amizz/4bde7ff6dcadbc76d7c36fc91769540e to your computer and use it in GitHub Desktop.
Save amizz/4bde7ff6dcadbc76d7c36fc91769540e to your computer and use it in GitHub Desktop.
Platform Specific in Nativescript

Class/Function/TS file

someFunc.d.ts

  export function someFunc(): Promise<any>;

someFunc.<android/ios>.ts

  export function someFunc(): Promise<any> {
    //code here
  }

some.component.d.ts

  import {Component} from "@angular/core"

  @Component({
    selector: '<component name>',
    moduleId: module.id,
    templateUrl: ["./<component name>.component.html"]
  })
  export class SomeComponent {
    work();
  }

some.component.<android/ios>.ts

  import {Component} from "@angular/core"

  @Component({
    selector: '<component name>',
    moduleId: module.id,
    templateUrl: ["./<component name>.component.html"]
  })
  export class SomeComponent {
    work() {
      //code here
    }
  }

HTML

In some.component.html

  <android>
    <!-- code here -->
  </android>
  <ios>
    <!-- code here -->
  </ios>

CSS

To be done

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