Skip to content

Add rootContainerStyle prop to ReanimatedDrawerLayout#3846

Merged
m-bert merged 6 commits into
software-mansion:mainfrom
jr-k:patch-1
Jun 10, 2026
Merged

Add rootContainerStyle prop to ReanimatedDrawerLayout#3846
m-bert merged 6 commits into
software-mansion:mainfrom
jr-k:patch-1

Conversation

@jr-k

@jr-k jr-k commented Nov 28, 2025

Copy link
Copy Markdown
Contributor

What this PR does

This PR adds a new mainContainerStyle prop to the main component. Until now, it was not possible to apply custom styles to the wrapper since it was fully controlled internally. By exposing this prop, consumers can now override or extend the wrapper's styles and apply absolute positioning or any other layout adjustment when needed.

Why

I needed to apply absolute positioning to the top-level wrapper but there was no way to customize it. Adding this prop keeps the existing default behavior while allowing more flexibility for advanced layout cases.

How

  • Added the mainContainerStyle prop
  • Passed it directly to the ReanimatedDrawerLayout element
  • Ensured it merges cleanly with the component's default styling

Added mainContainerStyle prop to customize the main component's style.
@m-bert

m-bert commented Apr 15, 2026

Copy link
Copy Markdown
Collaborator

Hi @jr-k! Would you mind sharing an example where this prop is necessary?

@jr-k

jr-k commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Hi! To be honest, it has been a while and I do not remember the exact case that led me to add this React prop.

That said, I still think it is useful to expose it. It gives consumers more flexibility to customize the component when needed, without us having to anticipate every possible use case or block people later on.

@m-bert m-bert left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I guess it wouldn't hurt us to have such prop, though I'm still not sure about the use case.

This should also have its entry in Drawer documentation.

Comment thread packages/react-native-gesture-handler/src/components/ReanimatedDrawerLayout.tsx Outdated
@jr-k jr-k requested review from Copilot and m-bert June 9, 2026 15:42

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 a new styling hook to ReanimatedDrawerLayout so consumers can style the view wrapping the background/main container.

Changes:

  • Introduced backgroundContainerStyle prop on DrawerLayoutProps.
  • Wired the new prop into the root Animated.View style array.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +200 to +203
/**
* Style wrapping the background component.
*/
backgroundContainerStyle?: StyleProp<ViewStyle>;
userSelect={userSelect}
enableContextMenu={enableContextMenu}>
<Animated.View style={styles.main} onLayout={handleContainerLayout}>
<Animated.View style={[styles.main, backgroundContainerStyle]} onLayout={handleContainerLayout}>
userSelect={userSelect}
enableContextMenu={enableContextMenu}>
<Animated.View style={styles.main} onLayout={handleContainerLayout}>
<Animated.View style={[styles.main, backgroundContainerStyle]} onLayout={handleContainerLayout}>
@m-bert m-bert changed the base branch from next to main June 10, 2026 07:46

@m-bert m-bert left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi @jr-k! Thank you again for this PR. I took the liberty of updating it since it had conflicts with main branch. We've also decided to use rootContainerStyle name instead. Let me know if this works for you, or do you have any other suggestions!

@m-bert m-bert changed the title Add mainContainerStyle prop to ReanimatedDrawerLayout Add rootContainerStyle prop to ReanimatedDrawerLayout Jun 10, 2026
@m-bert m-bert requested a review from j-piasecki June 10, 2026 08:35
@m-bert m-bert merged commit 9615b6a into software-mansion:main Jun 10, 2026
3 checks passed
@jr-k

jr-k commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Perfect, thanks!

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.

4 participants