diff --git a/lib/android/app/src/main/java/com/reactnativenavigation/views/titlebar/TitleBar.java b/lib/android/app/src/main/java/com/reactnativenavigation/views/titlebar/TitleBar.java index 4fb97d4b895..038b3f2d366 100644 --- a/lib/android/app/src/main/java/com/reactnativenavigation/views/titlebar/TitleBar.java +++ b/lib/android/app/src/main/java/com/reactnativenavigation/views/titlebar/TitleBar.java @@ -38,6 +38,12 @@ public TitleBar(Context context) { setContentDescription("titleBar"); } + @Override + public void onViewAdded(View child) { + super.onViewAdded(child); + enableOverflowForReactButtonViews(child); + } + @Override public void setTitle(CharSequence title) { clearComponent(); @@ -210,4 +216,10 @@ public void setOverflowButtonColor(int color) { } } } + + private void enableOverflowForReactButtonViews(View child) { + if (child instanceof ActionMenuView) { + ((ViewGroup) child).setClipChildren(false); + } + } } diff --git a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TitleBarTest.java b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TitleBarTest.java index 73959c50088..fceaa65fb58 100644 --- a/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TitleBarTest.java +++ b/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TitleBarTest.java @@ -1,29 +1,22 @@ package com.reactnativenavigation.viewcontrollers; -import android.app.Activity; -import android.view.View; - -import com.reactnativenavigation.BaseTest; -import com.reactnativenavigation.parse.params.Button; -import com.reactnativenavigation.parse.params.Text; -import com.reactnativenavigation.react.Constants; -import com.reactnativenavigation.react.ReactView; -import com.reactnativenavigation.utils.CollectionUtils; -import com.reactnativenavigation.views.titlebar.TitleBar; - -import org.junit.Test; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static com.reactnativenavigation.utils.TitleBarHelper.createButtonController; -import static org.assertj.core.api.Java6Assertions.assertThat; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; +import android.app.*; +import android.support.v7.widget.*; +import android.view.*; + +import com.reactnativenavigation.*; +import com.reactnativenavigation.parse.params.*; +import com.reactnativenavigation.react.*; +import com.reactnativenavigation.utils.*; +import com.reactnativenavigation.views.titlebar.*; + +import org.junit.*; + +import java.util.*; + +import static com.reactnativenavigation.utils.TitleBarHelper.*; +import static org.assertj.core.api.Java6Assertions.*; +import static org.mockito.Mockito.*; public class TitleBarTest extends BaseTest { @@ -31,14 +24,12 @@ public class TitleBarTest extends BaseTest { private Button leftButton; private Button textButton; private Button customButton; - private Map buttonControllers; private Activity activity; @Override public void beforeEach() { activity = newActivity(); createButtons(); - buttonControllers = new HashMap<>(); uut = spy(new TitleBar(activity)); } @@ -105,6 +96,13 @@ public void setComponent_addsComponentToTitleBar() { verify(uut).addView(component); } + @Test + public void addView_overflowIsEnabledForButtonsContainer() { + ActionMenuView buttonsContainer = mock(ActionMenuView.class); + uut.addView(buttonsContainer); + verify(buttonsContainer).setClipChildren(false); + } + @Test public void clear() { View title = new View(activity);