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

安卓偶现Tab内容为空 #1167

Open
mengai123 opened this issue Dec 10, 2021 · 0 comments
Open

安卓偶现Tab内容为空 #1167

mengai123 opened this issue Dec 10, 2021 · 0 comments

Comments

@mengai123
Copy link

mengai123 commented Dec 10, 2021

问题:安卓偶现Tab内容为空

问题表现:页面有3个Tab,切换到最后一个Tab3,点击Tab3内的按钮,跳转其他页面,过一段时间(大概10分钟左右),返回Tab3页面,发现仅仅Tab3页面有内容,Tab1和Tab2页面只有tab标题,没有内容,问题不是必现。

阅读源码后发现,怀疑与下面这句代码有关,因为我遇到的问题和三目运算符走到了else的表现情况一模一样

代码的位置:

{this._keyExists(this.state.sceneKeys, key) ? child : <View tabLabel={child.props.tabLabel}/>}

_shouldRenderSceneKey(idx, currentPageKey) {
    return true;

上面这个函数,也直接写死了返回return true或则prerenderingSiblingsNumber会给一个很大的数,也就是所有的页面都会被渲染,不会出现页面不渲染的情况。

有遇到同样问题的吗,该怎么解决呢?

另外:请问什么情况下,_composeScenes函数中的this._keyExists(this.state.sceneKeys, key)会为false呢?

欢迎交流。

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

1 participant