mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-09 17:23:18 +08:00
Fix layout of header items on Android native stack. (#289)
This change fixes the issue when left item added to native stack header on Android would by default be shifted from the screen edge by some amount. This turned out to be the default config of the native toolbar which applies some padding on the left side. WIn this change we reset that padding to always be 0 to let the position be specified from react. Note that the setting we reset does not influence the position of the native back navigation button as Android does not apply the padding in case navigation back icon is rendered.
This commit is contained in:
committed by
GitHub
parent
e8403582ae
commit
8cf82d1cbe
@@ -51,6 +51,10 @@ public class ScreenStackHeaderConfig extends ViewGroup {
|
||||
setVisibility(View.GONE);
|
||||
|
||||
mToolbar = new Toolbar(context);
|
||||
// reset content insets to be 0 to allow react position custom navbar views. Note that this does
|
||||
// not affect platform native back button as toolbar does not apply left inset when navigation
|
||||
// button is specified
|
||||
mToolbar.setContentInsetsAbsolute(0, 0);
|
||||
|
||||
// set primary color as background by default
|
||||
TypedValue tv = new TypedValue();
|
||||
|
||||
Reference in New Issue
Block a user