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

Fix Chat Input Crashes on Android #20058

Merged
merged 4 commits into from
Oct 2, 2019

Commits on Oct 1, 2019

  1. Fix Chat Input Crashes on Android

    The input was crashing when you sent messages that had modified the
    native selection props. It crashed when you cleared the text because it
    would set the text to empty, and reused a cached selection that was out
    of bounds of an empty string.
    
    For example, say you type "hello @" and autocomplete to "hello @foo". We
    do some text selection magic to insert the @foo and put your cursor in
    the correct spot. The Selection start and end indicies are both 11. When
    you submit to message, we clear the text. When we clear the text, RN
    keeps reusing those selection indices (of 11) and Android complains the
    selection is outside of the bounds of the text ("" has a length of 0,
    but you want to move the cursor to position 11, outside the bounds of
    0).
    
    The workaround here is to set the selection at the same time as the
    text.
    
    The RN Issue is: facebook/react-native#25265
    MarcoPolo committed Oct 1, 2019
    Configuration menu
    Copy the full SHA
    57dae8d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    129e4e7 View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2019

  1. Update comment

    MarcoPolo committed Oct 2, 2019
    Configuration menu
    Copy the full SHA
    5ca017c View commit details
    Browse the repository at this point in the history
  2. Set lastNativeSelection

    MarcoPolo committed Oct 2, 2019
    Configuration menu
    Copy the full SHA
    09bd3b4 View commit details
    Browse the repository at this point in the history