Przeglądaj źródła

Emit BottomTabSelected event also when tab is reselected

Guy Carmeli 6 lat temu
rodzic
commit
53dcb3e850

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java Wyświetl plik

@@ -116,8 +116,8 @@ public class BottomTabsController extends ParentController implements AHBottomNa
116 116
 
117 117
     @Override
118 118
     public boolean onTabSelected(int index, boolean wasSelected) {
119
-        if (wasSelected) return false;
120 119
         eventEmitter.emitBottomTabSelected(bottomTabs.getCurrentItem(), index);
120
+        if (wasSelected) return false;
121 121
         selectTab(index);
122 122
         return false;
123 123
 	}

+ 1
- 1
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/BottomTabsControllerTest.java Wyświetl plik

@@ -140,7 +140,7 @@ public class BottomTabsControllerTest extends BaseTest {
140 140
         uut.ensureViewIsCreated();
141 141
         assertThat(uut.getSelectedIndex()).isZero();
142 142
 
143
-        uut.onTabSelected(0, false);
143
+        uut.onTabSelected(0, true);
144 144
 
145 145
         assertThat(uut.getSelectedIndex()).isEqualTo(0);
146 146
         assertThat(((ViewController) ((List) uut.getChildControllers()).get(0)).getView().getParent()).isNotNull();