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

snapTo() not working with RN 0.63 #27

Open
mike-hamilton opened this issue Jul 9, 2020 · 2 comments
Open

snapTo() not working with RN 0.63 #27

mike-hamilton opened this issue Jul 9, 2020 · 2 comments

Comments

@mike-hamilton
Copy link

Current Behavior

I just upgraded my project from RN 0.62.2 to 0.63 and I noticed the snapTo function appears to not be working. The code below worked fine on 0.62.2 (and the console.log shows up in 0.63, so the useEffect() is running..)

  const bottomSheetRef = useRef();

  // Close the bottom sheet
  useEffect(() => {
    if (!bottomSheetIsOpen) {
      console.log('closing BS!');
      bottomSheetRef.current.snapTo(1);
    }
  }, [bottomSheetIsOpen]);

Expected Behavior

The bottom sheet should snap to provided index

Your Environment

package version
react-native-scroll-bottom-sheet 0.6.2
react-native 0.63.0
react-native-gesture-handler 1.6.1
react-native-reanimated 1.9.0
@marcel-happyfloat
Copy link

I got it working by wrapping it into a small timeout

@Kristonitas
Copy link

I think the issue is not the snapTo itself, but rather something to do with component being re-rendered. If you called snapTo from some button directly (and not listening to state changes, which cause re-render), it would work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants