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

在 Fragment 下,State與Event監聽事件該放置在哪個生命週期? #4

Open
azrael8576 opened this issue May 17, 2023 · 0 comments

Comments

@azrael8576
Copy link

在Fragment導航至別頁回退回此頁後會重新,創建視圖。

onCreateView()
onViewCreated()

在這兩個生命週期中註冊。
會導致回退時重複註冊監聽。

進而重複觸發狀態更新,事件導航(導致閃退)

可否推薦一個作法
移至onCreate監聽、或在onDestroyView 註銷監聽、或有更合適的作法?

另外我是新手使用妳的Flow擴展類,若推薦註銷監聽可否提供基於封裝後的實踐方法?

感謝

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