Originally posted from Johan Beumer (SO)
In my NativeScript-typescript app I have a screen with 2 ScrollViews on it. Both ScrollViews have a scroll event. Now when I scroll ScrollView1, also the ScrollEvent of ScrollView2 is fired. At least on Android, that's the situation. On iOS only the ScrollView that's being scrolled the scroll event fires.
Code to reproduce this issue:
page.xml
<Page xmlns="http://schemas.nativescript.org/tns.xsd"
loaded="pageLoaded"
actionBarHidden="false">
<StackLayout>
<ScrollView id="scroller1" orientation="horizontal">
<StackLayout orientation="horizontal" width="auto" >
<Button text="Click me 1" textWrap="true" style="font-size: 12;" height="90" width="550"
borderRadius="0" borderWidth="0.1" borderColor="blue" />
</StackLayout>
</ScrollView>
<ScrollView id="scroller2" orientation="horizontal" >
<StackLayout orientation="horizontal" width="auto" >
<Button text="Click me 4" textWrap="true" style="font-size: 12;" height="90" width="550"
borderRadius="0" borderWidth="0.1" borderColor="blue" />
</StackLayout>
</ScrollView>
</StackLayout>
</Page>
page.ts
import { EventData } from "data/observable";
import { Page } from "ui/page";
import { ScrollView } from "ui/scroll-view";
import observable = require("data/observable");
import scrollViewModule = require("ui/scroll-view")
let scroller1: ScrollView;
let scroller2: ScrollView;
export function pageLoaded(args: EventData) {
let page = <Page>args.object;
scroller1 = <ScrollView>page.getViewById("scroller1");
scroller2 = <ScrollView>page.getViewById("scroller2");
scroller1.on(ScrollView.scrollEvent, scrollingScroller1, this);
scroller2.on(ScrollView.scrollEvent, scrollingScroller2, this);
}
function scrollingScroller1(args: scrollViewModule.ScrollEventData) {
console.log('scrollingScroller1');
}
function scrollingScroller2(args: scrollViewModule.ScrollEventData) {
console.log('EVENT FROM scrollingScroller2');
}
Tested on Android API23 and indeed one scroll fires all events (in iOS everything works as expected)
Original issue posted here
Reactions are currently unavailable
Originally posted from Johan Beumer (SO)
Code to reproduce this issue:
page.xml
<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded" actionBarHidden="false"> <StackLayout> <ScrollView id="scroller1" orientation="horizontal"> <StackLayout orientation="horizontal" width="auto" > <Button text="Click me 1" textWrap="true" style="font-size: 12;" height="90" width="550" borderRadius="0" borderWidth="0.1" borderColor="blue" /> </StackLayout> </ScrollView> <ScrollView id="scroller2" orientation="horizontal" > <StackLayout orientation="horizontal" width="auto" > <Button text="Click me 4" textWrap="true" style="font-size: 12;" height="90" width="550" borderRadius="0" borderWidth="0.1" borderColor="blue" /> </StackLayout> </ScrollView> </StackLayout> </Page>page.ts
import { EventData } from "data/observable"; import { Page } from "ui/page"; import { ScrollView } from "ui/scroll-view"; import observable = require("data/observable"); import scrollViewModule = require("ui/scroll-view") let scroller1: ScrollView; let scroller2: ScrollView; export function pageLoaded(args: EventData) { let page = <Page>args.object; scroller1 = <ScrollView>page.getViewById("scroller1"); scroller2 = <ScrollView>page.getViewById("scroller2"); scroller1.on(ScrollView.scrollEvent, scrollingScroller1, this); scroller2.on(ScrollView.scrollEvent, scrollingScroller2, this); } function scrollingScroller1(args: scrollViewModule.ScrollEventData) { console.log('scrollingScroller1'); } function scrollingScroller2(args: scrollViewModule.ScrollEventData) { console.log('EVENT FROM scrollingScroller2'); }Tested on Android API23 and indeed one scroll fires all events (in iOS everything works as expected)
Original issue posted here