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

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

Closed
anis-18 opened this issue Feb 14, 2023 · 2 comments · May be fixed by #1623
Closed
Labels
bug Something isn't working no-issue-activity

Comments

@anis-18
Copy link

anis-18 commented Feb 14, 2023

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]);
@anis-18 anis-18 added the bug Something isn't working label Feb 14, 2023
@github-actions
Copy link

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
Copy link

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
Labels
bug Something isn't working no-issue-activity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant