Skip to content

Reset the focused field state if a paragraph gets replaced with a non-editable block#421

Closed
mzorz wants to merge 2 commits intorelease/0.3from
issue/415-fix-textinputstate-focused-on-replace
Closed

Reset the focused field state if a paragraph gets replaced with a non-editable block#421
mzorz wants to merge 2 commits intorelease/0.3from
issue/415-fix-textinputstate-focused-on-replace

Conversation

@mzorz
Copy link
Copy Markdown
Contributor

@mzorz mzorz commented Dec 20, 2018

Fixes #415

The problem was that when we were replacing a Paragraph block, the TextInputState.focusedField member would still keep track of the now gone block, and thus the next time we tried to blur the supposedly "focused field" by calling TextInputState.blurTextInput( currentlyFocusedTextInput ) the app would run into an error.

This PR fixes that by resetting the focus (clearing it with blur) when doing the replace, so there's no longer a reference to a node that doesn't exist anymore.

To test:

  1. tap the + inserter icon and choose a paragraph block
  2. once the paragraph block appears and gets the focus (keyboard is up as well), tap the + inserter icon again
  3. now choose an Image block
  4. observe the Paragraph block gets replaced with the new Image block
  5. now tap on the image block
  6. it should not crash

Test the same with content, without content, in different parts, and also try the page break block.

@mzorz mzorz added this to the Alpha milestone Dec 20, 2018
@mzorz mzorz requested review from daniloercoli and koke December 20, 2018 17:24
@mzorz mzorz changed the base branch from master to release/0.3 December 20, 2018 17:27
@mzorz
Copy link
Copy Markdown
Contributor Author

mzorz commented Dec 20, 2018

Closing in favor of #423 due to the reasons expressed in #423 (comment)

@mzorz mzorz closed this Dec 20, 2018
@mzorz mzorz deleted the issue/415-fix-textinputstate-focused-on-replace branch December 20, 2018 18:16
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

Successfully merging this pull request may close these issues.

1 participant