Skip to content

Commit

Permalink
fix(android): fix Material3 BottomNavigation height
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga committed Sep 10, 2024
1 parent d98f6a6 commit 796f6eb
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.google.android.material.shape.ShapeAppearanceModel;

import org.appcelerator.kroll.common.Log;
import org.appcelerator.titanium.R;
import org.appcelerator.titanium.TiBaseActivity;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.TiDimension;
Expand Down Expand Up @@ -79,13 +80,18 @@ public void addTab(TabProxy tabProxy)
}
}

@SuppressLint("PrivateResource")
@Override
public void addViews(TiBaseActivity activity)
{
// Manually calculate the proper position of the BottomNavigationView.
int resourceID = activity.getResources().getIdentifier("design_bottom_navigation_height", "dimen",
activity.getPackageName());
this.mBottomNavigationHeightValue = activity.getResources().getDimensionPixelSize(resourceID);
this.mBottomNavigationHeightValue
= activity.getResources().getDimensionPixelSize(R.dimen.design_bottom_navigation_height);

if (activity.getTheme().toString().indexOf("Material3") > -1) {
this.mBottomNavigationHeightValue
= activity.getResources().getDimensionPixelSize(R.dimen.m3_bottom_nav_min_height);
}

// Fetch padding properties. If at least 1 property is non-zero, then show a floating tab bar.
final TiDimension paddingLeft = TiConvert.toTiDimension(
Expand Down

0 comments on commit 796f6eb

Please sign in to comment.