-
-
Notifications
You must be signed in to change notification settings - Fork 986
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
[docs] Improve Reanimated Swipeable documentation. #3121
Conversation
We could use |
Please let me know if the proposal written in description is ok then, it replaces |
|
Do either of these work? I think the input-output range is implicitly stated in both of them.
|
What about:
? |
Sounds good, added it in 2967cea |
As of 8c3fd7b added a missing argument description to the docstrings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to renderLeftActions
also apply to renderRightActions
😅 Thanks @kacperkapusciak for help ❤️
|
||
SharedValue: [startValue, endValue] | ||
- `progress` value representing swiping progress relative to the width of the returned element. | ||
Equals `0` when `swipeable` is closed, `1` when left action is open. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Equals `0` when `swipeable` is closed, `1` when left action is open. | |
Equals `0` when `swipeable` is closed, `1` when `swipeable` is open. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swipeable
cannot be open, either the left action
or the right action
can be open.
Maybe it could be "open to the left" or "open to the right", but i think it's unnecessarily adding additional words, and i'm not sure if it resolves the issue you were referring to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swipeable
cannot be open
Why is that? For example, it has onSwipeableWillOpen
and onSwipeableOpen
props. What I would change here is I'd use passive voice, i.e.:
Equals `0` when `swipeable` is closed, `1` when left action is open. | |
Equals `0` when `swipeable` is closed, `1` when `swipeable` is opened. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onSwipeableWillOpen
distinguishes between swipeable
opening it's left and right element
.
Here, the distinction of which side is open is equally necessary.
What about something like this?
Equals
0
whenswipeable
is closed,1
whenswipeable
has its leftelement
open.
or
Equals
0
whenswipeable
is closed,1
when the leftelement
is open.
element
could be replaced with action
, but I think you mentioned you'd prefer to avoid action
here, was that a context-specific preference or a general rule?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, the distinction of which side is open is equally necessary.
Isn't it implied by the fact that we're in renderLeftActions
section?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onSwipeableWillOpen
distinguishes betweenswipeable
opening it's left and right element.
Yes it does, but the name indicates that Swipeable
itself will be opened. Why can't you say that it is opened if you can say that it is closed?
element
could be replaced withaction
I think the best we could replace it with would be action panel
, as in tsdocs
. But still, I believe that Swipeable
fits better here. (cc @j-piasecki, @kacperkapusciak)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SharedValue: [startValue, endValue] | ||
- `progress` value representing swiping progress relative to the width of the returned element. | ||
Equals `0` when `swipeable` is closed, `1` when left action is open. | ||
Linearly increases to `Infinity` as left action overshoots it's open position. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linearly increases to `Infinity` as left action overshoots it's open position. | |
When an element overshoots the opened position the value tends towards `Infinity`. Goes back to `1` when `swipeable` is released. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the second sentence is a good addition: Goes back to `1` when `swipeable` is released.
.
But for the first one, i think the original works a bit better, it's shorter and i think the wording it uses is a bit clearer
Perhaps the following would work better?
As left action
progress
overshoots it's open position, the value linearly increases toInfinity
.
Reverts to1
whenswipeable
is released.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We wanted to make it as close to natural sentence as possible. Also we'd like to avoid left action
, that's why we used element
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We wanted to make it as close to natural sentence as possible. Also we'd like to avoid left action, that's why we used element
I believe this is resolved here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I missing something, or the only thing that has changed is left action?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 620e247
|
||
SharedValue: [startValue, endValue] | ||
- `progress` - a `SharedValue` representing swiping progress relative to the width of the returned element. | ||
- Equals `0` when `swipeable` is closed, `1` when `swipeable` is open. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Equals `0` when `swipeable` is closed, `1` when `swipeable` is open. | |
- Equals `0` when `swipeable` is closed, `1` when `swipeable` is opened. |
WDYT about passive voice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, will apply it shortly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in b93ec82
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The time has come ⌛
@@ -29,7 +29,8 @@ import Swipeable from 'react-native-gesture-handler/ReanimatedSwipeable'; | |||
|
|||
### `friction` | |||
|
|||
a number that specifies how much the visual interaction will be delayed compared to the gesture distance. e.g. value of 1 will indicate that the swipeable panel should exactly follow the gesture, 2 means it is going to be two times "slower". | |||
a number that specifies how much the visual interaction will be delayed compared to the gesture distance. | |||
e.g. value of 1 will indicate that the swipeable panel should exactly follow the gesture, 2 means it is going to be two times "slower". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e.g. value of 1 will indicate that the swipeable panel should exactly follow the gesture, 2 means it is going to be two times "slower". | |
e.g. value of `1` will indicate that the swipeable panel should exactly follow the gesture, `2` means it is going to be two times "slower". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 65d1a2b
@@ -115,7 +120,8 @@ style object for the children container (Animated.View), for example to apply `f | |||
|
|||
### `enableTrackpadTwoFingerGesture` (iOS only) | |||
|
|||
Enables two-finger gestures on supported devices, for example iPads with trackpads. If not enabled the gesture will require click + drag, with enableTrackpadTwoFingerGesture swiping with two fingers will also trigger the gesture. | |||
Enables two-finger gestures on supported devices, for example iPads with trackpads. | |||
If not enabled the gesture will require click + drag, with enableTrackpadTwoFingerGesture swiping with two fingers will also trigger the gesture. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not enabled the gesture will require click + drag, with enableTrackpadTwoFingerGesture swiping with two fingers will also trigger the gesture. | |
If not enabled the gesture will require click + drag, with `enableTrackpadTwoFingerGesture` swiping with two fingers will also trigger the gesture. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
Description
Fixed the example provided with the
Reanimated Swipeable
docs, it looks like a fragment of it was missing.Also, what's the verdict on this issue?
Today I had to take a look at these docs again and it really occurred to me the way it's currently written can be really confusing.
Here's my proposition, it removes the
[0, +]
mapping in favour of a verbose explanation:side-by-side comparison:
Of course this change applies to both
renderLeftActions
andrenderRightActions