Skip to content

Commit

Permalink
chore: Minor cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
CatchABus committed May 12, 2022
1 parent 4781696 commit 62c7667
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
4 changes: 3 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
shamefully-hoist=true
shamefully-hoist=true
strict-peer-dependencies=false
loglevel=error
8 changes: 3 additions & 5 deletions src/ui-pager/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ import { KeyedTemplate } from '@nativescript/core/ui/core/view';
import { isString } from '@nativescript/core/utils/types';
import { layout } from '@nativescript/core/utils/utils';
import {
ITEMLOADING,
Indicator,
ItemEventData,
LOADMOREITEMS,
Orientation,
PagerBase,
PagerItem,
Expand Down Expand Up @@ -686,7 +684,7 @@ function initPagerChangeCallback() {
scrollY: owner.verticalOffset
});
if (owner.items && position === owner.pagerAdapter.lastIndex() - owner.loadMoreCount) {
owner.notify({ eventName: LOADMOREITEMS, object: owner });
owner.notify({ eventName: Pager.loadMoreItemsEvent, object: owner });
}

if (owner.showIndicator && owner.indicatorView) {
Expand Down Expand Up @@ -837,7 +835,7 @@ function initPagerRecyclerAdapter() {
}
const bindingContext = owner._getDataItem(index);
const args = {
eventName: ITEMLOADING,
eventName: Pager.itemLoadingEvent,
object: owner,
android: holder,
ios: undefined,
Expand Down Expand Up @@ -961,7 +959,7 @@ function initStaticPagerStateAdapter() {
const owner = this.owner ? this.owner.get() : null;
if (owner) {
const args = {
eventName: ITEMLOADING,
eventName: Pager.itemLoadingEvent,
object: owner,
android: holder,
ios: undefined,
Expand Down
8 changes: 3 additions & 5 deletions src/ui-pager/index.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ import { layout } from '@nativescript/core/utils/utils';

export type Orientation = 'horizontal' | 'vertical';

export const ITEMLOADING = 'itemLoading';
export const ITEMDISPOSING = 'itemDisposing';
export const LOADMOREITEMS = 'loadMoreItems';
export namespace knownTemplates {
export const itemTemplate = 'itemTemplate';
}
Expand Down Expand Up @@ -106,8 +103,9 @@ export abstract class PagerBase extends ContainerView implements AddChildFromBui
public static swipeStartEvent = 'swipeStart';
public static swipeOverEvent = 'swipeOver';
public static swipeEndEvent = 'swipeEnd';
public static loadMoreItemsEvent = LOADMOREITEMS;
public static itemLoadingEvent = ITEMLOADING;
public static loadMoreItemsEvent = 'loadMoreItems';
public static itemLoadingEvent = 'itemLoading';
public static itemDisposingEvent = 'itemDisposing';
public orientation: Orientation;
public _effectiveItemHeight: number;
public _effectiveItemWidth: number;
Expand Down
9 changes: 3 additions & 6 deletions src/ui-pager/index.ios.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { ChangeType, Color, EventData, KeyedTemplate, Observable, ObservableArray, Property, ProxyViewContainer, StackLayout, Utils, View, ViewBase, profile } from '@nativescript/core';
import { layout } from '@nativescript/core/utils/utils';
import {
ITEMDISPOSING,
ITEMLOADING,
Indicator,
ItemEventData,
LOADMOREITEMS,
Orientation,
PagerBase,
PagerItem,
Expand Down Expand Up @@ -641,7 +638,7 @@ export class Pager extends PagerBase {
let view = cell.view;

const args = {
eventName: ITEMDISPOSING,
eventName: Pager.itemDisposingEvent,
object: this,
index,
android: undefined,
Expand Down Expand Up @@ -743,7 +740,7 @@ export class Pager extends PagerBase {
}
const bindingContext = this._getDataItem(indexPath.row);
const args = {
eventName: ITEMLOADING,
eventName: Pager.itemLoadingEvent,
object: this,
index,
android: undefined,
Expand Down Expand Up @@ -931,7 +928,7 @@ class UICollectionDelegateImpl extends NSObject implements UICollectionViewDeleg
}
if (owner.items && indexPath.row === owner.lastIndex - owner.loadMoreCount) {
owner.notify<EventData>({
eventName: LOADMOREITEMS,
eventName: Pager.loadMoreItemsEvent,
object: owner
});
}
Expand Down

0 comments on commit 62c7667

Please sign in to comment.