|
@@ -23,6 +23,7 @@ import com.reactnativenavigation.parse.TopTabsOptions;
|
23
|
23
|
import com.reactnativenavigation.parse.params.Button;
|
24
|
24
|
import com.reactnativenavigation.parse.params.Colour;
|
25
|
25
|
import com.reactnativenavigation.utils.ButtonPresenter;
|
|
26
|
+import com.reactnativenavigation.utils.CollectionUtils;
|
26
|
27
|
import com.reactnativenavigation.utils.ImageLoader;
|
27
|
28
|
import com.reactnativenavigation.utils.ObjectUtils;
|
28
|
29
|
import com.reactnativenavigation.utils.UiUtils;
|
|
@@ -69,6 +70,7 @@ public class StackPresenter {
|
69
|
70
|
private Map<Component, TopBarBackgroundViewController> backgroundControllers = new HashMap();
|
70
|
71
|
private Map<Component, Map<String, TitleBarButtonController>> componentRightButtons = new HashMap();
|
71
|
72
|
private Map<Component, Map<String, TitleBarButtonController>> componentLeftButtons = new HashMap();
|
|
73
|
+ private List<TitleBarButtonController> currentRightButtons = new ArrayList<>();
|
72
|
74
|
|
73
|
75
|
public StackPresenter(Activity activity,
|
74
|
76
|
TitleBarReactViewCreator titleViewCreator,
|
|
@@ -278,8 +280,12 @@ public class StackPresenter {
|
278
|
280
|
if (rightButtons != null) {
|
279
|
281
|
List<TitleBarButtonController> rightButtonControllers = getOrCreateButtonControllers(componentRightButtons.get(child), rightButtons);
|
280
|
282
|
componentRightButtons.put(child, keyBy(rightButtonControllers, TitleBarButtonController::getButtonInstanceId));
|
281
|
|
- topBar.setRightButtons(rightButtonControllers);
|
|
283
|
+ if (!CollectionUtils.equals(currentRightButtons, rightButtonControllers)) {
|
|
284
|
+ currentRightButtons = rightButtonControllers;
|
|
285
|
+ topBar.setRightButtons(rightButtonControllers);
|
|
286
|
+ }
|
282
|
287
|
} else {
|
|
288
|
+ currentRightButtons = null;
|
283
|
289
|
topBar.clearRightButtons();
|
284
|
290
|
}
|
285
|
291
|
|
|
@@ -370,7 +376,12 @@ public class StackPresenter {
|
370
|
376
|
if (previousLeftButtons != null) forEach(previousLeftButtons.values(), TitleBarButtonController::destroy);
|
371
|
377
|
}
|
372
|
378
|
|
373
|
|
- if (buttons.right != null) topBar.setRightButtons(rightButtonControllers);
|
|
379
|
+ if (buttons.right != null) {
|
|
380
|
+ if (!CollectionUtils.equals(currentRightButtons, rightButtonControllers)) {
|
|
381
|
+ currentRightButtons = rightButtonControllers;
|
|
382
|
+ topBar.setRightButtons(rightButtonControllers);
|
|
383
|
+ }
|
|
384
|
+ }
|
374
|
385
|
if (buttons.left != null) topBar.setLeftButtons(leftButtonControllers);
|
375
|
386
|
if (buttons.back.hasValue()) topBar.setBackButton(createButtonController(buttons.back));
|
376
|
387
|
|