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
Add simultaneous handlers support to make the component usable within a ScrollView (#273)
* Set react-native-gesture-handler dependency to ^1.10.0
* Ignore JetBrains IDE settings
* Add simultaneousHandlers and onGestureHandlerRef props
* Remove onGestureHandlerRef as it turned out it is not necessary
* Add simultaneousHandler prop to README
|`renderItem`|`(params: { item: T, index: number, drag: () => void, isActive: boolean}) => JSX.Element`| Call `drag` when the row should become active (i.e. in an `onLongPress` or `onPressIn`). |
39
-
|`renderPlaceholder`|`(params: { item: T, index: number }) => React.ReactNode`| Component to be rendered underneath the hovering component |
40
-
|`keyExtractor`|`(item: T, index: number) => string`| Unique key for each item |
41
-
|`onDragBegin`|`(index: number) => void`| Called when row becomes active. |
42
-
|`onRelease`|`(index: number) => void`| Called when active row touch ends. |
43
-
|`onDragEnd`|`(params: { data: T[], from: number, to: number }) => void`| Called after animation has completed. Returns updated ordering of `data`|
44
-
|`autoscrollThreshold`|`number`| Distance from edge of container where list begins to autoscroll when dragging. |
45
-
|`autoscrollSpeed`|`number`| Determines how fast the list autoscrolls. |
|`animationConfig`|`Partial<Animated.SpringConfig>`| Configure list animations. See [reanimated spring config](https://github.com/software-mansion/react-native-reanimated/blob/master/react-native-reanimated.d.ts#L112-L120)|
48
-
|`activationDistance`|`number`| Distance a finger must travel before the gesture handler activates. Useful when using a draggable list within a TabNavigator so that the list does not capture navigator gestures. |
49
-
|`layoutInvalidationKey`|`string`| Changing this value forces a remeasure of all item layouts. Useful if item size/ordering updates after initial mount. |
50
-
|`onScrollOffsetChange`|`(offset: number) => void`| Called with scroll offset. Stand-in for `onScroll`. |
51
-
|`onPlaceholderIndexChange`|`(index: number) => void`| Called when the index of the placeholder changes |
52
-
|`dragItemOverflow`|`boolean`| If true, dragged item follows finger beyond list boundary. |
53
-
|`dragHitSlop`|`object: {top: number, left: number, bottom: number, right: number}`| Enables control over what part of the connected view area can be used to begin recognizing the gesture. Numbers need to be non-positive (only possible to reduce responsive area). |
54
-
|`debug`|`boolean`| Enables debug logging and animation debugger. |
55
-
|`containerStyle`|`StyleProp<ViewStyle>`| Style of the main component. |
|`renderItem`|`(params: { item: T, index: number, drag: () => void, isActive: boolean}) => JSX.Element`| Call `drag` when the row should become active (i.e. in an `onLongPress` or `onPressIn`). |
39
+
|`renderPlaceholder`|`(params: { item: T, index: number }) => React.ReactNode`| Component to be rendered underneath the hovering component |
40
+
|`keyExtractor`|`(item: T, index: number) => string`| Unique key for each item |
41
+
|`onDragBegin`|`(index: number) => void`| Called when row becomes active. |
42
+
|`onRelease`|`(index: number) => void`| Called when active row touch ends. |
43
+
|`onDragEnd`|`(params: { data: T[], from: number, to: number }) => void`| Called after animation has completed. Returns updated ordering of `data`|
44
+
|`autoscrollThreshold`|`number`| Distance from edge of container where list begins to autoscroll when dragging. |
45
+
|`autoscrollSpeed`|`number`| Determines how fast the list autoscrolls. |
|`animationConfig`|`Partial<Animated.SpringConfig>`| Configure list animations. See [reanimated spring config](https://github.com/software-mansion/react-native-reanimated/blob/master/react-native-reanimated.d.ts#L112-L120)|
48
+
|`activationDistance`|`number`| Distance a finger must travel before the gesture handler activates. Useful when using a draggable list within a TabNavigator so that the list does not capture navigator gestures. |
49
+
|`layoutInvalidationKey`|`string`| Changing this value forces a remeasure of all item layouts. Useful if item size/ordering updates after initial mount. |
50
+
|`onScrollOffsetChange`|`(offset: number) => void`| Called with scroll offset. Stand-in for `onScroll`. |
51
+
|`onPlaceholderIndexChange`|`(index: number) => void`| Called when the index of the placeholder changes |
52
+
|`dragItemOverflow`|`boolean`| If true, dragged item follows finger beyond list boundary. |
53
+
|`dragHitSlop`|`object: {top: number, left: number, bottom: number, right: number}`| Enables control over what part of the connected view area can be used to begin recognizing the gesture. Numbers need to be non-positive (only possible to reduce responsive area). |
54
+
|`debug`|`boolean`| Enables debug logging and animation debugger. |
55
+
|`containerStyle`|`StyleProp<ViewStyle>`| Style of the main component. |
56
+
|`simultaneousHandlers`|`React.Ref<any>` or `React.Ref<any>[]`| References to other gesture handlers, mainly useful when using this component within a `ScrollView`. See [Cross handler interactions](https://docs.swmansion.com/react-native-gesture-handler/docs/interactions/). |
56
57
57
58
## Example
59
+
58
60
Example snack: https://snack.expo.io/@computerjazz/rndfl-example <br />
59
61
Example snack with scale effect on hover: https://snack.expo.io/@computerjazz/rndfl-dragwithhovereffect
0 commit comments