Skip to content

Commit

Permalink
Fix onItemSelected firing for ReactPicker on initial layout.
Browse files Browse the repository at this point in the history
Reviewed By: AaaChiuuu

Differential Revision: D3732557

fbshipit-source-id: ed031dbf205996dab8cb0555af972e6f26c0d202
  • Loading branch information
donyu authored and Facebook Github Bot 2 committed Aug 18, 2016
1 parent 50e0d8e commit a2a8d7f
Showing 1 changed file with 4 additions and 0 deletions.
Expand Up @@ -79,6 +79,10 @@ public void requestLayout() {

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
Expand Down

0 comments on commit a2a8d7f

Please sign in to comment.