Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix an issue with removeClippedSubviews and TextInput
Summary:This issue was found by brentvatne in #6805 The problem is an ordering issue. The internal state of the TextView (Editor) is updated when we set the text value for a ReactTextInput. When removeClippedSubviews is false, we addView the view which attaches it to the window, and then set the text. When removeClippedSubviews is false, we defer adding the view (caching it in mAllChildren in ReactViewGroup) until we know whether the view is actually going to show. This means when we set the initial text, that there is no window attached. Not having a window attached means that the Editor can't display the popup for PASTE and thinks that the text is not selectable and won't respond to the long press. To fix this we explicitly call setTextIsSelectable in onAttachedToWindow. This will cause the underlying TextView to have the Editor update and all will be in agreement. Note: This also makes it really easy to expose a selectable property on both Text and TextInput at the js level now. Reviewed By: andreicoman11 Differential Revision: D3173631 fb-gh-sync-id: a208214474a92ecc1277b3be0d38e2ef9327ea2e fbshipit-source-id: a208214474a92ecc1277b3be0d38e2ef9327ea2e
- Loading branch information