Status Update
Comments
il...@google.com <il...@google.com> #2
Wow, it seems like a very important bug to fix.
Doing some investigations...
It works fine with CoreTextField as well as BaseTextField.
ch...@gmail.com <ch...@gmail.com> #3
Seems to be a duplicate of
il...@google.com <il...@google.com> #4
It works fine with Material TextFields (both filled and outline) if you use TextFieldValue based overloads.
It doesn't work when you use String based overloads however (both Outline and Filled). I believe this is related to the one-frame lag as we host TextFieldValue internally and proxy only string.
ch...@gmail.com <ch...@gmail.com> #5
Chatted with Anastasia.
We have this code
// "value: String" comes as a param in TextField
TextFieldImpl(
type = TextFieldType.Outlined,
value = textFieldValue,
onValueChange = {
selection = it.selection
composition = it.composition
if (value != it.text) {
onValueChange(it.text)
}
},
and this value is always ""
for me, as it's captured my lambda when lambda was created and this lambda is saved and reused by CoreTextField.
Anyway, two things we can do:
- Remove this if and invoke
onValueChange
everytime, even on the selection change (which we don't care about). This will allow us to workaround quickly and not to let it slip through. - Find and implement the proper fix in CoreTextField
Let me know what you think
ap...@google.com <ap...@google.com> #6
Updated the details here
il...@google.com <il...@google.com> #7
Just a note that this issue affects String overrides of both material text fields as well as any custom String override text fields that developer might create on top of CoreTextField/BaseTextField.
Description
I have two Activities, MainActivity and SecondActivity. Using Navigation architecture in MainActivity, which has two fragments, such as HomeFragment and DetailFragment, the Navigation diagram is declared as follows:
Generate ViewModels in the DetailFragment onCreate with "by navGraphViewModels".
There is a button in DetailFragment, clicking it will jump to SecondActivity, when "Do not keep background Activity" is enabled, pressing the back button in SecondActivity will trigger the program crash:
If I put the vm creation declaration in the onViewCreated lifecycle or later, there will be no crashes.
Does "by navGraphViewModels" necessarily require the user to use it this way?
In my opinion, as long as the NavBackStackEntry viewModelStore corresponding to "R.id.navigation_home_flow" is in the CREATED state, it's OK, not the DetailFragment.
The Navigation version I use is 2.4.0-alpha06.
Thanks in advance if you can address my issue.