11import { ScrollEventData } from "." ;
2- import { ScrollViewBase , layout , scrollBarIndicatorVisibleProperty } from "./scroll-view-common" ;
2+ import {
3+ ScrollViewBase , layout , scrollBarIndicatorVisibleProperty ,
4+ isUserInteractionEnabledProperty , isScrollEnabledProperty
5+ } from "./scroll-view-common" ;
36
47export * from "./scroll-view-common" ;
58
@@ -44,6 +47,21 @@ export class ScrollView extends ScrollViewBase {
4447 return nativeView . getScrollableLength ( ) / layout . getDisplayDensity ( ) ;
4548 }
4649
50+ [ isUserInteractionEnabledProperty . setNative ] ( value : boolean ) {
51+ // NOTE: different behavior on iOS & Android:
52+ // iOS disables user interaction recursively for all subviews as well
53+ this . nativeViewProtected . setClickable ( value ) ;
54+ this . nativeViewProtected . setFocusable ( value ) ;
55+ this . nativeViewProtected . setScrollEnabled ( value ) ;
56+ }
57+
58+ [ isScrollEnabledProperty . getDefault ] ( ) : boolean {
59+ return this . nativeViewProtected . getScrollEnabled ( ) ;
60+ }
61+ [ isScrollEnabledProperty . setNative ] ( value : boolean ) {
62+ this . nativeViewProtected . setScrollEnabled ( value ) ;
63+ }
64+
4765 [ scrollBarIndicatorVisibleProperty . getDefault ] ( ) : boolean {
4866 return true ;
4967 }
@@ -57,7 +75,7 @@ export class ScrollView extends ScrollViewBase {
5775
5876 public scrollToVerticalOffset ( value : number , animated : boolean ) {
5977 const nativeView = this . nativeViewProtected ;
60- if ( nativeView && this . orientation === "vertical" ) {
78+ if ( nativeView && this . orientation === "vertical" && this . isScrollEnabled ) {
6179 value *= layout . getDisplayDensity ( ) ;
6280
6381 if ( animated ) {
@@ -70,7 +88,7 @@ export class ScrollView extends ScrollViewBase {
7088
7189 public scrollToHorizontalOffset ( value : number , animated : boolean ) {
7290 const nativeView = this . nativeViewProtected ;
73- if ( nativeView && this . orientation === "horizontal" ) {
91+ if ( nativeView && this . orientation === "horizontal" && this . isScrollEnabled ) {
7492 value *= layout . getDisplayDensity ( ) ;
7593
7694 if ( animated ) {
0 commit comments