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

[Bug]: Bottomsheet should be opened when screen loads but sometimes is not #2117

Open
L-Weisz opened this issue Jan 17, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@L-Weisz
Copy link

L-Weisz commented Jan 17, 2025

Version

v5

Reanimated Version

v3

Gesture Handler Version

v2

Platforms

Android (Android Samsung A21S with android 11)

What happened?

In our application, the homepage features a bottom sheet that contains a section list. Upon accessing the homepage, the bottom sheet is expected to be opened.
The bottom sheet on this page cannot be closed and operates with only two indexes.

Expected behavior:
Image

However sometimes on specific devices of android the bottomsheet does not open at all :
What happens :
Image

Reproduction steps

We replicated on device Android Samsung A21S with android 11.

Things that could be helpful mentioning:

Top and bottom snap points are calculated from screen dimensions.

export const useBottomSheetAnimation = (headerHeight: number) => {
  const { height: frameHeight } = useSafeAreaFrame();
  const insets = useSafeAreaInsets();

  const bottomSnapPoints =frameHeight - headerHeight
  const topSnapPoints = Dimensions.get("screen").height - insets.top;

  const snapPoints = useMemo(
    () => [bottomSnapPoints, topSnapPoints],
    [bottomSnapPoints, topSnapPoints]
  );

  const animatedPosition = useSharedValue(bottomSnapPoints);

  return {
    snapPoints,
    animatedPosition,
  };
};

Bottom sheet only has those attributes

    <BottomSheet
      index={0}
      enableDynamicSizing={false}
      snapPoints={snapPoints}
      handleIndicatorStyle={styles.handleIndicator}
      enableOverDrag={false}
      animatedPosition={animatedPosition}
    >
      <ListSection />
    </BottomSheet>

Reproduction sample

https://snack.expo.dev/@healico/bottom-sheet---bottom-sheet-sometimes-not-opening-in-some-android

Relevant log output

No error are logged
@L-Weisz L-Weisz added the bug Something isn't working label Jan 17, 2025
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

1 participant