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

上拉加载出现异常 #1

Open
toutyeung opened this issue Apr 22, 2020 · 8 comments
Open

上拉加载出现异常 #1

toutyeung opened this issue Apr 22, 2020 · 8 comments

Comments

@toutyeung
Copy link

toutyeung commented Apr 22, 2020

你好
我将FooterRefresh属性添加到ScrollView上,但是View在最底部.
没有上拉到一定高度,切换到其他View的时候,updata函数出现nil错误.

func update(proxy: GeometryProxy, value: Refresh.FooterAnchorKey.Value) {
guard let item = value.first else { return }
guard headerUpdate.progress == 0 else { return }

    let bounds = proxy[item.bounds]

在取得bounds的时候出现nil错误

@wxxsw
Copy link
Owner

wxxsw commented Apr 22, 2020

你好,你说添加到 ScrollView 上,是这样吗?

List {
    ScrollView {
        RefreshFooter(refreshing: $footerRefreshing, action: {
            ...
        })
    }
}
.enableRefresh()

我没能复现出错误,能提供一下复现错误的条件或者代码吗?

@toutyeung
Copy link
Author

我没有重写代码,只是把上拉下拉加载的属性直接添加到ScrollView上

ScrollView{

VStack{

    View1()
    View2()
    View3()
    View4()
    View5()
    RefreshFooter(refreshing: $footerRefreshing, action: {
        ...
    })
}

}.modifier(Refresh.Modifier(enable: true))

加载后的数据是添加到View5里面,但是没有显示View5时候,切换到其他View就会有错误
但是,只有View1的时候是没有问题的

@wxxsw
Copy link
Owner

wxxsw commented Apr 23, 2020

😅原来你这么用的,我一直都是为 List 开发的,还没有适配过 ScrollView,所以也没添加 ScrollView 的扩展,我周末有时间试下,如果方便的话,我会适配一下

@toutyeung
Copy link
Author

我也用过你的方法,把ScrollView放在List里,然后给List添加enableRefresh属性,还是同样的错误.

下面这个没有问题

ScrollView{

VStack{

View1()
RefreshFooter(refreshing: $footerRefreshing, action: {
    ...
})

}
}.modifier(Refresh.Modifier(enable: true))

@wxxsw
Copy link
Owner

wxxsw commented Apr 23, 2020

放到 List 里面的时候,不嵌套 VStack 试下呢?

@toutyeung
Copy link
Author

还是同样的错误。

@HT0799
Copy link

HT0799 commented Nov 13, 2020

你好,我也遇到了同样的错误,请问有解决方法吗?

@wxxsw
Copy link
Owner

wxxsw commented Nov 13, 2020

能否提供一个可以复现错误的小 Demo(可以上传到你自己的 Github 上,或者发到我的邮箱 i@gesen.me)。我收到后,明后天会解决一下。

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

3 participants