Skip to content

Commit

Permalink
[TIMOB-24639] Fix Ti.UI.SearchBar
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Mathews committed Aug 28, 2017
1 parent 98802f6 commit f4d7a3f
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import ti.modules.titanium.ui.widget.TiUIText;
import android.graphics.drawable.Drawable;
import android.support.design.widget.TextInputLayout;
import android.support.v4.widget.NestedScrollView;
import android.text.TextUtils.TruncateAt;
import android.view.Gravity;
import android.view.KeyEvent;
Expand Down Expand Up @@ -48,11 +49,18 @@ public TiUISearchBar(final TiViewProxy proxy)

View nativeView = getNativeView();
if (nativeView instanceof EditText) {
this.tv = (EditText)nativeView;
} else if (nativeView instanceof TextInputLayout) {
this.tv = ((TextInputLayout)nativeView).getEditText();
} else {
throw new IllegalStateException();
this.tv = (EditText) nativeView;
} else if (nativeView instanceof NestedScrollView) {
NestedScrollView nestedScrollView = (NestedScrollView) nativeView;
if (nestedScrollView.getChildCount() == 1) {
View child = nestedScrollView.getChildAt(0);
if (child instanceof TextInputLayout) {
this.tv = ((TextInputLayout) child).getEditText();
}
}
}
if (this.tv == null) {
throw new Error("could not obtain EditText component");
}

this.tv.setImeOptions(EditorInfo.IME_ACTION_DONE);
Expand Down

0 comments on commit f4d7a3f

Please sign in to comment.