rajsuvariya / autocompletetextview

2 stars 5 forks source link

When change text to 0 length, the dropdown is not showing #13

Closed Noitidart closed 6 years ago

Noitidart commented 6 years ago

By default threshold is 0 because on click and focus we show dropdown even if empty.

However on text change, when text is 0 length it should show dropdown but it is not. I am trying to add this feature however I am having a tricky time accessing view. May you please advise:

            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
                WritableMap event = Arguments.createMap();
                event.putString("text", charSequence.toString());
                // ReactContext reactContext = (ReactContext) view.getContext();
                reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(
                        view.getId(),
                        "topChange",
                        event);

                // if (charSequence.length == 0) {
                //      ((MyAutoCompleteTextView)view).showDropDown(); // TODO:
                // }
            }

I'm trying to do the:

                // if (charSequence.length == 0) {
                //      ((MyAutoCompleteTextView)view).showDropDown(); // TODO:
                // }
Noitidart commented 6 years ago

Oh I corrected it to this, however its not working. I had to put a () on length.

            if (charSequence.length() == 0) {
                  ((MyAutoCompleteTextView)view).showDropDown();
            }