New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nativescript-parallax

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nativescript-parallax - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

.vscode/launch.json

2

nativescript-parallax.android.js

@@ -14,4 +14,4 @@ "use strict";

return ParallaxView;
}(nativescript_parallax_common_1.Common));
}(nativescript_parallax_common_1.ParallaxViewCommon));
exports.ParallaxView = ParallaxView;
//# sourceMappingURL=nativescript-parallax.android.js.map

@@ -1,5 +0,5 @@

import {Common} from './nativescript-parallax.common';
import {ParallaxViewCommon} from './nativescript-parallax.common';
export class ParallaxView extends Common {
export class ParallaxView extends ParallaxViewCommon {
}
"use strict";
var app = require('application');
var dialogs = require('ui/dialogs');
var Common = (function () {
function Common() {
this.message = Utils.SUCCESS_MSG();
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 _scrollViewModule = require('ui/scroll-view');
var _view = require('ui/core/view');
var _stackLayout = require('ui/layouts/stack-layout');
var ParallaxViewCommon = (function (_super) {
__extends(ParallaxViewCommon, _super);
function ParallaxViewCommon() {
var _this = this;
_super.call(this);
var headerView;
var scrollView;
var viewsToFade;
var maxTopViewHeight;
var controlsToFade;
var wrapperStackLayout = new _stackLayout.StackLayout();
this._addChildFromBuilder = function (name, value) {
if (value instanceof _view.View) {
if (_this.content == null) {
_this.content = wrapperStackLayout;
}
wrapperStackLayout.addChild(value);
}
};
viewsToFade = [];
scrollView = this;
scrollView.on(_scrollViewModule.ScrollView.loadedEvent, function (data) {
if (maxTopViewHeight == null) {
maxTopViewHeight = 300;
}
if (controlsToFade == null) {
controlsToFade = [];
}
var prevOffset = -10;
var topOpacity = 1;
headerView = wrapperStackLayout.getChildAt(0);
if (headerView == null) {
return;
}
headerView.height = maxTopViewHeight;
controlsToFade.forEach(function (id) {
var newView = _view.getViewById(_this, id);
if (newView != null) {
viewsToFade.push(newView);
}
});
scrollView.on(_scrollViewModule.ScrollView.scrollEvent, function (args) {
if (prevOffset <= scrollView.verticalOffset) {
if (headerView.height >= 0) {
headerView.height = _this.getTopViewHeight(maxTopViewHeight, scrollView.verticalOffset);
}
}
else {
if (headerView.height <= maxTopViewHeight) {
headerView.height = _this.getTopViewHeight(maxTopViewHeight, scrollView.verticalOffset);
}
}
if (scrollView.verticalOffset < maxTopViewHeight) {
topOpacity = parseFloat((1 - (scrollView.verticalOffset * 0.01)).toString());
if (topOpacity > 0 && topOpacity <= 1) {
viewsToFade.forEach(function (view) {
view.opacity = topOpacity;
});
}
}
prevOffset = scrollView.verticalOffset;
});
});
}
return Common;
}());
exports.Common = Common;
var Utils = (function () {
function Utils() {
}
Utils.SUCCESS_MSG = function () {
var msg = "Your plugin is working on " + (app.android ? 'Android' : 'iOS') + ".";
setTimeout(function () {
dialogs.alert(msg + " For real. It's really working :)").then(function () { return console.log("Dialog closed."); });
}, 2000);
return msg;
Object.defineProperty(ParallaxViewCommon.prototype, "android", {
get: function () {
return;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ParallaxViewCommon.prototype, "ios", {
get: function () {
return;
},
enumerable: true,
configurable: true
});
ParallaxViewCommon.prototype.getTopViewHeight = function (topHeight, verticalOffset) {
if ((topHeight - verticalOffset) >= 0) {
return topHeight - verticalOffset;
}
else {
return 0;
}
};
return Utils;
}());
exports.Utils = Utils;
return ParallaxViewCommon;
}(_scrollViewModule.ScrollView));
exports.ParallaxViewCommon = ParallaxViewCommon;
//# sourceMappingURL=nativescript-parallax.common.js.map
import * as app from 'application';
import * as dialogs from 'ui/dialogs';
import * as _scrollViewModule from 'ui/scroll-view';
import * as _view from 'ui/core/view';
import * as _frame from 'ui/frame';
import * as _pages from 'ui/page';
import * as _stackLayout from 'ui/layouts/stack-layout';
export class Common {
public message: string;
constructor() {
this.message = Utils.SUCCESS_MSG();
}
}
export class ParallaxViewCommon extends _scrollViewModule.ScrollView implements _view.AddChildFromBuilder {
export class Utils {
public static SUCCESS_MSG(): string {
let msg = `Your plugin is working on ${app.android ? 'Android' : 'iOS'}.`;
setTimeout(() => {
dialogs.alert(`${msg} For real. It's really working :)`).then(() => console.log(`Dialog closed.`));
}, 2000);
return msg;
}
constructor() {
super();
let headerView: _view.View;
let scrollView: _scrollViewModule.ScrollView;
let viewsToFade: _view.View[];
let maxTopViewHeight: number;
let controlsToFade: string[];
//creates a new stack layout to wrap the content inside of the plugin.
let wrapperStackLayout = new _stackLayout.StackLayout();
//overides default addChildFromBuilder to insert the wrapper and then add any child views.
this._addChildFromBuilder = (name: string, value: any) => {
if (value instanceof _view.View) {
if (this.content == null) {
this.content = wrapperStackLayout;
}
wrapperStackLayout.addChild(value);
}
};
//not supported yet;
viewsToFade = [];
scrollView = <_scrollViewModule.ScrollView>this;
scrollView.on(_scrollViewModule.ScrollView.loadedEvent, (data: _scrollViewModule.ScrollEventData) => {
if (maxTopViewHeight == null) {
maxTopViewHeight = 300;
}
if (controlsToFade == null) {
controlsToFade = [];
}
//setting this to negative 10 assures there is no confusion when starting the on scroll event.
let prevOffset = -10;
let topOpacity = 1;
//first child always needs to be the headerView
headerView = wrapperStackLayout.getChildAt(0);
if (headerView == null) {
return;
}
headerView.height = maxTopViewHeight;
//find each control specified to fade.
controlsToFade.forEach((id: string): void => {
let newView: _view.View = _view.getViewById(this, id);
if (newView != null) {
viewsToFade.push(newView);
}
});
scrollView.on(_scrollViewModule.ScrollView.scrollEvent, (args: _scrollViewModule.ScrollEventData) => {
if (prevOffset <= scrollView.verticalOffset) {
//when scrolling down
if (headerView.height >= 0) {
headerView.height = this.getTopViewHeight(maxTopViewHeight, scrollView.verticalOffset);
}
} else {
//scrolling up, as long as the view's hieght is not taller than it's initial height;
if (headerView.height <= maxTopViewHeight) {
headerView.height = this.getTopViewHeight(maxTopViewHeight, scrollView.verticalOffset);
}
}
//fades in and out label in topView
if (scrollView.verticalOffset < maxTopViewHeight) {
topOpacity = parseFloat((1 - (scrollView.verticalOffset * 0.01)).toString());
if (topOpacity > 0 && topOpacity <= 1) {
//fade each control
viewsToFade.forEach((view: _view.View): void => {
view.opacity = topOpacity;
});
}
}
prevOffset = scrollView.verticalOffset;
});
});
}
get android(): any {
return;
}
get ios(): any {
return;
}
//calcutes the top views height using the scrollview's verticalOffset
getTopViewHeight(topHeight: number, verticalOffset: number): number {
if ((topHeight - verticalOffset) >= 0) {
return topHeight - verticalOffset;
} else {
return 0;
}
}
}

@@ -14,4 +14,4 @@ "use strict";

return ParallaxView;
}(nativescript_parallax_common_1.Common));
}(nativescript_parallax_common_1.ParallaxViewCommon));
exports.ParallaxView = ParallaxView;
//# sourceMappingURL=nativescript-parallax.ios.js.map

@@ -1,5 +0,5 @@

import {Common} from './nativescript-parallax.common';
import {ParallaxViewCommon} from './nativescript-parallax.common';
export class ParallaxView extends Common {
export class ParallaxView extends ParallaxViewCommon {
}
{
"name": "nativescript-parallax",
"version": "0.0.3",
"version": "0.0.4",
"description": "NativeScript Parallax View Plugin.",

@@ -5,0 +5,0 @@ "main": "nativescript-parallax.js",

@@ -0,0 +0,0 @@ {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc