Skip to content

Commit

Permalink
Fix layout of header items on Android native stack. (#289)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kmagiera authored Jan 20, 2020
1 parent e840358 commit 8cf82d1
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public ScreenStackHeaderConfig(Context context) {
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();
Expand Down

0 comments on commit 8cf82d1

Please sign in to comment.