question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

snapTo snapping to the wrong SnapPoint

See original GitHub issue

I have a simple sheet component with 3 buttons:

export const SimpleSheet: React.FC = (): JSX.Element => {
  const bs = useRef<BottomSheet>(null)

  const renderContent = () => (
    <View style={styles.content}>
      <Button title="Top" onPress={() => { bs?.current?.snapTo(2) }} />
      <Button title="Center" onPress={() => { bs?.current?.snapTo(1) }} />
      <Button title="Bottom" onPress={() => { bs?.current?.snapTo(0) }} />
    </View>
  )

  return (
    <BottomSheet
      ref={bs}
      snapPoints={[125, '50%', '95%']}
      initialSnap={1}
      renderContent={renderContent}
    />
  )
}
  1. I press the Top button -> snap to top

  2. I press the Bottom button -> nothing happens

  3. I press the Center button -> snap to bottom

It seems as the component is remembering the last snap point it is supposed to snap to and performs the action after the next snapTo.

happend on current npm version 1.0.0-alpha.18 on iOS

Thanks in advance

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:15
  • Comments:14

github_iconTop GitHub Comments

2reactions
MojtabaMahdiancommented, Oct 14, 2020

bs = React.createRef(null);

<BottomSheet ref={this.bs} snapPoints={[330, 0]} borderRadius={10} /> i use with this keyword fixed

call ref like this : this.bs.current.snapTo(1);

2reactions
zeabdelkhalekcommented, Mar 25, 2020

downgrade version to ‘1.0.0-alpha.14’ works for me !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Snap Point Locations Seem "Off" : r/NoMansSkyTheGame
I don't even know how to explain this - but snap points and the translucent part "shadows" seem to be in the wrong...
Read more >
Adjust snap strength or turn snap off - Microsoft Support
Under Snap to, select the drawing elements that you want shapes to snap into alignment with, and then click OK. The snap settings...
Read more >
Cursor skips over some object snaps and will not snap when ...
Unable to snap to precise points. The cursor seems to miss or hop over them.
Read more >
Snap point to point with St_Snap Postgis - GIS Stack Exchange
A quick hack to guarantee that you always snap to the closest point: SELECT f.gid AS gid, ST_Snap( f.Geom, ST_ClosestPoint(g.Geom, f.
Read more >
When You Pipe to a Head, the "Snap" Point is Wrong - Land FX
Issue When you pipe to a sprinkler head in your design, the "snap" point seems to be incorrect. The lateral pipe is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found