You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an Interactable.View that is roughly twice the height of the window. I want it to snap to the center (i.e. x: 0) when dragged horizontally but be 'scrollable' vertically.
The objective:
When the Interactable.View is dragged horizontally, the Interactable.View snaps back to x: 0.
When the Interactable.View is dragged down such that there is space between the top of the screen and the Interactable.View, the Interactable.View snaps to the top of the screen.
When the Interactable.View is dragged up such that there is space between the bottom of the screen and the Interactable.View, the Interactable.View snaps to the bottom of the screen.
This allows me to 'scroll' the Interactable.View while keeping it centered on the x axis.
The issue:
If I pass a single snap point [{ x: 0 }], the Interactable.View assumes I want to also snap to y: 0 instead of just leaving the y at the current value.
I cannot programmatically snap to a point without specifying it in the snapPoints prop.
Two slight tweaks to the API would make this use case possible. Thanks!
The text was updated successfully, but these errors were encountered:
I am considering forking and making the modifications. Is there any reason why the lib needs to have a snap point?
In other words, are there scenarios using springs or gravity where having an ill-defined snap point (i.e. a horizontal only snap point) would cause problems?
I have a fork with the following changes to both iOS and Android:
onSnapStart event merged from Hurdlr:react-native-interactable
A #snapToPoint imperative command that accepts a snapPoint. This is useful if you want to snap to a point that you did not specify in the snapPoints prop.
Snap points can be lines. This is a breaking change because you now must specify missing coordinates to 0 if you don't want it to behave like a line. Add { x: 0 } to snapPoints to make a vertical snap line. Snap lines don't work with #snapToPoint (it just assumes the missing coordinate is 0).
I have an
Interactable.View
that is roughly twice the height of the window. I want it to snap to the center (i.e.x: 0
) when dragged horizontally but be 'scrollable' vertically.The objective:
Interactable.View
is dragged horizontally, theInteractable.View
snaps back tox: 0
.Interactable.View
is dragged down such that there is space between the top of the screen and theInteractable.View
, theInteractable.View
snaps to the top of the screen.Interactable.View
is dragged up such that there is space between the bottom of the screen and theInteractable.View
, theInteractable.View
snaps to the bottom of the screen.This allows me to 'scroll' the
Interactable.View
while keeping it centered on the x axis.The issue:
[{ x: 0 }]
, theInteractable.View
assumes I want to also snap toy: 0
instead of just leaving the y at the current value.snapPoints
prop.Two slight tweaks to the API would make this use case possible. Thanks!
The text was updated successfully, but these errors were encountered: