Skip to content

Commit

Permalink
fix(): build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
triniwiz committed Feb 22, 2020
1 parent 87cb211 commit c913554
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions src/pager.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ export class Pager extends PagerBase {

private _updateScrollPosition() {
const view = (this.pager as UICollectionView);
if (!view || view.contentSize.width === 0) {
const size = this.orientation === 'vertical' ? view.contentSize.height: view.contentSize.width;
if (!view || size === 0) {
return;
}
this._scrollToIndexAnimated(this.selectedIndex, false);
Expand Down Expand Up @@ -401,7 +402,11 @@ export class Pager extends PagerBase {

_scrollToIndexAnimated(index: number, animate: boolean) {
if (!this.pager) return;

const contentSize = this.pager.contentSize;
const size = this.orientation === 'vertical' ? contentSize.height : contentSize.width;
if (size === 0) {
return;
}
if (this._childrenCount === 0) {
return;
}
Expand Down Expand Up @@ -450,7 +455,7 @@ export class Pager extends PagerBase {
}

refresh() {
NSOperationQueue.mainQueue.addOperationWithBlock(()=>{
NSOperationQueue.mainQueue.addOperationWithBlock(() => {
this._refresh();
});
}
Expand Down Expand Up @@ -543,7 +548,7 @@ export class Pager extends PagerBase {
);
super.measure(widthMeasureSpec, heightMeasureSpec);
if (changed) {
NSOperationQueue.mainQueue.addOperationWithBlock(()=>{
NSOperationQueue.mainQueue.addOperationWithBlock(() => {
if (!this.pager) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/react/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { updateListener } from 'react-nativescript/dist/client/EventHandling';
import { register } from 'react-nativescript/dist/client/ElementRegistry';
import { ItemEventData } from '../pager.common';

register('pager', NativeScriptPager);
register('pagerItem', NativeScriptPagerItem);
register('pager', NativeScriptPager as any);
register('pagerItem', NativeScriptPagerItem as any);

export type CellViewContainer = ContentView;
type CellFactory = (item: any, ref: React.RefObject<any>) => React.ReactElement;
Expand Down

0 comments on commit c913554

Please sign in to comment.