Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bottom Sheet doesn't overlay the Tab Bar in Bottom Tabs navigator #8

Open
Riverknight0 opened this issue Dec 28, 2023 · 12 comments
Open
Labels
enhancement New feature or request

Comments

@Riverknight0
Copy link

Riverknight0 commented Dec 28, 2023

Thanks for this wonderful, easy to use library. 

There is a small thing i faced. 

How can we show bottom sheet over/in the foreground of Bottom Tabs Navigator (React navigation v6. in this case)

I want to show only bottom sheet and not bottom navigator.

@stanleyugwu
Copy link
Owner

stanleyugwu commented Jan 3, 2024

I'm assuming you meant overlaying the bottom tab bar??

How does it look when it opens currently?

@stanleyugwu stanleyugwu added the question Further information is requested label Jan 5, 2024
@fernandasecinaro
Copy link

Hey! I'm testing this library to use it on my app. But i experienced this issue too. I'd really like to have this fixed because it's the best library i found

image

@stanleyugwu
Copy link
Owner

Thanks for providing this image @fernandasecinaro

Just fyi, this is not an issue with the sheet itself but the expected behavior for bottom tab navigator because the screens and the navigator elements (tab bar) are not in same view hierarchy.

Assume the tab bar to be fixed in position and renders above the screen (which is where the sheet is). So the sheet overlays the screen content, but tab bar overlays everything.

That said, I'll look into finding a solution for this.

Also the comment is open for suggestions

@stanleyugwu stanleyugwu changed the title Bottom sheet over Bottom Tabs Navigator, but how to ? Bottom Sheet doesn't overlay the Tab Bar in Bottom Tabs navigator Feb 8, 2024
@stanleyugwu stanleyugwu added enhancement New feature or request and removed question Further information is requested labels Feb 8, 2024
@MathiasSvDK
Copy link

Agree on this - can't wait for it to get fixed.
Any workaround?

@stanleyugwu
Copy link
Owner

stanleyugwu commented Feb 19, 2024

@Riverknight0 @fernandasecinaro @MathiasSvDK

A possible workaround I can think of is hiding the tab bar when sheet opens and showing it back when sheet closes.
This an be done using onClose and onOpen props along with useNavigation hook.

Example:

import { useNavigation } from "@react-navigation/native"; // or from 'expo-router'
...
const navigation = useNavigation();

<BottomSheet
    ref={sheetRef}
    onOpen={() =>
      navigation.setOptions({ tabBarStyle: { display: "none" } })
    }
    onClose={() =>
      navigation.setOptions({ tabBarStyle: { display: "flex" } })
    }
>
...
</BottomSheet>

@TomCorvus
Copy link

You can use portal (https://github.com/jeremybarbet/react-native-portalize for example) to teleport your modal before your navigation tab bar.

@stanleyugwu
Copy link
Owner

@TomCorvus Thank you so much for this, I'll test it out pretty soon and if it works well, then you would've saved me from a lot of headaches 😀

@Goktug
Copy link

Goktug commented Mar 21, 2024

@stanleyugwu Any update?

@stanleyugwu
Copy link
Owner

@Goktug you can use react-native-portalize for now.

I’m looking at replicating what’s done in the library inside the bottom sheet so users won’t have to install another package to solve the problem.

But y’all please use react-native-portalize for now.

@stanleyugwu
Copy link
Owner

I think I’ll keep this open till we have a built in solution.

@yasaricli
Copy link

yasaricli commented Oct 22, 2024

I just discovered react-native-portalize package, it's really amazing. It works for this.

@stanleyugwu
Copy link
Owner

stanleyugwu commented Oct 29, 2024

@yasaricli Yes it does. Wonderful suggestion by @TomCorvus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants