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

[v5] Bottom sheet is not longer opening #1751

Open
Chasty opened this issue Feb 22, 2024 · 8 comments
Open

[v5] Bottom sheet is not longer opening #1751

Chasty opened this issue Feb 22, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@Chasty
Copy link

Chasty commented Feb 22, 2024

Bug

Environment info

Library Version
@gorhom/bottom-sheet 5.0.0-alpha.7
react-native 0.72.10
react-native-reanimated 3.3.0
react-native-gesture-handler 2.12.0

Steps To Reproduce

  1. just using this version "@gorhom/bottom-sheet": "4.4.7" it works perfectly.

Describe what you expected to happen:

I expect it to be opened.

Reproducible sample code

That's the code i have and whenever i want to open the bottom sheet it does not even open it.

import { View } from 'react-native'
import { BottomSheetBackdrop, BottomSheetModal } from '@gorhom/bottom-sheet'
import React, { RefObject, useCallback, useMemo } from 'react'
import CheatSheetContent from './CheatSheetContent'
import { styles } from './CheatSheet.styles'

type CheatSheetProps = {
  bottomSheetModalRef: RefObject<BottomSheetModal>
}

const CheatSheet = ({ bottomSheetModalRef }: CheatSheetProps) => {
  const renderBackdrop = useCallback(
    (props: React.ComponentProps<typeof BottomSheetBackdrop>) => (
      <BottomSheetBackdrop {...props} disappearsOnIndex={-1} appearsOnIndex={0} />
    ),
    []
  )

  const snapPoints = useMemo(() => ['85%'], [])

  return (
    <View>
      <BottomSheetModal
        ref={bottomSheetModalRef}
        index={0}
        snapPoints={snapPoints}
        backdropComponent={renderBackdrop}
        detached={false}
        handleStyle={styles.bottomSheetHandleStyle}
        handleIndicatorStyle={styles.bottomSheetIndicatorStyle}
        keyboardBlurBehavior="restore"
      >
        <CheatSheetContent />
      </BottomSheetModal>
    </View>
  )
}

And open it like this.

 const bottomSheetModalRef = useRef<BottomSheetModal>(null)

  const openBottomModal = useCallback(() => {
    bottomSheetModalRef.current?.present()
  }, [])
  const closeBottomModal = useCallback(() => {
    bottomSheetModalRef.current?.close()
  }, [bottomSheetModalRef])
  
  
<CheatSheet bottomSheetModalRef={bottomSheetModalRef} />
@Chasty Chasty added the bug Something isn't working label Feb 22, 2024
@Chasty
Copy link
Author

Chasty commented Feb 22, 2024

UPDATE: this is broken since this version 5.0.0-alpha.5, even the example from here does not open.

@malikzype
Copy link

+1..Works fine in alpha 6 but breaks in 7 and 8

@Chasty
Copy link
Author

Chasty commented Feb 28, 2024

In my case I need to remove the backdropComponent prop and it worked again, but now the bottom sheet opens sometimes. weird.

it is somehow related to this issue as well.

#1627

@TNAJanssen
Copy link

Same issue here

1 similar comment
@JosueCuberoSanchez
Copy link

Same issue here

@MoOx
Copy link

MoOx commented Apr 12, 2024

Getting the same problem with latest version 5.0.0-alpha.9.

@anton2mihail
Copy link

anton2mihail commented Apr 23, 2024

+ 1 here, on 5.0.0-alpha.9

There's also a weird Gesture related bug where even if enablePanDownToClose is false you're still able to close the bottom sheet using a 2 finger gesture across the top of the sheet.

Not sure if it's related but the bug is 100% consistent

@nileshzype
Copy link

+1
I am also face same issue with 5.0.0-alpha.9

With 5.0.0-alpha.4 its working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants