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

Not cleared binding for dialog fragment #53

Open
Nilairan opened this issue Apr 8, 2021 · 2 comments
Open

Not cleared binding for dialog fragment #53

Nilairan opened this issue Apr 8, 2021 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Nilairan
Copy link

Nilairan commented Apr 8, 2021

I am create BottomSheetDialogFragment with using this libs
Example view binding
private val binding: BottomAccountDialogBinding by viewBinding(BottomAccountDialogBinding::bind)
In onCreateView returned view
inflater.inflate(R.layout.bottom_account_dialog, container, false)
I am open new fragment of dialog and after going back on dialog fragment using popBackStack, onCreateView method is called again but binding not cleared
I am see what onDestroyView is called but ViewBindingProperty not cleared my view binding
@MainThread public override fun clear() { mainHandler.post { viewBinding = null } }
This method not called for my BottomAccountDialogBinding
I'am see what DialogFragmentViewBindingProperty using fragment lifecycle but not view lifecycle
if (thisRef.showsDialog) { return thisRef } else { return thisRef.viewLifecycleOwner }
I'am tried change showsDialog parameter for my dialog fragment befor called binding in onViewCreated and in onDestroyView method and this is cleared binding else arises this problem
I think it's worth it return lifecycle for DialogFragmentViewBindingProperty

@kirich1409
Copy link
Collaborator

Please check the latest version (1.4.7)

@kirich1409 kirich1409 self-assigned this Jul 7, 2021
@kirich1409 kirich1409 added the bug Something isn't working label Jul 7, 2021
@raman-branavitski
Copy link

Doesn't work for me. Tried versions 1.4.7 and 1.5.0. If dialog fragment is used with showsDialog = true, viewBinding keeps references to old views after pop dialog from back stack.

@kirich1409 kirich1409 added this to the 1.6.0 milestone Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants