Closed equeim closed 2 years ago
androidx.lifecycle 2.5 added new API for easier creation of custom ViewModel factories. It needs some integration from this library.
Namely, NavHostEntry needs to override getDefaultViewModelCreationExtras() method to set default CreationExtras keys that users expect to be present (application, saved state registry owner, etc). Here is how ComponentActivity does that: https://github.com/androidx/androidx/blob/7f29447f3add52b6db69524dfa944dd1b0a8828b/activity/activity/src/main/java/androidx/activity/ComponentActivity.java#L641
Support added in 1.2.0.
androidx.lifecycle 2.5 added new API for easier creation of custom ViewModel factories. It needs some integration from this library.
Namely, NavHostEntry needs to override getDefaultViewModelCreationExtras() method to set default CreationExtras keys that users expect to be present (application, saved state registry owner, etc). Here is how ComponentActivity does that: https://github.com/androidx/androidx/blob/7f29447f3add52b6db69524dfa944dd1b0a8828b/activity/activity/src/main/java/androidx/activity/ComponentActivity.java#L641