Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Chat Input Crashes on Android (keybase#20058)
* 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 * Apply changes to iOS as well * Update comment * Set lastNativeSelection
- Loading branch information