mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(core): nativescript.config and webpack updates (#8801)
This commit is contained in:
22
apps/ui/src/scroll-view/scroll-enabled-page.ts
Normal file
22
apps/ui/src/scroll-view/scroll-enabled-page.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { EventData, GestureStateTypes, PanGestureEventData, Page, View, ScrollView } from '@nativescript/core';
|
||||
|
||||
export function pageLoaded(args: EventData) {
|
||||
var page = <Page>args.object;
|
||||
}
|
||||
|
||||
let currentDeltaY = 0;
|
||||
export function panLayout(args: PanGestureEventData) {
|
||||
const view = <View>args.object;
|
||||
const scrollView = <ScrollView>view.parent;
|
||||
|
||||
if (args.state === GestureStateTypes.began) {
|
||||
currentDeltaY = 0;
|
||||
scrollView.isScrollEnabled = false;
|
||||
} else if (args.state === GestureStateTypes.changed) {
|
||||
const diff = args.deltaY - currentDeltaY;
|
||||
view.translateY += diff;
|
||||
currentDeltaY = args.deltaY;
|
||||
} else if (args.state === GestureStateTypes.ended) {
|
||||
scrollView.isScrollEnabled = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user