fix: crashing message composer input [WPB-8727] 🍒 #2997
Closed
+336
−24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR was automatically cherry-picked based on the following PR:
Original PR description:
PR Submission Checklist for internal contributors
The PR Title
SQPIT-764
The PR Description
What's new in this PR?
Issues
The app is crashing sometimes when clicking on the message composer input.
Causes (Optional)
Changing
readOnly
parameter probably messes something up with the inner text field state so that it ends up withjava.lang.IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true
.Solutions
Getting rid of
readOnly
is not possible because it was introduced some time ago to fix some other issues that we had with message composer and keyboard.New
BasicTextField2
resolves multiple issues that the previous generation of text input had, including this one.BasicTextField2
has been renamed to regularBasicTextField
in newest compose library; the difference is that new one takesTextFieldState
instead ofTextFieldValue
orString
.We decided to use this new version of text field for the message composer. In order to do that, a new hybrid
WireTextField2
is created which allows us to use the new generation of text input but also to still passTextFieldValue
andonValueChanged
callback to make this refactor as minimally invasive as possible. ThisWireTextField2
usesStateSyncingModifier
which is based on composeBasicTextFieldWithValueOnValueChangeSample
which allows to synchronise betweenTextFieldState
andTextFieldValue
withonValueChanged
callback.It's needed to update the
compose-foundation
library to1.7.0-alpha05
, from whichBasicTextField2
has been marked as stable and still olderBasicTextField
is available. In versions prior to chosen one, including current newest release version -1.6.7
,BasicTextField2
has some bad issues with the keyboard (https://issuetracker.google.com/issues/339171226) and interaction source (https://issuetracker.google.com/issues/327665606). To use this version,rememberRipple()
needs to be updated toripple()
andAnchoredDraggableState
also requiresdecayAnimationSpec
.Testing
How to Test
Open conversation screen and click on message composer input right after navigating, preferably on Graphene OS.
PR Post Submission Checklist for internal contributors (Optional)
PR Post Merge Checklist for internal contributors
References
feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764
.