Don't NPE in reactTagForTouch
Summary: This NPEs because the layout is null if the TextView has recently changed. However, this also means that the TextView hasn't been laid out yet, so the default TextView tag is correct. public Reviewed By: oli Differential Revision: D2848412 fb-gh-sync-id: 5faf793d17f50283c153dc0d43fb717e8764cb7d
This commit is contained in:
parent
89207a1171
commit
2a70c53947
|
@ -39,6 +39,11 @@ public class ReactTextView extends TextView implements ReactCompoundView {
|
|||
int y = (int) touchY;
|
||||
|
||||
Layout layout = getLayout();
|
||||
if (layout == null) {
|
||||
// If the layout is null, the view hasn't been properly laid out yet. Therefore, we can't find
|
||||
// the exact text tag that has been touched, and the correct tag to return is the default one.
|
||||
return target;
|
||||
}
|
||||
int line = layout.getLineForVertical(y);
|
||||
|
||||
int lineStartX = (int) layout.getLineLeft(line);
|
||||
|
|
Loading…
Reference in New Issue