@btfash/react-native-reanimated-dnd 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Draggable.d.ts +5 -5
- package/lib/components/Droppable.d.ts +3 -3
- package/lib/components/Sortable.d.ts +3 -3
- package/lib/components/Sortable.js +1 -1
- package/lib/components/SortableItem.d.ts +6 -6
- package/lib/components/sortableUtils.d.ts +33 -33
- package/lib/components/sortableUtils.js +1 -1
- package/lib/context/DropContext.d.ts +3 -3
- package/lib/context/DropContext.js +1 -1
- package/lib/hooks/index.d.ts +6 -6
- package/lib/hooks/useDraggable.d.ts +2 -2
- package/lib/hooks/useDraggable.js +1 -1
- package/lib/hooks/useDroppable.d.ts +2 -2
- package/lib/hooks/useDroppable.js +1 -1
- package/lib/hooks/useHorizontalSortable.d.ts +2 -2
- package/lib/hooks/useHorizontalSortable.js +1 -1
- package/lib/hooks/useHorizontalSortableList.d.ts +4 -4
- package/lib/hooks/useHorizontalSortableList.js +1 -1
- package/lib/hooks/useSortable.d.ts +50 -50
- package/lib/hooks/useSortable.js +1 -1
- package/lib/hooks/useSortableList.d.ts +27 -27
- package/lib/hooks/useSortableList.js +1 -1
- package/lib/index.d.ts +13 -13
- package/lib/types/context.d.ts +67 -67
- package/lib/types/draggable.d.ts +54 -54
- package/lib/types/droppable.d.ts +26 -26
- package/lib/types/index.d.ts +4 -4
- package/lib/types/sortable.d.ts +233 -233
- package/package.json +1 -1
package/lib/types/sortable.d.ts
CHANGED
|
@@ -1,233 +1,233 @@
|
|
|
1
|
-
import { StyleProp, ViewStyle } from "react-native";
|
|
2
|
-
import { SharedValue } from "react-native-reanimated";
|
|
3
|
-
import { DropProviderRef } from "../types/context";
|
|
4
|
-
import { ReactNode } from "react";
|
|
5
|
-
export interface SortableData {
|
|
6
|
-
id: string;
|
|
7
|
-
}
|
|
8
|
-
export declare enum ScrollDirection {
|
|
9
|
-
None = "none",
|
|
10
|
-
Up = "up",
|
|
11
|
-
Down = "down"
|
|
12
|
-
}
|
|
13
|
-
export declare enum HorizontalScrollDirection {
|
|
14
|
-
None = "none",
|
|
15
|
-
Left = "left",
|
|
16
|
-
Right = "right"
|
|
17
|
-
}
|
|
18
|
-
export declare enum SortableDirection {
|
|
19
|
-
Vertical = "vertical",
|
|
20
|
-
Horizontal = "horizontal"
|
|
21
|
-
}
|
|
22
|
-
export interface UseSortableOptions<T> {
|
|
23
|
-
id: string;
|
|
24
|
-
positions: SharedValue<{
|
|
25
|
-
[id: string]: number;
|
|
26
|
-
}>;
|
|
27
|
-
lowerBound: SharedValue<number>;
|
|
28
|
-
autoScrollDirection: SharedValue<ScrollDirection>;
|
|
29
|
-
itemsCount: number;
|
|
30
|
-
itemHeight: number;
|
|
31
|
-
containerHeight?: number;
|
|
32
|
-
onMove?: (id: string, from: number, to: number) => void;
|
|
33
|
-
onDragStart?: (id: string, position: number) => void;
|
|
34
|
-
onDrop?: (id: string, position: number, allPositions?: {
|
|
35
|
-
[id: string]: number;
|
|
36
|
-
}) => void;
|
|
37
|
-
onDragging?: (id: string, overItemId: string | null, yPosition: number) => void;
|
|
38
|
-
}
|
|
39
|
-
export interface UseSortableReturn {
|
|
40
|
-
animatedStyle: StyleProp<ViewStyle>;
|
|
41
|
-
panGestureHandler: any;
|
|
42
|
-
isMoving: boolean;
|
|
43
|
-
hasHandle: boolean;
|
|
44
|
-
}
|
|
45
|
-
export interface UseSortableListOptions<TData extends SortableData> {
|
|
46
|
-
data: TData[];
|
|
47
|
-
itemHeight: number;
|
|
48
|
-
itemKeyExtractor?: (item: TData, index: number) => string;
|
|
49
|
-
}
|
|
50
|
-
export interface UseSortableListReturn<TData extends SortableData> {
|
|
51
|
-
positions: any;
|
|
52
|
-
scrollY: any;
|
|
53
|
-
autoScroll: any;
|
|
54
|
-
scrollViewRef: any;
|
|
55
|
-
dropProviderRef: React.RefObject<DropProviderRef>;
|
|
56
|
-
handleScroll: any;
|
|
57
|
-
handleScrollEnd: () => void;
|
|
58
|
-
contentHeight: number;
|
|
59
|
-
getItemProps: (item: TData, index: number) => {
|
|
60
|
-
id: string;
|
|
61
|
-
positions: any;
|
|
62
|
-
lowerBound: any;
|
|
63
|
-
autoScrollDirection: any;
|
|
64
|
-
itemsCount: number;
|
|
65
|
-
itemHeight: number;
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
export interface SortableItemProps<T> {
|
|
69
|
-
id: string;
|
|
70
|
-
data: T;
|
|
71
|
-
positions: SharedValue<{
|
|
72
|
-
[id: string]: number;
|
|
73
|
-
}>;
|
|
74
|
-
lowerBound?: SharedValue<number>;
|
|
75
|
-
leftBound?: SharedValue<number>;
|
|
76
|
-
autoScrollDirection?: SharedValue<ScrollDirection>;
|
|
77
|
-
autoScrollHorizontalDirection?: SharedValue<HorizontalScrollDirection>;
|
|
78
|
-
itemsCount: number;
|
|
79
|
-
direction?: SortableDirection;
|
|
80
|
-
itemHeight?: number;
|
|
81
|
-
itemWidth?: number;
|
|
82
|
-
gap?: number;
|
|
83
|
-
paddingHorizontal?: number;
|
|
84
|
-
containerHeight?: number;
|
|
85
|
-
containerWidth?: number;
|
|
86
|
-
children: ReactNode;
|
|
87
|
-
style?: StyleProp<ViewStyle>;
|
|
88
|
-
animatedStyle?: StyleProp<ViewStyle>;
|
|
89
|
-
onMove?: (id: string, from: number, to: number) => void;
|
|
90
|
-
onDragStart?: (id: string, position: number) => void;
|
|
91
|
-
onDrop?: (id: string, position: number, allPositions?: {
|
|
92
|
-
[id: string]: number;
|
|
93
|
-
}) => void;
|
|
94
|
-
onDragging?: (id: string, overItemId: string | null, yPosition: number) => void;
|
|
95
|
-
onDraggingHorizontal?: (id: string, overItemId: string | null, xPosition: number) => void;
|
|
96
|
-
}
|
|
97
|
-
export interface SortableProps<TData extends SortableData> {
|
|
98
|
-
data: TData[];
|
|
99
|
-
renderItem: (props: SortableRenderItemProps<TData>) => ReactNode;
|
|
100
|
-
direction?: SortableDirection;
|
|
101
|
-
itemHeight?: number;
|
|
102
|
-
itemWidth?: number;
|
|
103
|
-
gap?: number;
|
|
104
|
-
paddingHorizontal?: number;
|
|
105
|
-
style?: StyleProp<ViewStyle>;
|
|
106
|
-
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
107
|
-
itemKeyExtractor?: (item: TData, index: number) => string;
|
|
108
|
-
useFlatList?: boolean;
|
|
109
|
-
}
|
|
110
|
-
export interface SortableRenderItemProps<TData extends SortableData> {
|
|
111
|
-
item: TData;
|
|
112
|
-
index: number;
|
|
113
|
-
id: string;
|
|
114
|
-
positions: SharedValue<{
|
|
115
|
-
[id: string]: number;
|
|
116
|
-
}>;
|
|
117
|
-
direction?: SortableDirection;
|
|
118
|
-
lowerBound?: SharedValue<number>;
|
|
119
|
-
leftBound?: SharedValue<number>;
|
|
120
|
-
autoScrollDirection?: SharedValue<ScrollDirection>;
|
|
121
|
-
autoScrollHorizontalDirection?: SharedValue<HorizontalScrollDirection>;
|
|
122
|
-
itemsCount: number;
|
|
123
|
-
itemHeight?: number;
|
|
124
|
-
itemWidth?: number;
|
|
125
|
-
gap?: number;
|
|
126
|
-
paddingHorizontal?: number;
|
|
127
|
-
}
|
|
128
|
-
export interface SortableContextValue {
|
|
129
|
-
panGestureHandler: any;
|
|
130
|
-
}
|
|
131
|
-
export interface SortableHandleProps {
|
|
132
|
-
children: React.ReactNode;
|
|
133
|
-
style?: StyleProp<ViewStyle>;
|
|
134
|
-
}
|
|
135
|
-
export interface UseHorizontalSortableOptions<T> {
|
|
136
|
-
id: string;
|
|
137
|
-
positions: SharedValue<{
|
|
138
|
-
[id: string]: number;
|
|
139
|
-
}>;
|
|
140
|
-
leftBound: SharedValue<number>;
|
|
141
|
-
autoScrollDirection: SharedValue<HorizontalScrollDirection>;
|
|
142
|
-
itemsCount: number;
|
|
143
|
-
itemWidth: number;
|
|
144
|
-
gap?: number;
|
|
145
|
-
paddingHorizontal?: number;
|
|
146
|
-
containerWidth?: number;
|
|
147
|
-
onMove?: (id: string, from: number, to: number) => void;
|
|
148
|
-
onDragStart?: (id: string, position: number) => void;
|
|
149
|
-
onDrop?: (id: string, position: number, allPositions?: {
|
|
150
|
-
[id: string]: number;
|
|
151
|
-
}) => void;
|
|
152
|
-
onDragging?: (id: string, overItemId: string | null, xPosition: number) => void;
|
|
153
|
-
}
|
|
154
|
-
export interface UseHorizontalSortableReturn {
|
|
155
|
-
animatedStyle: StyleProp<ViewStyle>;
|
|
156
|
-
panGestureHandler: any;
|
|
157
|
-
isMoving: boolean;
|
|
158
|
-
hasHandle: boolean;
|
|
159
|
-
}
|
|
160
|
-
export interface UseHorizontalSortableListOptions<TData extends SortableData> {
|
|
161
|
-
data: TData[];
|
|
162
|
-
itemWidth: number;
|
|
163
|
-
gap?: number;
|
|
164
|
-
paddingHorizontal?: number;
|
|
165
|
-
itemKeyExtractor?: (item: TData, index: number) => string;
|
|
166
|
-
}
|
|
167
|
-
export interface UseHorizontalSortableListReturn<TData extends SortableData> {
|
|
168
|
-
positions: any;
|
|
169
|
-
scrollX: any;
|
|
170
|
-
autoScroll: any;
|
|
171
|
-
scrollViewRef: any;
|
|
172
|
-
dropProviderRef: React.RefObject<DropProviderRef>;
|
|
173
|
-
handleScroll: any;
|
|
174
|
-
handleScrollEnd: () => void;
|
|
175
|
-
contentWidth: number;
|
|
176
|
-
getItemProps: (item: TData, index: number) => {
|
|
177
|
-
id: string;
|
|
178
|
-
positions: any;
|
|
179
|
-
leftBound: any;
|
|
180
|
-
autoScrollDirection: any;
|
|
181
|
-
itemsCount: number;
|
|
182
|
-
itemWidth: number;
|
|
183
|
-
gap: number;
|
|
184
|
-
paddingHorizontal: number;
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
export interface HorizontalSortableItemProps<T> {
|
|
188
|
-
id: string;
|
|
189
|
-
data: T;
|
|
190
|
-
positions: SharedValue<{
|
|
191
|
-
[id: string]: number;
|
|
192
|
-
}>;
|
|
193
|
-
leftBound: SharedValue<number>;
|
|
194
|
-
autoScrollDirection: SharedValue<HorizontalScrollDirection>;
|
|
195
|
-
itemsCount: number;
|
|
196
|
-
itemWidth: number;
|
|
197
|
-
gap?: number;
|
|
198
|
-
paddingHorizontal?: number;
|
|
199
|
-
containerWidth?: number;
|
|
200
|
-
children: ReactNode;
|
|
201
|
-
style?: StyleProp<ViewStyle>;
|
|
202
|
-
animatedStyle?: StyleProp<ViewStyle>;
|
|
203
|
-
onMove?: (id: string, from: number, to: number) => void;
|
|
204
|
-
onDragStart?: (id: string, position: number) => void;
|
|
205
|
-
onDrop?: (id: string, position: number, allPositions?: {
|
|
206
|
-
[id: string]: number;
|
|
207
|
-
}) => void;
|
|
208
|
-
onDragging?: (id: string, overItemId: string | null, xPosition: number) => void;
|
|
209
|
-
}
|
|
210
|
-
export interface HorizontalSortableProps<TData extends SortableData> {
|
|
211
|
-
data: TData[];
|
|
212
|
-
renderItem: (props: HorizontalSortableRenderItemProps<TData>) => ReactNode;
|
|
213
|
-
itemWidth: number;
|
|
214
|
-
gap?: number;
|
|
215
|
-
paddingHorizontal?: number;
|
|
216
|
-
style?: StyleProp<ViewStyle>;
|
|
217
|
-
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
218
|
-
itemKeyExtractor?: (item: TData, index: number) => string;
|
|
219
|
-
}
|
|
220
|
-
export interface HorizontalSortableRenderItemProps<TData extends SortableData> {
|
|
221
|
-
item: TData;
|
|
222
|
-
index: number;
|
|
223
|
-
id: string;
|
|
224
|
-
positions: SharedValue<{
|
|
225
|
-
[id: string]: number;
|
|
226
|
-
}>;
|
|
227
|
-
leftBound: SharedValue<number>;
|
|
228
|
-
autoScrollDirection: SharedValue<HorizontalScrollDirection>;
|
|
229
|
-
itemsCount: number;
|
|
230
|
-
itemWidth: number;
|
|
231
|
-
gap: number;
|
|
232
|
-
paddingHorizontal: number;
|
|
233
|
-
}
|
|
1
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
2
|
+
import { SharedValue } from "react-native-reanimated";
|
|
3
|
+
import { DropProviderRef } from "../types/context";
|
|
4
|
+
import { ReactNode } from "react";
|
|
5
|
+
export interface SortableData {
|
|
6
|
+
id: string;
|
|
7
|
+
}
|
|
8
|
+
export declare enum ScrollDirection {
|
|
9
|
+
None = "none",
|
|
10
|
+
Up = "up",
|
|
11
|
+
Down = "down"
|
|
12
|
+
}
|
|
13
|
+
export declare enum HorizontalScrollDirection {
|
|
14
|
+
None = "none",
|
|
15
|
+
Left = "left",
|
|
16
|
+
Right = "right"
|
|
17
|
+
}
|
|
18
|
+
export declare enum SortableDirection {
|
|
19
|
+
Vertical = "vertical",
|
|
20
|
+
Horizontal = "horizontal"
|
|
21
|
+
}
|
|
22
|
+
export interface UseSortableOptions<T> {
|
|
23
|
+
id: string;
|
|
24
|
+
positions: SharedValue<{
|
|
25
|
+
[id: string]: number;
|
|
26
|
+
}>;
|
|
27
|
+
lowerBound: SharedValue<number>;
|
|
28
|
+
autoScrollDirection: SharedValue<ScrollDirection>;
|
|
29
|
+
itemsCount: number;
|
|
30
|
+
itemHeight: number;
|
|
31
|
+
containerHeight?: number;
|
|
32
|
+
onMove?: (id: string, from: number, to: number) => void;
|
|
33
|
+
onDragStart?: (id: string, position: number) => void;
|
|
34
|
+
onDrop?: (id: string, position: number, allPositions?: {
|
|
35
|
+
[id: string]: number;
|
|
36
|
+
}) => void;
|
|
37
|
+
onDragging?: (id: string, overItemId: string | null, yPosition: number) => void;
|
|
38
|
+
}
|
|
39
|
+
export interface UseSortableReturn {
|
|
40
|
+
animatedStyle: StyleProp<ViewStyle>;
|
|
41
|
+
panGestureHandler: any;
|
|
42
|
+
isMoving: boolean;
|
|
43
|
+
hasHandle: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface UseSortableListOptions<TData extends SortableData> {
|
|
46
|
+
data: TData[];
|
|
47
|
+
itemHeight: number;
|
|
48
|
+
itemKeyExtractor?: (item: TData, index: number) => string;
|
|
49
|
+
}
|
|
50
|
+
export interface UseSortableListReturn<TData extends SortableData> {
|
|
51
|
+
positions: any;
|
|
52
|
+
scrollY: any;
|
|
53
|
+
autoScroll: any;
|
|
54
|
+
scrollViewRef: any;
|
|
55
|
+
dropProviderRef: React.RefObject<DropProviderRef>;
|
|
56
|
+
handleScroll: any;
|
|
57
|
+
handleScrollEnd: () => void;
|
|
58
|
+
contentHeight: number;
|
|
59
|
+
getItemProps: (item: TData, index: number) => {
|
|
60
|
+
id: string;
|
|
61
|
+
positions: any;
|
|
62
|
+
lowerBound: any;
|
|
63
|
+
autoScrollDirection: any;
|
|
64
|
+
itemsCount: number;
|
|
65
|
+
itemHeight: number;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export interface SortableItemProps<T> {
|
|
69
|
+
id: string;
|
|
70
|
+
data: T;
|
|
71
|
+
positions: SharedValue<{
|
|
72
|
+
[id: string]: number;
|
|
73
|
+
}>;
|
|
74
|
+
lowerBound?: SharedValue<number>;
|
|
75
|
+
leftBound?: SharedValue<number>;
|
|
76
|
+
autoScrollDirection?: SharedValue<ScrollDirection>;
|
|
77
|
+
autoScrollHorizontalDirection?: SharedValue<HorizontalScrollDirection>;
|
|
78
|
+
itemsCount: number;
|
|
79
|
+
direction?: SortableDirection;
|
|
80
|
+
itemHeight?: number;
|
|
81
|
+
itemWidth?: number;
|
|
82
|
+
gap?: number;
|
|
83
|
+
paddingHorizontal?: number;
|
|
84
|
+
containerHeight?: number;
|
|
85
|
+
containerWidth?: number;
|
|
86
|
+
children: ReactNode;
|
|
87
|
+
style?: StyleProp<ViewStyle>;
|
|
88
|
+
animatedStyle?: StyleProp<ViewStyle>;
|
|
89
|
+
onMove?: (id: string, from: number, to: number) => void;
|
|
90
|
+
onDragStart?: (id: string, position: number) => void;
|
|
91
|
+
onDrop?: (id: string, position: number, allPositions?: {
|
|
92
|
+
[id: string]: number;
|
|
93
|
+
}) => void;
|
|
94
|
+
onDragging?: (id: string, overItemId: string | null, yPosition: number) => void;
|
|
95
|
+
onDraggingHorizontal?: (id: string, overItemId: string | null, xPosition: number) => void;
|
|
96
|
+
}
|
|
97
|
+
export interface SortableProps<TData extends SortableData> {
|
|
98
|
+
data: TData[];
|
|
99
|
+
renderItem: (props: SortableRenderItemProps<TData>) => ReactNode;
|
|
100
|
+
direction?: SortableDirection;
|
|
101
|
+
itemHeight?: number;
|
|
102
|
+
itemWidth?: number;
|
|
103
|
+
gap?: number;
|
|
104
|
+
paddingHorizontal?: number;
|
|
105
|
+
style?: StyleProp<ViewStyle>;
|
|
106
|
+
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
107
|
+
itemKeyExtractor?: (item: TData, index: number) => string;
|
|
108
|
+
useFlatList?: boolean;
|
|
109
|
+
}
|
|
110
|
+
export interface SortableRenderItemProps<TData extends SortableData> {
|
|
111
|
+
item: TData;
|
|
112
|
+
index: number;
|
|
113
|
+
id: string;
|
|
114
|
+
positions: SharedValue<{
|
|
115
|
+
[id: string]: number;
|
|
116
|
+
}>;
|
|
117
|
+
direction?: SortableDirection;
|
|
118
|
+
lowerBound?: SharedValue<number>;
|
|
119
|
+
leftBound?: SharedValue<number>;
|
|
120
|
+
autoScrollDirection?: SharedValue<ScrollDirection>;
|
|
121
|
+
autoScrollHorizontalDirection?: SharedValue<HorizontalScrollDirection>;
|
|
122
|
+
itemsCount: number;
|
|
123
|
+
itemHeight?: number;
|
|
124
|
+
itemWidth?: number;
|
|
125
|
+
gap?: number;
|
|
126
|
+
paddingHorizontal?: number;
|
|
127
|
+
}
|
|
128
|
+
export interface SortableContextValue {
|
|
129
|
+
panGestureHandler: any;
|
|
130
|
+
}
|
|
131
|
+
export interface SortableHandleProps {
|
|
132
|
+
children: React.ReactNode;
|
|
133
|
+
style?: StyleProp<ViewStyle>;
|
|
134
|
+
}
|
|
135
|
+
export interface UseHorizontalSortableOptions<T> {
|
|
136
|
+
id: string;
|
|
137
|
+
positions: SharedValue<{
|
|
138
|
+
[id: string]: number;
|
|
139
|
+
}>;
|
|
140
|
+
leftBound: SharedValue<number>;
|
|
141
|
+
autoScrollDirection: SharedValue<HorizontalScrollDirection>;
|
|
142
|
+
itemsCount: number;
|
|
143
|
+
itemWidth: number;
|
|
144
|
+
gap?: number;
|
|
145
|
+
paddingHorizontal?: number;
|
|
146
|
+
containerWidth?: number;
|
|
147
|
+
onMove?: (id: string, from: number, to: number) => void;
|
|
148
|
+
onDragStart?: (id: string, position: number) => void;
|
|
149
|
+
onDrop?: (id: string, position: number, allPositions?: {
|
|
150
|
+
[id: string]: number;
|
|
151
|
+
}) => void;
|
|
152
|
+
onDragging?: (id: string, overItemId: string | null, xPosition: number) => void;
|
|
153
|
+
}
|
|
154
|
+
export interface UseHorizontalSortableReturn {
|
|
155
|
+
animatedStyle: StyleProp<ViewStyle>;
|
|
156
|
+
panGestureHandler: any;
|
|
157
|
+
isMoving: boolean;
|
|
158
|
+
hasHandle: boolean;
|
|
159
|
+
}
|
|
160
|
+
export interface UseHorizontalSortableListOptions<TData extends SortableData> {
|
|
161
|
+
data: TData[];
|
|
162
|
+
itemWidth: number;
|
|
163
|
+
gap?: number;
|
|
164
|
+
paddingHorizontal?: number;
|
|
165
|
+
itemKeyExtractor?: (item: TData, index: number) => string;
|
|
166
|
+
}
|
|
167
|
+
export interface UseHorizontalSortableListReturn<TData extends SortableData> {
|
|
168
|
+
positions: any;
|
|
169
|
+
scrollX: any;
|
|
170
|
+
autoScroll: any;
|
|
171
|
+
scrollViewRef: any;
|
|
172
|
+
dropProviderRef: React.RefObject<DropProviderRef>;
|
|
173
|
+
handleScroll: any;
|
|
174
|
+
handleScrollEnd: () => void;
|
|
175
|
+
contentWidth: number;
|
|
176
|
+
getItemProps: (item: TData, index: number) => {
|
|
177
|
+
id: string;
|
|
178
|
+
positions: any;
|
|
179
|
+
leftBound: any;
|
|
180
|
+
autoScrollDirection: any;
|
|
181
|
+
itemsCount: number;
|
|
182
|
+
itemWidth: number;
|
|
183
|
+
gap: number;
|
|
184
|
+
paddingHorizontal: number;
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
export interface HorizontalSortableItemProps<T> {
|
|
188
|
+
id: string;
|
|
189
|
+
data: T;
|
|
190
|
+
positions: SharedValue<{
|
|
191
|
+
[id: string]: number;
|
|
192
|
+
}>;
|
|
193
|
+
leftBound: SharedValue<number>;
|
|
194
|
+
autoScrollDirection: SharedValue<HorizontalScrollDirection>;
|
|
195
|
+
itemsCount: number;
|
|
196
|
+
itemWidth: number;
|
|
197
|
+
gap?: number;
|
|
198
|
+
paddingHorizontal?: number;
|
|
199
|
+
containerWidth?: number;
|
|
200
|
+
children: ReactNode;
|
|
201
|
+
style?: StyleProp<ViewStyle>;
|
|
202
|
+
animatedStyle?: StyleProp<ViewStyle>;
|
|
203
|
+
onMove?: (id: string, from: number, to: number) => void;
|
|
204
|
+
onDragStart?: (id: string, position: number) => void;
|
|
205
|
+
onDrop?: (id: string, position: number, allPositions?: {
|
|
206
|
+
[id: string]: number;
|
|
207
|
+
}) => void;
|
|
208
|
+
onDragging?: (id: string, overItemId: string | null, xPosition: number) => void;
|
|
209
|
+
}
|
|
210
|
+
export interface HorizontalSortableProps<TData extends SortableData> {
|
|
211
|
+
data: TData[];
|
|
212
|
+
renderItem: (props: HorizontalSortableRenderItemProps<TData>) => ReactNode;
|
|
213
|
+
itemWidth: number;
|
|
214
|
+
gap?: number;
|
|
215
|
+
paddingHorizontal?: number;
|
|
216
|
+
style?: StyleProp<ViewStyle>;
|
|
217
|
+
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
218
|
+
itemKeyExtractor?: (item: TData, index: number) => string;
|
|
219
|
+
}
|
|
220
|
+
export interface HorizontalSortableRenderItemProps<TData extends SortableData> {
|
|
221
|
+
item: TData;
|
|
222
|
+
index: number;
|
|
223
|
+
id: string;
|
|
224
|
+
positions: SharedValue<{
|
|
225
|
+
[id: string]: number;
|
|
226
|
+
}>;
|
|
227
|
+
leftBound: SharedValue<number>;
|
|
228
|
+
autoScrollDirection: SharedValue<HorizontalScrollDirection>;
|
|
229
|
+
itemsCount: number;
|
|
230
|
+
itemWidth: number;
|
|
231
|
+
gap: number;
|
|
232
|
+
paddingHorizontal: number;
|
|
233
|
+
}
|