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
|`ref`|`React.RefObject<FlatList<T>>`| FlatList ref to be forwarded to the underlying FlatList. |
38
-
|`renderItem`|`(params: { item: T, getIndex: () => number \| undefined, drag: () => void, isActive: boolean}) => JSX.Element`| Call `drag` when the row should become active (i.e. in an `onLongPress` or `onPressIn`). |
38
+
|`renderItem`|`(params: { item: T, getIndex: () => number \| undefined, drag: () => void, isActive: boolean, isLocked: boolean}) => JSX.Element`| Call `drag` when the row should become active (i.e. in an `onLongPress` or `onPressIn`). `isLocked` is `true` when the item is locked via `isItemLocked`.|
39
39
|`renderPlaceholder`|`(params: { item: T, index: number }) => React.ReactNode`| Component to be rendered underneath the hovering component |
40
40
|`keyExtractor`|`(item: T, index: number) => string`| Unique key for each item (required) |
41
41
|`onDragBegin`|`(index: number) => void`| Called when row becomes active. |
@@ -49,6 +49,7 @@ All props are spread onto underlying [FlatList](https://facebook.github.io/react
49
49
|`onPlaceholderIndexChange`|`(index: number) => void`| Called when the index of the placeholder changes |
50
50
|`dragItemOverflow`|`boolean`| If true, dragged item follows finger beyond list boundary. |
51
51
|`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). |
52
+
|`isItemLocked`|`(item: T, index: number) => boolean`| If returns `true` for an item, that item cannot be dragged and will not move when other items are dragged past it. Other items reorder around locked items, which maintain their absolute position in the array. |
52
53
|`debug`|`boolean`| Enables debug logging and animation debugger. |
53
54
|`containerStyle`|`StyleProp<ViewStyle>`| Style of the main component. |
54
55
|`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/). |
@@ -59,6 +60,31 @@ All props are spread onto underlying [FlatList](https://facebook.github.io/react
59
60
60
61
61
62
63
+
## Locked Items
64
+
65
+
Use the `isItemLocked` prop to fix items in place. Locked items cannot be dragged and stay at their absolute position while other items reorder around them.
Cell Decorators are an easy way to add common hover animations. For example, wrapping `renderItem` in the `<ScaleDecorator>` component will automatically scale up the active item while hovering (see example below).
0 commit comments