Skip to content

feat(Android, Stack v5): expose contentInsetStart, contentInsetEnd for toolbar - #4516

Open
kligarski wants to merge 4 commits into
@kligarski/stack-v5-android-header-max-linesfrom
@kligarski/stack-v5-android-header-margins
Open

feat(Android, Stack v5): expose contentInsetStart, contentInsetEnd for toolbar#4516
kligarski wants to merge 4 commits into
@kligarski/stack-v5-android-header-max-linesfrom
@kligarski/stack-v5-android-header-margins

Conversation

@kligarski

@kligarski kligarski commented Aug 18, 2026

Copy link
Copy Markdown
Member

Description

Exposes contentInsetStart, contentInsetEnd props to control the content inset. It can be used as a workaround for broken entireSpace gravity mode. More info in #4387.

Closes https://github.com/software-mansion/react-native-screens-labs/issues/1742.

Changes

  • expose the prop in JS and native side
  • capture default values for insets in StackHeaderAppBarLayout and use them when no value is provided
  • add content inset and menu items configurations to subviews SFT

Before & after - visual documentation

4516.mp4

Test plan

Run test-stack-header-content-insets-android, test-stack-subviews-android.

Checklist

  • Included code example that can be used to test this change.
  • For visual changes, included screenshots / GIFs / recordings documenting the change.
  • For API changes, updated relevant public types.
  • Ensured that CI passes

Stack created with GitHub Stacks CLIGive Feedback 💬

@kligarski
kligarski requested a balanced review from Copilot August 18, 2026 13:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds Android toolbar content inset customization for stack headers, exposing start/end inset props through the JS types and wiring them into the native toolbar layout.

Changes:

  • Added contentInsetStart / contentInsetEnd props to the Android StackHeader config (TS + Fabric native component).
  • Implemented native invalidation + applicator logic to apply toolbar content insets.
  • Updated the Android subviews test scenario and UI to exercise content insets and menu-item interactions.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/fabric/stack/StackHeaderConfigAndroidNativeComponent.ts Exposes new Fabric props for toolbar content insets.
src/components/stack/header/StackHeaderConfig.android.types.ts Documents and types new Android-only props.
apps/src/tests/single-feature-tests/stack-v5/test-stack-subviews-android/scenario.md Expands scenario notes to cover inset behavior and interactions.
apps/src/tests/single-feature-tests/stack-v5/test-stack-subviews-android/index.tsx Adds UI controls to set insets and menu items for manual verification.
android/src/main/java/com/swmansion/rnscreens/stack/header/config/StackHeaderInvalidationFlags.kt Introduces a new invalidation flag for inset updates.
android/src/main/java/com/swmansion/rnscreens/stack/header/config/StackHeaderConfigurationProviding.kt Adds inset values to the configuration provider contract.
android/src/main/java/com/swmansion/rnscreens/stack/header/config/StackHeaderConfigViewManager.kt Bridges inset props from JS to native config.
android/src/main/java/com/swmansion/rnscreens/stack/header/config/StackHeaderConfig.kt Stores inset values and triggers invalidation when they change.
android/src/main/java/com/swmansion/rnscreens/stack/header/appbar/StackHeaderAppBarLayout.kt Attempts to capture Material default insets for fallback behavior.
android/src/main/java/com/swmansion/rnscreens/stack/header/StackHeaderCoordinatorLayout.kt Applies inset updates when invalidated.
android/src/main/java/com/swmansion/rnscreens/stack/header/StackHeaderApplicator.kt Applies insets to the MaterialToolbar using dp→px conversion.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@kligarski
kligarski force-pushed the @kligarski/stack-v5-android-header-margins branch from 6c6e0f7 to 4a69bf5 Compare August 19, 2026 07:32

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating the example, shouldn't we consider updating the scenario as well? For now, testing this property might be omitted by accident.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scenario doesn't contain any steps yet because we've been adding new features that impact how subviews are laid out after this test was created and it would get outdated pretty quickly.

I thought about creating separate SFT for insets only but I decided that most of it would be just a repeat of the subviews test so I'm not sure if that's necessary. But if you think we should create it, I can do so - let me know.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can note that down and add the test later, I think we shouldn't leave coverage gaps, but it's non-blocking comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the SFT: 1377b3a

@kligarski
kligarski force-pushed the @kligarski/stack-v5-android-header-margins branch from 2003dc6 to 1377b3a Compare August 20, 2026 08:14
@kligarski
kligarski force-pushed the @kligarski/stack-v5-android-header-margins branch from 1377b3a to 3d5a397 Compare August 20, 2026 14:04
@kligarski
kligarski force-pushed the @kligarski/stack-v5-android-header-margins branch from 3d5a397 to c03d041 Compare August 21, 2026 12:17
@kligarski
kligarski force-pushed the @kligarski/stack-v5-android-header-margins branch from c03d041 to 8ac268f Compare August 21, 2026 12:21
@kligarski
kligarski force-pushed the @kligarski/stack-v5-android-header-margins branch from 8ac268f to 2ea0731 Compare August 21, 2026 14:37
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 153a487c-8bf3-4565-b8ab-d75df9069c50

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kligarski
kligarski force-pushed the @kligarski/stack-v5-android-header-margins branch from 2ea0731 to 5113aa5 Compare August 21, 2026 14:43
@kligarski
kligarski force-pushed the @kligarski/stack-v5-android-header-margins branch from 5113aa5 to 0a27b69 Compare August 21, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants