Skip to content

Commit

Permalink
feat(collectionview): android nestedScrollingEnabled property
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Aug 8, 2021
1 parent 4c27279 commit bb52a55
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/collectionview/collectionview.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
Trace,
View,
ViewBase,
booleanConverter,
paddingBottomProperty,
paddingLeftProperty,
paddingRightProperty,
Expand Down Expand Up @@ -187,6 +188,12 @@ const extraLayoutSpaceProperty = new Property<CollectionViewBase, number>({
const itemViewCacheSizeProperty = new Property<CollectionViewBase, number>({
name: 'itemViewCacheSize'
});

const nestedScrollingEnabledProperty = new Property<CollectionViewBase, boolean>({
name: 'nestedScrollingEnabled',
defaultValue: true,
valueConverter: booleanConverter
});
export class CollectionView extends CollectionViewBase {
public static DEFAULT_TEMPLATE_VIEW_TYPE = 0;
public static CUSTOM_TEMPLATE_ITEM_TYPE = 1;
Expand Down Expand Up @@ -222,6 +229,10 @@ export class CollectionView extends CollectionViewBase {

public animateItemUpdate = false;

public nestedScrollingEnabled: boolean;
public itemViewCacheSize: number;
public extraLayoutSpace: number;

@profile
public createNativeView() {
// storing the class in a property for reuse in the future cause a materializing which is pretty slow!
Expand Down Expand Up @@ -542,6 +553,9 @@ export class CollectionView extends CollectionViewBase {
// layoutManager['setStackFromEnd'](value);
}
}
[nestedScrollingEnabledProperty.setNative](value: boolean) {
this.nativeViewProtected.setNestedScrollingEnabled(value);
}
[extraLayoutSpaceProperty.setNative](value: number) {
const layoutManager = this.layoutManager;
if (layoutManager && layoutManager['setExtraLayoutSpace']) {
Expand Down Expand Up @@ -1112,3 +1126,4 @@ export interface CollectionViewRecyclerView extends com.nativescript.collectionv
let CollectionViewRecyclerView: CollectionViewRecyclerView;
itemViewCacheSizeProperty.register(CollectionViewBase);
extraLayoutSpaceProperty.register(CollectionViewBase);
nestedScrollingEnabledProperty.register(CollectionViewBase);

0 comments on commit bb52a55

Please sign in to comment.