Mohamadjavad Vakili
Mohamadjavad Vakili

Reputation: 3348

NativeScript how change layout direction in scrollView

I have this ScrollView:

<ScrollView orientation="horizontal" horizontalAlignment="center" android:layoutDirection="rtl">

I try change direction scrollView , but not work for me.

But exist private function isLayoutRtl in tns-core-modules-widgets

private boolean isLayoutRtl() {
        return (this.getLayoutDirection() == LAYOUT_DIRECTION_RTL);
}

I can change orientation horizontal ,But not change scroll rtl. mor information visit link.

How change directoin RTL scroll in scroll View?

Tanks

Upvotes: 1

Views: 543

Answers (3)

Aly Radwan
Aly Radwan

Reputation: 209

try to add css transform: scaleX(-1.0) to scrollview

Upvotes: -1

Ali
Ali

Reputation: 11

I searched a lot and didn't find an official solution. But to keep things working, scroll to the end of the scrollView after loading it:

onScrollViewLoaded(){
  setTimeout(()=>{
    let scrollView = this.$refs.scrollView.nativeView;
    scrollView.scrollToHorizontalOffset(scrollView.scrollableWidth, false)
  },1);
},

Upvotes: 1

Eddy Verbruggen
Eddy Verbruggen

Reputation: 3550

The direction can be set by the orientation property. Is that indeed what you need? https://docs.nativescript.org/api-reference/classes/_ui_scroll_view_.scrollview.html#orientation

Upvotes: 2

Related Questions