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

DialogFragment中收不到信息 #34

Closed
mxdlsm opened this issue Aug 22, 2022 · 2 comments
Closed

DialogFragment中收不到信息 #34

mxdlsm opened this issue Aug 22, 2022 · 2 comments

Comments

@mxdlsm
Copy link

mxdlsm commented Aug 22, 2022

大佬我在Fragment中setValue,为什么在DialogFragment弹窗中收不到信息?

@KunMinX
Copy link
Owner

KunMinX commented Aug 22, 2022

UnPeekLiveData 设计为新订阅不自动 replay 数据。

弹窗 Observe 时机晚于 fragment setValue 时机,故难接收。

页面通信通常建议向上级传递,例如 dialog set,页面接收,而不是反过来。

如需向 dialog 传初值,建议考虑原生 bundle argument 方式。

@mxdlsm
Copy link
Author

mxdlsm commented Aug 22, 2022

好的谢谢您

@mxdlsm mxdlsm closed this as completed Aug 22, 2022
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

2 participants