How to use the platform.platformNames function in platform

To help you get started, we’ve selected a few platform examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nstudio / nativescript-videoplayer / videoplayer / videoplayer-common.js View on Github external
/**************************************************************************************
 * Made for the {N} community by Brad Martin @BradWayneMartin
 * https://twitter.com/BradWayneMartin
 * https://github.com/bradmartin
 * Pull requests are welcome. Enjoy!
 *************************************************************************************/
var view = require("ui/core/view");
var platform = require("platform");
var dependencyObservable = require("ui/core/dependency-observable");
var proxy = require("ui/core/proxy");
// on Android we explicitly set propertySettings to None because android will invalidate its layout (skip unnecessary native call).
var AffectsLayout = platform.device.os === platform.platformNames.android ? dependencyObservable.PropertyMetadataSettings.None : dependencyObservable.PropertyMetadataSettings.AffectsLayout;
var Video = (function (_super) {
    __extends(Video, _super);
    function Video(options) {
        _super.call(this, options);
    }
    Object.defineProperty(Video.prototype, "src", {
        get: function () {
            return this._getValue(Video.srcProperty);
        },
        set: function (value) {
            this._setValue(Video.srcProperty, value);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Video.prototype, "isLoading", {
github NativeScript / NativeScript / apps / app / ui-tests-app / issues / issue-1657-ios.ts View on Github external
export function changeTranslucent() {
  if (platform.device.os === platform.platformNames.ios) {
    frameModule.topmost().ios.controller.navigationBar.translucent = frameModule.topmost().ios.controller.navigationBar.translucent === true ? false : true;
  }
}
github NativeScript / nativescript-marketplace-demo / app / tns_modules / ui / repeater / repeater.js View on Github external
function Repeater() {
        _super.call(this);
        this.isDirty = true;
        if (platform.device.os === platform.platformNames.ios) {
            this._ios = UIView.new();
        }
    }
    Object.defineProperty(Repeater.prototype, "items", {
github bradyhouse / house / fiddles / nativeScript / fiddle-0009-SqliteDb / fifteenpuzzle / platforms / android / src / main / assets / app / tns_modules / ui / image / image-common.js View on Github external
var proxy = require("ui/core/proxy");
var imageSource = require("image-source");
var imageAssetModule = require("image-asset");
var enums = require("ui/enums");
var platform = require("platform");
var utils = require("utils/utils");
var types = require("utils/types");
var SRC = "src";
var IMAGE_SOURCE = "imageSource";
var LOAD_MODE = "loadMode";
var SYNC = "sync";
var ASYNC = "async";
var IMAGE = "Image";
var ISLOADING = "isLoading";
var STRETCH = "stretch";
var AffectsLayout = platform.device.os === platform.platformNames.android ? dependencyObservable.PropertyMetadataSettings.None : dependencyObservable.PropertyMetadataSettings.AffectsLayout;
function onSrcPropertyChanged(data) {
    var image = data.object;
    image._createImageSourceFromSrc();
}
var Image = (function (_super) {
    __extends(Image, _super);
    function Image() {
        _super.apply(this, arguments);
    }
    Object.defineProperty(Image.prototype, "imageSource", {
        get: function () {
            return this._getValue(Image.imageSourceProperty);
        },
        set: function (value) {
            this._setValue(Image.imageSourceProperty, value);
        },
github NickIliev / NativeScript-Firebase-Auth / firebaseAuth / platforms / android / build / intermediates / assets / F0F1 / debug / app / tns_modules / ui / builder / builder.js View on Github external
PlatformFilter.isPlatform = function (value) {
            return value && (value.toLowerCase() === platform_1.platformNames.android.toLowerCase()
                || value.toLowerCase() === platform_1.platformNames.ios.toLowerCase());
        };
        PlatformFilter.isCurentPlatform = function (value) {
github bradmartin / nativescript-gif / gif.common.js View on Github external
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var dependencyObservable = require("ui/core/dependency-observable");
var proxy = require("ui/core/proxy");
var view = require("ui/core/view");
var gifSource = require("./gif-source");
var platform = require("platform");
var types = require("utils/types");
var SRC = "src";
var GIF_SOURCE = "gifSource";
var GIF = "Gif";
var ISLOADING = "isLoading";
var AffectsLayout = platform.device.os === platform.platformNames.android ? dependencyObservable.PropertyMetadataSettings.None : dependencyObservable.PropertyMetadataSettings.AffectsLayout;
function onSrcPropertyChanged(data) {
    var gif = data.object;
    var value = data.newValue;
    if (types.isString(value)) {
        value = value.trim();
        gif.gifSource = null;
        gif["_url"] = value;
        gif._setValue(Gif.isLoadingProperty, true);
        if (gifSource.isFileOrResourcePath(value)) {
            gif.gifSource = gifSource.fromFileOrResource(value);
            gif._setValue(Gif.isLoadingProperty, false);
        }
        else {
            gifSource.fromUrl(value).then(function (r) {
                if (gif["_url"] === value) {
                    gif.gifSource = r;
github bradyhouse / house / fiddles / nativeScript / fiddle-0001-PageNavigation / pagenavigation / platforms / android / build / intermediates / assets / F0 / debug / app / tns_modules / ui / builder / builder.js View on Github external
PlatformFilter.isPlatform = function (value) {
            return value && (value.toLowerCase() === platform_1.platformNames.android.toLowerCase()
                || value.toLowerCase() === platform_1.platformNames.ios.toLowerCase());
        };
        PlatformFilter.isCurentPlatform = function (value) {
github NativeScript / summer-of-nativescript / august / DemoCode / app / tns_modules / ui / repeater / repeater.js View on Github external
function Repeater() {
        _super.call(this);
        this.isDirty = true;
        if (platform.device.os === platform.platformNames.ios) {
            this._ios = UIView.new();
        }
    }
    Object.defineProperty(Repeater.prototype, "items", {
github argonjs / argon-app / app / components / common / util.ts View on Github external
export function linearGradient(view:View, colors:(Color|string)[]) {
  var _colors:any[] = [];
  var nativeView = view['_nativeView'];

  if (!nativeView) {
    return;
  }

  colors.forEach(function (c, idx) {
    if (!(c instanceof Color)) {
      colors[idx] = new Color(c);
    }
  });

  if (platform.device.os === platform.platformNames.android) {
    var backgroundDrawable = nativeView.getBackground(),
      LINEAR_GRADIENT = 0;

    colors.forEach(function (c:Color) {
      _colors.push(c.android);
    });

    if (!(backgroundDrawable instanceof android.graphics.drawable.GradientDrawable)) {
      backgroundDrawable = new android.graphics.drawable.GradientDrawable();
      backgroundDrawable.setColors(_colors);
      backgroundDrawable.setGradientType(LINEAR_GRADIENT);
      nativeView.setBackgroundDrawable(backgroundDrawable);
    }
  } else if (platform.device.os === platform.platformNames.ios) {
    var iosView:UIView = view.ios;
    var colorsArray = NSMutableArray.alloc().initWithCapacity(2);
github NickIliev / NativeScript-Firebase-Auth / firebaseAuth / platforms / android / build / intermediates / assets / F0F1 / debug / app / tns_modules / ui / builder / builder.js View on Github external
PlatformFilter.isPlatform = function (value) {
            return value && (value.toLowerCase() === platform_1.platformNames.android.toLowerCase()
                || value.toLowerCase() === platform_1.platformNames.ios.toLowerCase());
        };
        PlatformFilter.isCurentPlatform = function (value) {