react-native-bottom-sheet icon indicating copy to clipboard operation
react-native-bottom-sheet copied to clipboard

[v4] | [v2] Initial Closed State with index prop not working properly...

Open pdesign opened this issue 1 year ago • 6 comments

Bug

Environment info

Library Version
@gorhom/bottom-sheet 5.0.0-alpha.11
react-native ^0.74.5
react-native-reanimated ~3.10.1
react-native-gesture-handler ~2.16.1

Steps To Reproduce - Situation 1

  1. Create bottomsheet as documents show you to do.
  2. set only 1 snap point lets say 50%
  3. set index prop on the bottomsheet element to close bottomsheet initially

Describe what you expected to happen:

  1. bottomsheet comes closed initially...
  2. but you can not expand it

Steps To Reproduce - Situation 2

  1. Create bottomsheet as documents show you to do.
  2. set 2 snap point lets say 50% and 75%
  3. set index prop on the bottomsheet element to close bottomsheet initially

Describe what you expected to happen:

  1. bottomsheet comes closed initially...
  2. but when you first expand the bottomsheet it goes up and closes...
  3. on the other presses it works normal... just the first click it comes up and goes down...

pdesign avatar Sep 29 '24 09:09 pdesign

@pdesign: hello! :wave:

This issue is being automatically closed because it does not follow the issue template.

github-actions[bot] avatar Sep 29 '24 09:09 github-actions[bot]

Same issue here. This issue happens only on iOS for me. Android and Web works fine.

hariom-nft avatar Sep 30 '24 11:09 hariom-nft

@pdesign why not just submitting a expo snack to help me debug it faster :(

gorhom avatar Oct 02 '24 18:10 gorhom

@pdesign why not just submitting a expo snack to help me debug it faster :(

will add a code example here tomorrow

pdesign avatar Oct 10 '24 22:10 pdesign

Same issue here. I tried to submit a expo snack for you but unfortunately it gets stuck in connecting for me :(

Issue: BottomSheet won't open after setting the initial index on some Android devices

Description: When initializing the BottomSheet with index={-1}, the sheet no longer opens on certain Android devices. This behavior occurs inconsistently across different devices. For instance, it works fine on a Samsung Galaxy S23 but does not work on a Samsung Galaxy J5 Pro.

Dependencies: @gorhom/bottom-sheet: 5.0.0-alpha.11 expo: ~51.0.36 react: 18.2.0, react-native: ^0.75.4,

import MyBottomSheet, {BottomSheetView} from '@gorhom/bottom-sheet';

  const myRef = useRef<MyBottomSheet>(null);

  function open() {
    myRef.current?.collapse();
  }

  function close() {
    myRef.current?.close();
  }
  
  <View style={styles.screen}>
      <Button title='Open' onPress={open} />
      <Button title='Close' onPress={close} />

      <MyBottomSheet
        ref={myRef}
        index={-1}
        snapPoints={['50%', '90%']}
      >
        <BottomSheetView style={styles.contentContainer}>
          <Text vstyle={styles.text}>
            Awesome 🎉
          </Text>
        </BottomSheetView>
      </MyBottomSheet>
    </View>

AradSharafi avatar Oct 14 '24 04:10 AradSharafi

I updated it to 5.0.2, and the bug has been fixed

AradSharafi avatar Oct 15 '24 09:10 AradSharafi

can confirm, updating the lib to v5.0.2 solved this issue

farellsmma avatar Oct 30 '24 07:10 farellsmma

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Nov 29 '24 09:11 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Dec 05 '24 09:12 github-actions[bot]