@draftbit/core 46.11.6-74496c.2 → 46.12.0

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.
Files changed (81) hide show
  1. package/lib/commonjs/components/Checkbox/CheckboxGroup.js +16 -3
  2. package/lib/commonjs/components/Checkbox/CheckboxGroup.js.map +1 -1
  3. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +22 -5
  4. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js.map +1 -1
  5. package/lib/commonjs/components/Checkbox/CheckboxRow.js +6 -23
  6. package/lib/commonjs/components/Checkbox/CheckboxRow.js.map +1 -1
  7. package/lib/commonjs/components/SwipeableView/SwipeableView.js +155 -0
  8. package/lib/commonjs/components/SwipeableView/SwipeableView.js.map +1 -0
  9. package/lib/commonjs/components/SwipeableView/SwipeableViewButton.js +13 -0
  10. package/lib/commonjs/components/SwipeableView/SwipeableViewButton.js.map +1 -0
  11. package/lib/commonjs/components/SwipeableView/SwipeableViewSwipeHandler.js +13 -0
  12. package/lib/commonjs/components/SwipeableView/SwipeableViewSwipeHandler.js.map +1 -0
  13. package/lib/commonjs/components/SwipeableView/index.js +28 -0
  14. package/lib/commonjs/components/SwipeableView/index.js.map +1 -0
  15. package/lib/commonjs/index.js +19 -0
  16. package/lib/commonjs/index.js.map +1 -1
  17. package/lib/commonjs/mappings/FlatList.js +0 -3
  18. package/lib/commonjs/mappings/FlatList.js.map +1 -1
  19. package/lib/commonjs/mappings/NumberInput.js.map +1 -1
  20. package/lib/commonjs/mappings/SwipeableView.js +183 -0
  21. package/lib/commonjs/mappings/SwipeableView.js.map +1 -0
  22. package/lib/commonjs/utilities.js +27 -2
  23. package/lib/commonjs/utilities.js.map +1 -1
  24. package/lib/module/components/ActionSheet/ActionSheetItem.js.map +1 -1
  25. package/lib/module/components/BottomSheet/index.js.map +1 -1
  26. package/lib/module/components/DatePicker/DatePicker.js +13 -27
  27. package/lib/module/components/DatePicker/DatePicker.js.map +1 -1
  28. package/lib/module/components/Divider.js +1 -17
  29. package/lib/module/components/Divider.js.map +1 -1
  30. package/lib/module/components/SwipeableView/SwipeableView.js +147 -0
  31. package/lib/module/components/SwipeableView/SwipeableView.js.map +1 -0
  32. package/lib/module/components/SwipeableView/SwipeableViewButton.js +6 -0
  33. package/lib/module/components/SwipeableView/SwipeableViewButton.js.map +1 -0
  34. package/lib/module/components/SwipeableView/SwipeableViewSwipeHandler.js +6 -0
  35. package/lib/module/components/SwipeableView/SwipeableViewSwipeHandler.js.map +1 -0
  36. package/lib/module/components/SwipeableView/index.js +4 -0
  37. package/lib/module/components/SwipeableView/index.js.map +1 -0
  38. package/lib/module/index.js +1 -0
  39. package/lib/module/index.js.map +1 -1
  40. package/lib/module/mappings/FlatList.js +0 -3
  41. package/lib/module/mappings/FlatList.js.map +1 -1
  42. package/lib/module/mappings/IconButton.js.map +1 -1
  43. package/lib/module/mappings/SafeAreaView.js.map +1 -1
  44. package/lib/module/mappings/SwipeableView.js +175 -0
  45. package/lib/module/mappings/SwipeableView.js.map +1 -0
  46. package/lib/module/theming.js.map +1 -1
  47. package/lib/module/utilities.js +18 -0
  48. package/lib/module/utilities.js.map +1 -1
  49. package/lib/typescript/src/components/SwipeableView/SwipeableView.d.ts +29 -0
  50. package/lib/typescript/src/components/SwipeableView/SwipeableView.d.ts.map +1 -0
  51. package/lib/typescript/src/components/SwipeableView/SwipeableViewButton.d.ts +13 -0
  52. package/lib/typescript/src/components/SwipeableView/SwipeableViewButton.d.ts.map +1 -0
  53. package/lib/typescript/src/components/SwipeableView/SwipeableViewSwipeHandler.d.ts +13 -0
  54. package/lib/typescript/src/components/SwipeableView/SwipeableViewSwipeHandler.d.ts.map +1 -0
  55. package/lib/typescript/src/components/SwipeableView/index.d.ts +4 -0
  56. package/lib/typescript/src/components/SwipeableView/index.d.ts.map +1 -0
  57. package/lib/typescript/src/index.d.ts +1 -0
  58. package/lib/typescript/src/index.d.ts.map +1 -1
  59. package/lib/typescript/src/mappings/FlatList.d.ts +0 -3
  60. package/lib/typescript/src/mappings/FlatList.d.ts.map +1 -1
  61. package/lib/typescript/src/mappings/SwipeableView.d.ts +426 -0
  62. package/lib/typescript/src/mappings/SwipeableView.d.ts.map +1 -0
  63. package/lib/typescript/src/utilities.d.ts +6 -0
  64. package/lib/typescript/src/utilities.d.ts.map +1 -1
  65. package/package.json +4 -3
  66. package/src/components/SwipeableView/SwipeableView.js +117 -0
  67. package/src/components/SwipeableView/SwipeableView.tsx +299 -0
  68. package/src/components/SwipeableView/SwipeableViewButton.js +5 -0
  69. package/src/components/SwipeableView/SwipeableViewButton.tsx +18 -0
  70. package/src/components/SwipeableView/SwipeableViewSwipeHandler.js +5 -0
  71. package/src/components/SwipeableView/SwipeableViewSwipeHandler.tsx +20 -0
  72. package/src/components/SwipeableView/index.js +3 -0
  73. package/src/components/SwipeableView/index.tsx +3 -0
  74. package/src/index.js +1 -0
  75. package/src/index.tsx +6 -0
  76. package/src/mappings/FlatList.js +0 -3
  77. package/src/mappings/FlatList.ts +0 -3
  78. package/src/mappings/SwipeableView.js +181 -0
  79. package/src/mappings/SwipeableView.ts +210 -0
  80. package/src/utilities.js +41 -0
  81. package/src/utilities.ts +71 -0
@@ -0,0 +1,299 @@
1
+ import React from "react";
2
+ import {
3
+ View,
4
+ StyleProp,
5
+ ViewStyle,
6
+ TextStyle,
7
+ StyleSheet,
8
+ Text,
9
+ } from "react-native";
10
+ import Pressable from "../Pressable";
11
+ import {
12
+ extractBorderAndMarginStyles,
13
+ extractEffectStyles,
14
+ extractFlexItemStyles,
15
+ extractPositionStyles,
16
+ extractSizeStyles,
17
+ extractStyles,
18
+ } from "../../utilities";
19
+ import { SwipeRow } from "react-native-swipe-list-view";
20
+ import { IconSlot } from "../../interfaces/Icon";
21
+ import type { Theme } from "../../styles/DefaultTheme";
22
+ import { withTheme } from "../../theming";
23
+ import { SwipeableViewButtonProps } from "./SwipeableViewButton";
24
+ import { SwipeableViewSwipeHandlerProps } from "./SwipeableViewSwipeHandler";
25
+
26
+ export interface SwipeableViewProps extends IconSlot {
27
+ closeOnPress?: boolean;
28
+ leftOpenValue?: number;
29
+ rightOpenValue?: number;
30
+ leftActivationValue?: number;
31
+ rightActivationValue?: number;
32
+ swipeActivationPercentage?: number;
33
+ stopLeftSwipe?: number;
34
+ stopRightSwipe?: number;
35
+ directionalDistanceChangeThreshold?: number;
36
+ friction?: number;
37
+ tension?: number;
38
+ disableLeftSwipe?: boolean;
39
+ disableRightSwipe?: boolean;
40
+ swipeToOpenVelocityContribution?: number;
41
+ swipeToOpenPercent?: number;
42
+ swipeToClosePercent?: number;
43
+ style?: StyleProp<ViewStyle | TextStyle>;
44
+ theme: Theme;
45
+ }
46
+
47
+ const SwipeableView: React.FC<React.PropsWithChildren<SwipeableViewProps>> = ({
48
+ theme,
49
+ style,
50
+ children,
51
+ Icon,
52
+ closeOnPress,
53
+ leftOpenValue,
54
+ rightOpenValue,
55
+ leftActivationValue,
56
+ rightActivationValue,
57
+ swipeActivationPercentage = 80,
58
+ stopLeftSwipe,
59
+ stopRightSwipe,
60
+ friction = 20,
61
+ ...rest
62
+ }) => {
63
+ const instanceOfSwipeableViewButtonProps = (
64
+ object: any
65
+ ): object is SwipeableViewButtonProps => {
66
+ return "title" in object && "side" in object && "onPress" in object;
67
+ };
68
+
69
+ const instanceOfSwipeableViewSwipeHandlerProps = (
70
+ object: any
71
+ ): object is SwipeableViewSwipeHandlerProps => {
72
+ return "title" in object && "side" in object && "onSwipe" in object;
73
+ };
74
+
75
+ const { viewStyles, textStyles } = extractStyles(style);
76
+
77
+ const { borderStyles, marginStyles } =
78
+ extractBorderAndMarginStyles(viewStyles);
79
+
80
+ const parentContainerStyles = StyleSheet.flatten([
81
+ borderStyles,
82
+ marginStyles,
83
+ extractFlexItemStyles(viewStyles),
84
+ extractPositionStyles(viewStyles),
85
+ extractEffectStyles(viewStyles),
86
+ extractSizeStyles(viewStyles),
87
+ ]);
88
+
89
+ //Remove styles already consumed from viewStyles
90
+ Object.keys(parentContainerStyles).forEach((key) => delete viewStyles[key]);
91
+ const surfaceContainerStyles = viewStyles;
92
+
93
+ const [componentWidth, setComponentWidth] = React.useState<number | null>(
94
+ null
95
+ );
96
+ const leftButtons = React.useMemo(
97
+ () =>
98
+ React.Children.toArray(children).filter(
99
+ (child) =>
100
+ React.isValidElement(child) &&
101
+ instanceOfSwipeableViewButtonProps(child.props) &&
102
+ child.props.side === "left"
103
+ ) as React.ReactElement<SwipeableViewButtonProps>[],
104
+ [children]
105
+ );
106
+
107
+ const rightButtons = React.useMemo(
108
+ () =>
109
+ React.Children.toArray(children).filter(
110
+ (child) =>
111
+ React.isValidElement(child) &&
112
+ instanceOfSwipeableViewButtonProps(child.props) &&
113
+ child.props.side === "right"
114
+ ) as React.ReactElement<SwipeableViewButtonProps>[],
115
+ [children]
116
+ );
117
+
118
+ const leftSwipeHandlers = React.useMemo(
119
+ () =>
120
+ React.Children.toArray(children).filter(
121
+ (child) =>
122
+ React.isValidElement(child) &&
123
+ instanceOfSwipeableViewSwipeHandlerProps(child.props) &&
124
+ child.props.side === "left"
125
+ ) as React.ReactElement<SwipeableViewSwipeHandlerProps>[],
126
+ [children]
127
+ );
128
+
129
+ const rightSwipeHandlers = React.useMemo(
130
+ () =>
131
+ React.Children.toArray(children).filter(
132
+ (child) =>
133
+ React.isValidElement(child) &&
134
+ instanceOfSwipeableViewSwipeHandlerProps(child.props) &&
135
+ child.props.side === "right"
136
+ ) as React.ReactElement<SwipeableViewSwipeHandlerProps>[],
137
+ [children]
138
+ );
139
+
140
+ const remainingChildren = React.useMemo(
141
+ () =>
142
+ React.Children.toArray(children).filter(
143
+ (child) =>
144
+ React.isValidElement(child) &&
145
+ !instanceOfSwipeableViewSwipeHandlerProps(child.props) &&
146
+ !instanceOfSwipeableViewButtonProps(child.props)
147
+ ),
148
+ [children]
149
+ );
150
+
151
+ if (leftButtons.length > 2 || rightButtons.length > 2) {
152
+ throw Error("Cannot have more than 2 buttons per side");
153
+ }
154
+
155
+ if (leftSwipeHandlers.length > 1 || rightSwipeHandlers.length > 1) {
156
+ throw Error("Cannot have more than 1 swiper handler per side");
157
+ }
158
+
159
+ if (
160
+ (leftButtons.length && leftSwipeHandlers.length) ||
161
+ (rightButtons.length && rightSwipeHandlers.length)
162
+ ) {
163
+ throw Error("Cannot combine swiper handler and buttons on the same side");
164
+ }
165
+
166
+ //Renders a single button/item. Used for both buttons and swipe handler
167
+ const renderBehindItem = (
168
+ props: SwipeableViewSwipeHandlerProps | SwipeableViewButtonProps,
169
+ index: number
170
+ ) => (
171
+ <Pressable
172
+ key={index.toString()}
173
+ onPress={(props as any).onPress}
174
+ style={[
175
+ styles.buttonContainer,
176
+ { backgroundColor: props.backgroundColor || theme.colors.primary },
177
+ ]}
178
+ >
179
+ {props.icon && (
180
+ <Icon
181
+ name={props.icon}
182
+ size={props.iconSize || 25}
183
+ color={props.color || theme.colors.surface}
184
+ />
185
+ )}
186
+ <Text
187
+ style={[textStyles, { color: props.color || theme.colors.surface }]}
188
+ >
189
+ {props.title}
190
+ </Text>
191
+ </Pressable>
192
+ );
193
+
194
+ const isLeftSwipeHandler = !!leftSwipeHandlers.length;
195
+ const isRightSwipeHandler = !!rightSwipeHandlers.length;
196
+
197
+ const defaultLeftOpenValue = componentWidth ? componentWidth / 2 : 0;
198
+ const defaultRightOpenValue = componentWidth ? -componentWidth / 2 : 0;
199
+
200
+ return (
201
+ <View
202
+ onLayout={(event) => {
203
+ setComponentWidth(event.nativeEvent.layout.width);
204
+ }}
205
+ style={[styles.parentContainer, parentContainerStyles]}
206
+ >
207
+ {/*@ts-ignore*/}
208
+ <SwipeRow
209
+ leftOpenValue={
210
+ isLeftSwipeHandler ? 0 : leftOpenValue || defaultLeftOpenValue //If in swiping mode, don't keep open
211
+ }
212
+ rightOpenValue={
213
+ isRightSwipeHandler ? 0 : rightOpenValue || defaultRightOpenValue
214
+ }
215
+ leftActivationValue={
216
+ leftActivationValue || isLeftSwipeHandler
217
+ ? defaultLeftOpenValue * (swipeActivationPercentage / 100) //When swipe passes activation percentage then it should be considered activated (call onSwipe)
218
+ : defaultLeftOpenValue
219
+ }
220
+ rightActivationValue={
221
+ rightActivationValue || isRightSwipeHandler
222
+ ? defaultRightOpenValue * (swipeActivationPercentage / 100)
223
+ : defaultRightOpenValue
224
+ }
225
+ stopLeftSwipe={stopLeftSwipe || defaultLeftOpenValue}
226
+ stopRightSwipe={stopRightSwipe || defaultRightOpenValue}
227
+ onLeftAction={
228
+ isLeftSwipeHandler
229
+ ? () => leftSwipeHandlers[0].props.onSwipe?.()
230
+ : undefined
231
+ }
232
+ onRightAction={
233
+ isRightSwipeHandler
234
+ ? () => rightSwipeHandlers[0].props.onSwipe?.()
235
+ : undefined
236
+ }
237
+ closeOnRowPress={closeOnPress}
238
+ friction={friction}
239
+ {...rest}
240
+ >
241
+ <View style={styles.behindContainer}>
242
+ <View style={styles.behindContainerItem}>
243
+ {(isLeftSwipeHandler ? leftSwipeHandlers : leftButtons).map(
244
+ (item, index) => renderBehindItem(item.props, index)
245
+ )}
246
+ </View>
247
+ <View style={styles.behindContainerItem}>
248
+ {(isRightSwipeHandler ? rightSwipeHandlers : rightButtons).map(
249
+ (item, index) => renderBehindItem(item.props, index)
250
+ )}
251
+ </View>
252
+ </View>
253
+ <View
254
+ style={[
255
+ styles.surfaceContainer,
256
+ {
257
+ backgroundColor: theme.colors.background,
258
+ },
259
+ surfaceContainerStyles,
260
+ ]}
261
+ >
262
+ {remainingChildren}
263
+ </View>
264
+ </SwipeRow>
265
+ </View>
266
+ );
267
+ };
268
+
269
+ const styles = StyleSheet.create({
270
+ parentContainer: {
271
+ overflow: "hidden",
272
+ minHeight: 50,
273
+ },
274
+ behindContainer: {
275
+ flex: 1,
276
+ width: "100%",
277
+ height: "100%",
278
+ flexDirection: "row",
279
+ },
280
+ behindContainerItem: {
281
+ flex: 1,
282
+ flexDirection: "row",
283
+ },
284
+ buttonContainer: {
285
+ flex: 1,
286
+ alignItems: "center",
287
+ justifyContent: "center",
288
+ },
289
+ surfaceContainer: {
290
+ flexDirection: "row",
291
+ width: "100%",
292
+ height: "100%",
293
+ padding: 10,
294
+ alignItems: "center",
295
+ overflow: "hidden",
296
+ },
297
+ });
298
+
299
+ export default withTheme(SwipeableView);
@@ -0,0 +1,5 @@
1
+ //Renders nothing, acts as a wrapper be used by SwipeableView
2
+ const SwipeableViewButton = () => {
3
+ return null;
4
+ };
5
+ export default SwipeableViewButton;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+
3
+ export interface SwipeableViewButtonProps {
4
+ title: string;
5
+ side: "left" | "right";
6
+ onPress: (() => void) | null; //Not optional in order to always exist in props
7
+ icon?: string;
8
+ iconSize?: number;
9
+ backgroundColor?: string;
10
+ color?: string;
11
+ }
12
+
13
+ //Renders nothing, acts as a wrapper be used by SwipeableView
14
+ const SwipeableViewButton: React.FC<SwipeableViewButtonProps> = () => {
15
+ return null;
16
+ };
17
+
18
+ export default SwipeableViewButton;
@@ -0,0 +1,5 @@
1
+ //Renders nothing, acts as a wrapper to be used by SwipeableView
2
+ const SwipeableViewSwipeHandler = () => {
3
+ return null;
4
+ };
5
+ export default SwipeableViewSwipeHandler;
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+
3
+ export interface SwipeableViewSwipeHandlerProps {
4
+ title: string;
5
+ side: "left" | "right";
6
+ onSwipe: (() => void) | null; //Not optional in order to always exist in props
7
+ icon?: string;
8
+ iconSize?: number;
9
+ backgroundColor?: string;
10
+ color?: string;
11
+ }
12
+
13
+ //Renders nothing, acts as a wrapper to be used by SwipeableView
14
+ const SwipeableViewSwipeHandler: React.FC<
15
+ SwipeableViewSwipeHandlerProps
16
+ > = () => {
17
+ return null;
18
+ };
19
+
20
+ export default SwipeableViewSwipeHandler;
@@ -0,0 +1,3 @@
1
+ export { default as SwipeableView } from "./SwipeableView";
2
+ export { default as SwipeableViewButton } from "./SwipeableViewButton";
3
+ export { default as SwipeableViewSwipeHandler } from "./SwipeableViewSwipeHandler";
@@ -0,0 +1,3 @@
1
+ export { default as SwipeableView } from "./SwipeableView";
2
+ export { default as SwipeableViewButton } from "./SwipeableViewButton";
3
+ export { default as SwipeableViewSwipeHandler } from "./SwipeableViewSwipeHandler";
package/src/index.js CHANGED
@@ -38,6 +38,7 @@ export { default as Markdown } from "./components/Markdown";
38
38
  export { BottomSheet } from "./components/BottomSheet";
39
39
  export { YoutubePlayer } from "./components/YoutubePlayer";
40
40
  export { Table, TableRow, TableCell } from "./components/Table";
41
+ export { SwipeableView, SwipeableViewButton, SwipeableViewSwipeHandler, } from "./components/SwipeableView";
41
42
  /* Deprecated: Fix or Delete! */
42
43
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
43
44
  export { default as Picker } from "./components/Picker/Picker";
package/src/index.tsx CHANGED
@@ -64,6 +64,12 @@ export { YoutubePlayer } from "./components/YoutubePlayer";
64
64
 
65
65
  export { Table, TableRow, TableCell } from "./components/Table";
66
66
 
67
+ export {
68
+ SwipeableView,
69
+ SwipeableViewButton,
70
+ SwipeableViewSwipeHandler,
71
+ } from "./components/SwipeableView";
72
+
67
73
  /* Deprecated: Fix or Delete! */
68
74
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
69
75
  export { default as Picker } from "./components/Picker/Picker";
@@ -5,9 +5,6 @@ export const SEED_DATA = {
5
5
  description: "A basic List component",
6
6
  category: COMPONENT_TYPES.data,
7
7
  stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
8
- layout: {
9
- flex: 1,
10
- },
11
8
  triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
12
9
  props: {
13
10
  onRefresh: createActionProp(),
@@ -15,9 +15,6 @@ export const SEED_DATA = {
15
15
  description: "A basic List component",
16
16
  category: COMPONENT_TYPES.data,
17
17
  stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
18
- layout: {
19
- flex: 1,
20
- },
21
18
  triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
22
19
  props: {
23
20
  onRefresh: createActionProp(),
@@ -0,0 +1,181 @@
1
+ import { COMPONENT_TYPES, createStaticNumberProp, createStaticBoolProp, CONTAINER_COMPONENT_STYLES_SECTIONS, StylesPanelSections, GROUPS, createBoolProp, createTextProp, createIconProp, createTextEnumProp, createColorProp, Triggers, createActionProp, } from "@draftbit/types";
2
+ export const SHARED_SEED_DATA_PROPS = {
3
+ title: createTextProp({
4
+ label: "Title",
5
+ description: "Title of button/swipeable",
6
+ defaultValue: "Swipeable",
7
+ required: true,
8
+ group: GROUPS.basic,
9
+ }),
10
+ side: createTextEnumProp({
11
+ label: "Side",
12
+ description: "Side where button/swipeable is added",
13
+ options: ["left", "right"],
14
+ defaultValue: "left",
15
+ required: true,
16
+ }),
17
+ icon: createIconProp({
18
+ defaultValue: null,
19
+ required: false,
20
+ }),
21
+ iconSize: createStaticNumberProp({
22
+ label: "Icon size",
23
+ description: "Size of icon",
24
+ defaultValue: 25,
25
+ required: false,
26
+ }),
27
+ backgroundColor: createColorProp({
28
+ label: "Background color",
29
+ description: "Color of button/swipeable background",
30
+ defaultValue: "primary",
31
+ }),
32
+ color: createColorProp({
33
+ label: "Color",
34
+ description: "Color of text and icon of button/swipeable",
35
+ defaultValue: "surface",
36
+ }),
37
+ };
38
+ export const SEED_DATA = [
39
+ {
40
+ name: "Swipeable View",
41
+ tag: "SwipeableView",
42
+ doc_link: "https://github.com/jemise111/react-native-swipe-list-view/blob/master/docs/SwipeRow.md",
43
+ description: "A swipeable view that is able to show hidden buttons and/or handle swipe events",
44
+ category: COMPONENT_TYPES.testing /*.view*/,
45
+ stylesPanelSections: [
46
+ ...CONTAINER_COMPONENT_STYLES_SECTIONS,
47
+ StylesPanelSections.Typography,
48
+ ],
49
+ layout: {
50
+ overflow: "hidden",
51
+ flexDirection: "row",
52
+ alignItems: "center",
53
+ padding: 10,
54
+ },
55
+ props: {
56
+ closeOnPress: createStaticBoolProp({
57
+ label: "Close on press",
58
+ description: "Whether the view should be closed/dismissed when pressed",
59
+ defaultValue: true,
60
+ }),
61
+ swipeActivationPercentage: createStaticNumberProp({
62
+ label: "Swipe activation percentage",
63
+ description: "Percentage of swipe completion needed to trigger onSwipe. Overriden by 'Left activation value' and 'Right activation value'",
64
+ defaultValue: 80,
65
+ required: false,
66
+ }),
67
+ disableLeftSwipe: createBoolProp({
68
+ label: "Disable left swipe",
69
+ description: "Whether left swipe is enabled or not",
70
+ defaultValue: true,
71
+ }),
72
+ disableRightSwipe: createBoolProp({
73
+ label: "Disable right swipe",
74
+ description: "Whether right swipe is enabled or not",
75
+ defaultValue: true,
76
+ }),
77
+ leftOpenValue: createStaticNumberProp({
78
+ label: "Left open value",
79
+ description: "The X translation value that left swipe snaps to (positive value). Defaults to half view width",
80
+ group: GROUPS.advanced,
81
+ required: false,
82
+ }),
83
+ rightOpenValue: createStaticNumberProp({
84
+ label: "Right open value",
85
+ description: "The X translation value that right swipe snaps to (negative value). Defaults to negative half view width",
86
+ group: GROUPS.advanced,
87
+ required: false,
88
+ }),
89
+ leftActivationValue: createStaticNumberProp({
90
+ label: "Left activation value",
91
+ description: "The X translation value that triggers onSwipe when surpassed (positive value). Defaults to 80% of half view width",
92
+ group: GROUPS.advanced,
93
+ required: false,
94
+ }),
95
+ rightActivationValue: createStaticNumberProp({
96
+ label: "Right activation value",
97
+ description: "The X translation value that triggers onSwipe when surpassed (negative value). Defaults to negative 80% of half view width",
98
+ group: GROUPS.advanced,
99
+ required: false,
100
+ }),
101
+ stopLeftSwipe: createStaticNumberProp({
102
+ label: "Stop left swipe",
103
+ description: "The maximum X translation value that is swipable from left (positive value). Defaults to half view width",
104
+ group: GROUPS.advanced,
105
+ required: false,
106
+ }),
107
+ stopRightSwipe: createStaticNumberProp({
108
+ label: "Stop right swipe",
109
+ description: "The maximum X translation value that is swipable from right (negative value). Defaults to negative half view width",
110
+ group: GROUPS.advanced,
111
+ required: false,
112
+ }),
113
+ directionalDistanceChangeThreshold: createStaticNumberProp({
114
+ label: "Change threshold",
115
+ description: "Change the sensitivity of the swipe on the view",
116
+ group: GROUPS.advanced,
117
+ required: false,
118
+ }),
119
+ friction: createStaticNumberProp({
120
+ label: "Friction",
121
+ description: "Controls the 'bounciness' of the swipe animation",
122
+ defaultValue: 20,
123
+ group: GROUPS.advanced,
124
+ required: false,
125
+ }),
126
+ tension: createStaticNumberProp({
127
+ label: "Change threshold",
128
+ description: "Controls the tension/speed of the swipe animation",
129
+ group: GROUPS.advanced,
130
+ required: false,
131
+ }),
132
+ swipeToOpenVelocityContribution: createStaticNumberProp({
133
+ label: "Swipe Velocity Contribution",
134
+ description: "Describes how much the ending velocity of the gesture affects whether the swipe will result in the item being closed or open. A velocity factor of 0 (the default) means that the velocity will have no bearing on whether the swipe settles on a closed or open position and it'll just take into consideration the swipeToOpenPercent. Ideal values for this prop tend to be between 5 and 15",
135
+ group: GROUPS.advanced,
136
+ required: false,
137
+ }),
138
+ swipeToOpenPercent: createStaticNumberProp({
139
+ label: "Swipe to open percentage",
140
+ description: "What % of the left/right does the user need to swipe past to trigger the view opening",
141
+ group: GROUPS.advanced,
142
+ defaultValue: 50,
143
+ required: false,
144
+ }),
145
+ swipeToClosePercent: createStaticNumberProp({
146
+ label: "Swipe to close percentage",
147
+ description: "What % of the left/right does the user need to swipe past to trigger the view closing",
148
+ group: GROUPS.advanced,
149
+ defaultValue: 50,
150
+ required: false,
151
+ }),
152
+ },
153
+ },
154
+ {
155
+ name: "Swipeable View Button",
156
+ tag: "SwipeableViewButton",
157
+ description: "Button to be rendered under a Swipeable View",
158
+ category: COMPONENT_TYPES.testing /*.view*/,
159
+ stylesPanelSections: [],
160
+ triggers: [Triggers.OnPress],
161
+ props: {
162
+ ...SHARED_SEED_DATA_PROPS,
163
+ onPress: createActionProp(),
164
+ },
165
+ },
166
+ {
167
+ name: "Swipeable View Swipe Handler",
168
+ tag: "SwipeableViewSwipeHandler",
169
+ description: "Component that renders and handles swipe of Swipeable View",
170
+ category: COMPONENT_TYPES.testing /*.view*/,
171
+ stylesPanelSections: [],
172
+ triggers: [Triggers.OnSwipe],
173
+ props: {
174
+ ...SHARED_SEED_DATA_PROPS,
175
+ onSwipe: createActionProp({
176
+ label: "On swipe",
177
+ description: "Called when Swipeable View swiped in the direction this is configured to",
178
+ }),
179
+ },
180
+ },
181
+ ];