Skip to content

[v4] | [v2] snapToPosition opening bottomsheet to maximum screen height and snapToIndex not working #1294

Closed
@anis-18

Description

@anis-18

Bug

snapToPosition method is opening bottomsheet in maximum screen height and snapToIndex is not working when used in useEffect

Environment info

Library Version
@gorhom/bottom-sheet ^4
react-native 0.70.5
react-native-reanimated 2.13.0
react-native-gesture-handler 2.6.1

Steps To Reproduce

  1. create react native app
  2. use bottomsheet from library
  3. use snapToIndex and snapToPosition inside useeffect or useLayoutEffect

Describe what you expected to happen:

  1. open bottomsheet with correct index provided
  2. open bottomsheet with correct prosition provided

Reproducible sample code

const snapPoints = React.useMemo(
    () => ['10%', '25%', '45%', '65%', '95%'],
    [],
  );

React.useEffect(() => {
      sheetRef.current?.snapToPosition(400); // this opens bottomsheet to maximum screen height
 // or this 
// sheetRef.current?.snapToIndex(3); // this is not working at all
  }, [sheetRef.current , loaded]);

Activity

github-actions

github-actions commented on Mar 17, 2023

@github-actions

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

github-actions commented on Mar 23, 2023

@github-actions

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @anis-18

      Issue actions

        [v4] | [v2] snapToPosition opening bottomsheet to maximum screen height and snapToIndex not working · Issue #1294 · gorhom/react-native-bottom-sheet