소스 검색

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 년 전
부모
커밋
ecb6588f62
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3
    0
      android/app/src/main/java/com/reactnativenavigation/activities/BaseReactActivity.java

+ 3
- 0
android/app/src/main/java/com/reactnativenavigation/activities/BaseReactActivity.java 파일 보기

@@ -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