You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@weex.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/06/29 03:57:00 UTC

[jira] [Commented] (WEEX-487) Slider控件设置scrollable="false"在android上无法禁止滑动

    [ https://issues.apache.org/jira/browse/WEEX-487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16527144#comment-16527144 ] 

ASF GitHub Bot commented on WEEX-487:
-------------------------------------

GitHub user luckybilly opened a pull request:

    https://github.com/apache/incubator-weex/pull/1302

    [WEEX-487][Android] bug fix: scrollable="false" not work on android

    [WEEX-487][Android] bug fix: scrollable="false" not work on android
    
    issue: [[WEEX-487]](https://issues.apache.org/jira/browse/WEEX-487)
    
    remove `mAdapter.getRealCount() > 0` from [WXSlider.setScrollable(boolean scrollable)](https://github.com/apache/incubator-weex/blob/master/android/sdk/src/main/java/com/taobao/weex/ui/component/WXSlider.java#L403:10)
    ```java
      @WXComponentProp(name = Constants.Name.SCROLLABLE)
      public void setScrollable(boolean scrollable) {
        if (mViewPager != null && mAdapter != null) {
          if(mAdapter.getRealCount() > 0){ //remove this line, because there is no data when init slider
            mViewPager.setScrollable(scrollable);
          }
        }
      }
    ```


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/luckybilly/incubator-weex fix-slider-scrollable

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-weex/pull/1302.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1302
    
----
commit c64bda5c3f20c38b5d9eea8497a2b475fdddb394
Author: qiyi <qi...@...>
Date:   2018-06-29T03:48:39Z

    [WEEX-487][Android] bug fix: scrollable="false" not work on android

----


> Slider控件设置scrollable="false"在android上无法禁止滑动
> -------------------------------------------
>
>                 Key: WEEX-487
>                 URL: https://issues.apache.org/jira/browse/WEEX-487
>             Project: Weex
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 0.18
>            Reporter: billy
>            Assignee: codefurture
>            Priority: Major
>
> 需求是实现一个导航tab + 多个页面进行切换,但希望禁用其滑动手势,通过导航tab切换index
> 使用Slider控件,但按照文档设置scrollable="false"在Android设备上并没有禁用滑动手势,发现网上也有人遇到同样的问题: [https://segmentfault.com/q/1010000014254067]
> 查看WXSlider的源码发现:在setScrollable方法中进行了判断:
> if(mAdapter.getRealCount() > 0) {  
>       mViewPager.setScrollable(scrollable);
> }
> 在刚创建的时候getRealCount()为0,所以未生效,我们现在采用的临时方案是在mounted回调函数中设置Slider的scrollable属性
> 这个mAdapter.getRealCount() > 0的判断是否可以移除呢?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)