Fix onItemSelected firing for ReactPicker on initial layout.
Reviewed By: AaaChiuuu Differential Revision: D3732557 fbshipit-source-id: ed031dbf205996dab8cb0555af972e6f26c0d202
This commit is contained in:
parent
50e0d8e171
commit
a2a8d7f5da
|
@ -79,6 +79,10 @@ public class ReactPicker extends Spinner {
|
|||
|
||||
public void setOnSelectListener(@Nullable OnSelectListener onSelectListener) {
|
||||
if (getOnItemSelectedListener() == null) {
|
||||
// onItemSelected gets fired immediately after layout because checkSelectionChanged() in
|
||||
// AdapterView updates the selection position from the default INVALID_POSITION. To match iOS
|
||||
// behavior, we don't want the event emitter for onItemSelected to fire right after layout.
|
||||
mSuppressNextEvent = true;
|
||||
setOnItemSelectedListener(
|
||||
new OnItemSelectedListener() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue