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

fix: hide the sheet container on closed #690

Merged
merged 1 commit into from
Oct 12, 2021

Conversation

gorhom
Copy link
Owner

@gorhom gorhom commented Oct 9, 2021

Closes #665

Motivation

When the user dismiss a keyboard view on Android, the container height will resize after the keyboard is been hidden, which will make the closed bottom sheet visible for few milliseconds.

So i have added a logic to hide the bottom sheet when it is closed.

Installation

yarn add ssh://git@github.com:gorhom/react-native-bottom-sheet#fix/665-hide-sheet-when-closed

@gorhom gorhom added the v4 Written in Reanimated v2 label Oct 9, 2021
@gorhom
Copy link
Owner Author

gorhom commented Oct 9, 2021

@aditya-keri-betterhalf, @siddharth-kt , @aimensasi would you mind testing this PR, thanks !

@siddharth-kt
Copy link

Great, I tested it, it worked for me 👍.

@aimensasi
Copy link

@gorhom I confirm this is fixed the issue on my end. Thanks a lot

@julienripet
Copy link

Hi, sorry to be a buzzkill, but it doesn't seem to fix it for me.
I installed it using the command you gave above, yarn add ssh://git@github.com:gorhom/react-native-bottom-sheet#fix/665-hide-sheet-when-closed, but it didn't do anything.
I deleted my node_module folder, I restarted my metro server with --reset-cache, I even updated react-native-reanimated and react-native-gesture-handler to their latest versions, but nothing seems to change.

@siddharth-kt or @aimensasi, do you think you could share your package.json? Or if you have an idea of what I might be doing wrong?

I can open another Issue with my code if needed.

@aditya-keri-betterhalf
Copy link

I confirm as well that this issue is fixed on my end.

@aimensasi
Copy link

@julienripet I did not do anything special, just installed the fix and reloaded the app.

@aimensasi
Copy link

@julienripet maybe your issue is different, you could create a snack to reproduce.

@badalsaibo
Copy link

Was having this problem too. Ran npm install ssh://git@github.com:gorhom/react-native-bottom-sheet#fix/665-hide-sheet-when-closed and it seems to be fixed.

@gorhom
Copy link
Owner Author

gorhom commented Oct 12, 2021

thanks guys for testing!

@gorhom gorhom merged commit 9f04d55 into master Oct 12, 2021
@gorhom gorhom deleted the fix/665-hide-sheet-when-closed branch October 12, 2021 07:56
@rchavik
Copy link

rchavik commented Oct 16, 2021

I do not understand why, but this somehow broke the web version of my App.

I added console.log({animatedIndex}) just before useAnimatedStyle() and debug console only shows 1 entry with animatedIndex.value = -1. So the opacity is 0.

I also tried to fish out the actual element via the Inspector and found the following:

image

Changing the opacity to 1 does show the bottom sheet again.

@DanielMarkiel
Copy link

Hi @gorhom,
I believe this fix breaks the BottomSheetModal (it's probably the same bug as @rchavik described above).
It opens only once and it doesn't want to reopen after dismissing (everything is fine at v4.1.1).
My snap points (if this is relevant):

const initialSnapPoints = useMemo(() => ['CONTENT_HEIGHT'], [])

@gorhom
Copy link
Owner Author

gorhom commented Oct 18, 2021

@rchavik could you open a new issue with a reproducible snack ?

@DanielMarkiel could you check this issue #697, it might be the one you are facing now

bulkinav pushed a commit to bulkinav/react-native-bottom-sheet that referenced this pull request Nov 4, 2021
bulkinav pushed a commit to bulkinav/react-native-bottom-sheet that referenced this pull request Dec 6, 2021
@Kjagd
Copy link

Kjagd commented May 24, 2022

@gorhom I'm also facing issues regarding this. Using BottomSheetModal sometimes when it's displayed for the second time, the opacity is not not reset, so it's completely invisible. It's a bit tricky to reproduce, since it apparently depends on the how much content I have in the sheet. But if I have something a bit heavy like a calendar in it, it's very consistently happening. Perhaps #697 needs to be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v4 Written in Reanimated v2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[v4] [Need Help] BottomSheet shows up for a brief second when dismissing keyboard on chat screen
9 participants