Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

解决scrollview滑动不流畅 #44

Open
jinjiantong opened this issue Jul 3, 2019 · 7 comments
Open

解决scrollview滑动不流畅 #44

jinjiantong opened this issue Jul 3, 2019 · 7 comments

Comments

@jinjiantong
Copy link

jinjiantong commented Jul 3, 2019

RCTScrollView.m 里找到这个方法

  • (void)handleCustomPan:(__unused UIPanGestureRecognizer *)sender
    {
    //改动地方在这里
    if ([self _shouldDisableScrollInteraction] && ![NSStringFromClass([RCTUIManager JSResponder].class) isEqualToString:@"RCTScrollView"]) {
    self.panGestureRecognizer.enabled = NO;
    self.panGestureRecognizer.enabled = YES;
    // TODO: If mid bounce, animate the scroll view to a non-bounced position
    // while disabling (but only if stopScrollInteractionIfJSHasResponder was
    // called during a pan). Currently, it will just snap into place which
    // is not so bad either.
    // Another approach:
    // self.scrollEnabled = NO;
    // self.scrollEnabled = YES;
    }
    }
@jinjiantong jinjiantong changed the title scrollview滑动不流畅 解决scrollview滑动不流畅 Jul 3, 2019
@geniu-vs
Copy link

geniu-vs commented Jul 4, 2019

不是这里的原因,改了没用。
是外部下拉的scrollView和FlatList的scrollView手势重叠了,
最终都是作用到RCTScrollView上,
我把MJScrollView.js里的onScrollShouldSetResponder: this.scrollResponderHandleScrollShouldSetResponder,(触摸开始时是否成为响应者)
这句话注释掉就可以了,
但是注释掉后带下拉的sectionList又滑不动了,
所以我现在还没找到一个好的解决方案。

@geniu-vs
Copy link

geniu-vs commented Jul 8, 2019

onScrollShouldSetResponder: () => false, sectionList卡顿是因为我在外层使用了react-native-scrollable-tab-view,按照 #20 修改下就好了,不过滑动还是有一点点问题,就是如果里面的FlatList先上滑再下滑,不会触发下拉刷新,因为手势还是作用在FlatList上,要松一次再下拉,手势才会定在外层ScrollView上。

@geniu-vs
Copy link

这样改有个问题,由于onScrollShouldSetResponder手势被拦截,在左右滑动的时候就会触发list的item点击事件,左右滑动会进入二级页面,对于使用了ScrollableTabView的页面是可怕的,所以这个方案无效

@woshi82
Copy link

woshi82 commented Aug 6, 2019

最近我也遇到这个问题~ 所以最后是怎么解决的呢?

@woshi82
Copy link

woshi82 commented Aug 6, 2019

提主的方式有效~值得一试。 仔细看了下我用的Flatlist 中的ScrollView 是我自定义的xxScrollView, 此时就会出现 IOS 滚动不顺滑的现象。

@BleachCC
Copy link

我是单层的Flatlist,使用楼主的方法得到了解决

@MackJac
Copy link

MackJac commented Nov 19, 2019

is userful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants