运行时版本为5.0.0的Android上的NativeScript ScrollView错误

时间:2018-11-05 16:46:32

标签: nativescript

在NativeScript运行时版本5.0.0上,ScrollView isUserInteractionEnabled参数的行为与Android 4.2.0上的行为不同。

不需要脚本文件。您只需要此XML即可观察到此问题:

<Page class="page" xmlns="http://www.nativescript.org/tns.xsd">
    <ActionBar title="Horizontal Scroll Bug" class="action-bar">
    </ActionBar>
    <StackLayout>
        <Label text="ScrollView's isUserInteractionEnabled property is false."
            padding="10" textWrap="true" fontSize="20" />
        <ScrollView id="horizontalScroll" orientation="horizontal" isUserInteractionEnabled="false">
            <StackLayout orientation="horizontal">
                <StackLayout backgroundColor="yellow">
                    <Label text="Box 1" padding="70" />
                </StackLayout>
                <StackLayout backgroundColor="red">
                    <Label text="Box 2" padding="70" />
                </StackLayout>
                <StackLayout backgroundColor="blue">
                    <Label text="Box 3" padding="70" />
                </StackLayout>
                <StackLayout backgroundColor="green">
                    <Label text="Box 4" padding="70" />
                </StackLayout>
                <StackLayout backgroundColor="purple">
                    <Label text="Box 5" padding="70" />
                </StackLayout>
                <StackLayout backgroundColor="orange">
                    <Label text="Box 6" padding="70" />
                </StackLayout>
            </StackLayout>
        </ScrollView>
        <Label text="Try to scroll the colored boxes above to the right and left to reveal more boxes.  You shouldn't be able to."
            padding="10" textWrap="true" fontSize="20" />
        <Label text="On Android with run time version 4.2.0 you can't, but on run time version 5.0.0 you can."
            padding="10" textWrap="true" fontSize="20" />
    </StackLayout>
</Page>

如果您想扫描QR码,我将应用程序发布在NativeScript操场上: https://play.nativescript.org/?template=play-js&id=hKrNlK

1 个答案:

答案 0 :(得分:1)

isUserInteractionEnabled设置为false时禁用滚动-这似乎是{N} 5.x中引入的行为更改。同时我不确定这是否是故意的,您可能想在Github上报告。

与此同时,您可以使用此workaround