Browse Source

Fix no buttons bug for first screen

Due to race condition between SetupToolbarButtonsTask and
onCreateOptionsMenu buttons did not get set for first pushed screen.
In order to set buttons we need a ref to Menu which is set in
onCreateOptionsMenu. Sometimes onCreateOptionsMenu got called after
onCreate of our activity where we setup the toolbar.
Guy Carmeli 8 years ago
parent
commit
ecb6588f62

+ 3
- 0
android/app/src/main/java/com/reactnativenavigation/activities/BaseReactActivity.java View File

@@ -258,6 +258,9 @@ public abstract class BaseReactActivity extends AppCompatActivity implements Def
258 258
     @Override
259 259
     public boolean onCreateOptionsMenu(Menu menu) {
260 260
         mMenu = menu;
261
+        if (mToolbar != null) {
262
+            mToolbar.setupToolbarButtonsAsync(getCurrentScreen());
263
+        }
261 264
         return super.onCreateOptionsMenu(menu);
262 265
     }
263 266