-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(scroll-view): android 'isScrollEnabled' will apply if changed whi…
…le gesture is underway (#8695)
- Loading branch information
Showing
5 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { EventData as ObservableEventData } from "tns-core-modules/data/observable"; | ||
import { GestureStateTypes, PanGestureEventData } from "tns-core-modules/ui/gestures"; | ||
import { Page } from "tns-core-modules/ui/page"; | ||
|
||
export function pageLoaded(args: ObservableEventData) { | ||
var page = <Page>args.object; | ||
} | ||
|
||
export function panLayout(args: PanGestureEventData) | ||
{ | ||
const scrollView = args.object.parent; | ||
|
||
if (args.state === GestureStateTypes.began) { | ||
args.object.previousDeltaY = 0; | ||
scrollView.isScrollEnabled = false; | ||
} | ||
else if (args.state === GestureStateTypes.changed) { | ||
const diff = (args.deltaY - args.object.previousDeltaY); | ||
args.object.translateY += diff; | ||
args.object.previousDeltaY = args.deltaY; | ||
} | ||
else if (args.state === GestureStateTypes.ended) { | ||
scrollView.isScrollEnabled = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded" class="page"> | ||
<ScrollView id="scroll-view" height="300"> | ||
<StackLayout height="500" backgroundColor="red" pan="panLayout"> | ||
<Label text="Move Me" color="#fff" fontSize="22"/> | ||
</StackLayout> | ||
</ScrollView> | ||
</Page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters