@draftbit/core 47.0.1-17098e.2 → 47.0.1-5c6c55.2

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/Button.js +15 -27
  2. package/lib/commonjs/components/Checkbox/Checkbox.js +3 -1
  3. package/lib/commonjs/components/DeprecatedButton.js +151 -0
  4. package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -2
  5. package/lib/commonjs/components/DeprecatedFAB.js +2 -1
  6. package/lib/commonjs/components/Picker/Picker.js +4 -3
  7. package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
  8. package/lib/commonjs/components/Touchable.js +11 -27
  9. package/lib/commonjs/components/Touchable.web.js +9 -0
  10. package/lib/commonjs/mappings/Button.js +10 -14
  11. package/lib/commonjs/mappings/DatePickerModal.js +75 -0
  12. package/lib/commonjs/mappings/Touchable.js +20 -0
  13. package/lib/module/components/Button.js +9 -21
  14. package/lib/module/components/Checkbox/Checkbox.js +3 -2
  15. package/lib/module/components/DeprecatedButton.js +141 -0
  16. package/lib/module/components/DeprecatedCardWrapper.js +2 -2
  17. package/lib/module/components/DeprecatedFAB.js +3 -2
  18. package/lib/module/components/Picker/Picker.js +4 -3
  19. package/lib/module/components/Picker/PickerComponent.ios.js +1 -1
  20. package/lib/module/components/Touchable.js +10 -25
  21. package/lib/module/components/Touchable.web.js +2 -0
  22. package/lib/module/mappings/Button.js +11 -15
  23. package/lib/module/mappings/DatePickerModal.js +66 -0
  24. package/lib/module/mappings/Touchable.js +13 -0
  25. package/lib/typescript/src/components/Button.d.ts +0 -2
  26. package/lib/typescript/src/components/Button.d.ts.map +1 -1
  27. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
  28. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
  29. package/lib/typescript/src/components/DeprecatedButton.d.ts +54 -0
  30. package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -0
  31. package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +1 -1
  32. package/lib/typescript/src/components/DeprecatedFAB.d.ts +2 -2
  33. package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
  34. package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
  35. package/lib/typescript/src/components/Touchable.d.ts +2 -9
  36. package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
  37. package/lib/typescript/src/components/Touchable.web.d.ts +3 -0
  38. package/lib/typescript/src/components/Touchable.web.d.ts.map +1 -0
  39. package/lib/typescript/src/mappings/Button.d.ts +2 -224
  40. package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
  41. package/lib/typescript/src/mappings/DatePickerModal.d.ts +155 -0
  42. package/lib/typescript/src/mappings/DatePickerModal.d.ts.map +1 -0
  43. package/lib/typescript/src/mappings/Touchable.d.ts +22 -0
  44. package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -0
  45. package/package.json +3 -3
  46. package/src/components/Button.js +11 -18
  47. package/src/components/Button.tsx +11 -45
  48. package/src/components/Checkbox/Checkbox.js +3 -2
  49. package/src/components/Checkbox/Checkbox.tsx +7 -5
  50. package/src/components/DeprecatedButton.js +95 -0
  51. package/src/components/DeprecatedButton.tsx +214 -0
  52. package/src/components/DeprecatedCardWrapper.js +2 -2
  53. package/src/components/DeprecatedCardWrapper.tsx +4 -3
  54. package/src/components/DeprecatedFAB.js +3 -2
  55. package/src/components/DeprecatedFAB.tsx +5 -5
  56. package/src/components/Picker/Picker.js +4 -3
  57. package/src/components/Picker/Picker.tsx +4 -4
  58. package/src/components/Picker/PickerComponent.ios.js +1 -1
  59. package/src/components/Picker/PickerComponent.ios.tsx +1 -1
  60. package/src/components/Touchable.js +11 -16
  61. package/src/components/Touchable.tsx +11 -42
  62. package/src/components/Touchable.web.js +2 -0
  63. package/src/components/Touchable.web.tsx +3 -0
  64. package/src/mappings/Button.js +10 -14
  65. package/src/mappings/Button.ts +10 -14
  66. package/src/mappings/DatePickerModal.js +74 -0
  67. package/src/mappings/DatePickerModal.ts +92 -0
  68. package/src/mappings/Touchable.js +17 -0
  69. package/src/mappings/Touchable.ts +23 -0
  70. package/lib/commonjs/components/Pressable.js +0 -48
  71. package/lib/commonjs/mappings/Pressable.js +0 -52
  72. package/lib/module/components/Pressable.js +0 -40
  73. package/lib/module/mappings/Pressable.js +0 -45
  74. package/lib/typescript/src/components/Pressable.d.ts +0 -18
  75. package/lib/typescript/src/components/Pressable.d.ts.map +0 -1
  76. package/lib/typescript/src/mappings/Pressable.d.ts +0 -76
  77. package/lib/typescript/src/mappings/Pressable.d.ts.map +0 -1
  78. package/src/components/Pressable.js +0 -17
  79. package/src/components/Pressable.tsx +0 -67
  80. package/src/mappings/Pressable.js +0 -52
  81. package/src/mappings/Pressable.ts +0 -63
@@ -5,122 +5,10 @@ export declare const SEED_DATA: ({
5
5
  stylesPanelSections: string[];
6
6
  layout: {
7
7
  backgroundColor: string;
8
- borderRadius: number;
9
- fontFamily: string;
10
8
  borderWidth: number;
11
9
  textAlign: string;
12
- height?: undefined;
13
- };
14
- triggers: string[];
15
- props: {
16
- onPress: {
17
- label: string;
18
- description: string;
19
- editable: boolean;
20
- required: boolean;
21
- formType: string;
22
- propType: string;
23
- defaultValue: null;
24
- group: string;
25
- };
26
- onLongPress: {
27
- label: string;
28
- description: string;
29
- editable: boolean;
30
- required: boolean;
31
- formType: string;
32
- propType: string;
33
- defaultValue: null;
34
- group: string;
35
- };
36
- icon: {
37
- label: string;
38
- description: string;
39
- formType: string;
40
- propType: string;
41
- defaultValue: string;
42
- required: boolean;
43
- editable: boolean;
44
- group: string;
45
- };
46
- title: any;
47
- disabled: {
48
- label: string;
49
- description: string;
50
- group: string;
51
- editable: boolean;
52
- required: boolean;
53
- formType: string;
54
- propType: string;
55
- defaultValue: null;
56
- };
57
- loading: {
58
- label: string;
59
- description: string;
60
- group: string;
61
- editable: boolean;
62
- required: boolean;
63
- formType: string;
64
- propType: string;
65
- defaultValue: null;
66
- };
67
- activeOpacity: {
68
- label: string;
69
- description: string;
70
- formType: string;
71
- propType: string;
72
- group: string;
73
- defaultValue: null;
74
- editable: boolean;
75
- required: boolean;
76
- step: number;
77
- };
78
- disabledOpacity: {
79
- label: string;
80
- description: string;
81
- formType: string;
82
- propType: string;
83
- group: string;
84
- defaultValue: null;
85
- editable: boolean;
86
- required: boolean;
87
- step: number;
88
- };
89
- delayLongPress: {
90
- label: string;
91
- description: string;
92
- formType: string;
93
- propType: string;
94
- group: string;
95
- defaultValue: null;
96
- editable: boolean;
97
- required: boolean;
98
- step: number;
99
- };
100
- hitSlop: {
101
- label: string;
102
- description: string;
103
- formType: string;
104
- propType: string;
105
- group: string;
106
- defaultValue: null;
107
- editable: boolean;
108
- required: boolean;
109
- step: number;
110
- };
111
- };
112
- } | {
113
- name: string;
114
- tag: string;
115
- category: string;
116
- stylesPanelSections: string[];
117
- layout: {
118
10
  borderRadius: number;
119
11
  fontFamily: string;
120
- backgroundColor: string;
121
- textAlign: string;
122
- borderWidth?: undefined;
123
- height?: undefined;
124
12
  };
125
13
  triggers: string[];
126
14
  props: {
@@ -134,16 +22,6 @@ export declare const SEED_DATA: ({
134
22
  defaultValue: null;
135
23
  group: string;
136
24
  };
137
- onLongPress: {
138
- label: string;
139
- description: string;
140
- editable: boolean;
141
- required: boolean;
142
- formType: string;
143
- propType: string;
144
- defaultValue: null;
145
- group: string;
146
- };
147
25
  icon: {
148
26
  label: string;
149
27
  description: string;
@@ -175,50 +53,6 @@ export declare const SEED_DATA: ({
175
53
  propType: string;
176
54
  defaultValue: null;
177
55
  };
178
- activeOpacity: {
179
- label: string;
180
- description: string;
181
- formType: string;
182
- propType: string;
183
- group: string;
184
- defaultValue: null;
185
- editable: boolean;
186
- required: boolean;
187
- step: number;
188
- };
189
- disabledOpacity: {
190
- label: string;
191
- description: string;
192
- formType: string;
193
- propType: string;
194
- group: string;
195
- defaultValue: null;
196
- editable: boolean;
197
- required: boolean;
198
- step: number;
199
- };
200
- delayLongPress: {
201
- label: string;
202
- description: string;
203
- formType: string;
204
- propType: string;
205
- group: string;
206
- defaultValue: null;
207
- editable: boolean;
208
- required: boolean;
209
- step: number;
210
- };
211
- hitSlop: {
212
- label: string;
213
- description: string;
214
- formType: string;
215
- propType: string;
216
- group: string;
217
- defaultValue: null;
218
- editable: boolean;
219
- required: boolean;
220
- step: number;
221
- };
222
56
  };
223
57
  } | {
224
58
  name: string;
@@ -226,12 +60,10 @@ export declare const SEED_DATA: ({
226
60
  category: string;
227
61
  stylesPanelSections: string[];
228
62
  layout: {
229
- borderRadius: number;
230
- height: number;
231
- fontFamily: string;
232
63
  backgroundColor: string;
233
64
  textAlign: string;
234
- borderWidth?: undefined;
65
+ borderRadius: number;
66
+ fontFamily: string;
235
67
  };
236
68
  triggers: string[];
237
69
  props: {
@@ -245,16 +77,6 @@ export declare const SEED_DATA: ({
245
77
  defaultValue: null;
246
78
  group: string;
247
79
  };
248
- onLongPress: {
249
- label: string;
250
- description: string;
251
- editable: boolean;
252
- required: boolean;
253
- formType: string;
254
- propType: string;
255
- defaultValue: null;
256
- group: string;
257
- };
258
80
  icon: {
259
81
  label: string;
260
82
  description: string;
@@ -286,50 +108,6 @@ export declare const SEED_DATA: ({
286
108
  propType: string;
287
109
  defaultValue: null;
288
110
  };
289
- activeOpacity: {
290
- label: string;
291
- description: string;
292
- formType: string;
293
- propType: string;
294
- group: string;
295
- defaultValue: null;
296
- editable: boolean;
297
- required: boolean;
298
- step: number;
299
- };
300
- disabledOpacity: {
301
- label: string;
302
- description: string;
303
- formType: string;
304
- propType: string;
305
- group: string;
306
- defaultValue: null;
307
- editable: boolean;
308
- required: boolean;
309
- step: number;
310
- };
311
- delayLongPress: {
312
- label: string;
313
- description: string;
314
- formType: string;
315
- propType: string;
316
- group: string;
317
- defaultValue: null;
318
- editable: boolean;
319
- required: boolean;
320
- step: number;
321
- };
322
- hitSlop: {
323
- label: string;
324
- description: string;
325
- formType: string;
326
- propType: string;
327
- group: string;
328
- defaultValue: null;
329
- editable: boolean;
330
- required: boolean;
331
- step: number;
332
- };
333
111
  };
334
112
  })[];
335
113
  //# sourceMappingURL=Button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Button.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqErB,CAAC"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Button.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiErB,CAAC"}
@@ -0,0 +1,155 @@
1
+ export declare const SHARED_SEED_DATA: {
2
+ packageName: string;
3
+ triggers: string[];
4
+ category: string;
5
+ StylesPanelSections: string[];
6
+ layout: null;
7
+ };
8
+ export declare const SHARED_SEED_DATA_PROPS: {
9
+ locale: {};
10
+ visible: {
11
+ label: string;
12
+ description: string;
13
+ formType: string;
14
+ propType: string;
15
+ defaultValue: boolean;
16
+ editable: boolean;
17
+ required: boolean;
18
+ group: string;
19
+ };
20
+ label: any;
21
+ saveLabel: any;
22
+ saveLabelDisabled: {
23
+ label: string;
24
+ description: string;
25
+ formType: string;
26
+ propType: string;
27
+ defaultValue: boolean;
28
+ editable: boolean;
29
+ required: boolean;
30
+ group: string;
31
+ };
32
+ uppercase: {
33
+ label: string;
34
+ description: string;
35
+ formType: string;
36
+ propType: string;
37
+ defaultValue: boolean;
38
+ editable: boolean;
39
+ required: boolean;
40
+ group: string;
41
+ };
42
+ startYear: {
43
+ label: string;
44
+ description: string;
45
+ formType: string;
46
+ propType: string;
47
+ group: string;
48
+ defaultValue: null;
49
+ editable: boolean;
50
+ required: boolean;
51
+ step: number;
52
+ };
53
+ endYear: {
54
+ label: string;
55
+ description: string;
56
+ formType: string;
57
+ propType: string;
58
+ group: string;
59
+ defaultValue: null;
60
+ editable: boolean;
61
+ required: boolean;
62
+ step: number;
63
+ };
64
+ };
65
+ export declare const SEED_DATA: {
66
+ props: {
67
+ locale: {};
68
+ visible: {
69
+ label: string;
70
+ description: string;
71
+ formType: string;
72
+ propType: string;
73
+ defaultValue: boolean;
74
+ editable: boolean;
75
+ required: boolean;
76
+ group: string;
77
+ };
78
+ label: any;
79
+ saveLabel: any;
80
+ saveLabelDisabled: {
81
+ label: string;
82
+ description: string;
83
+ formType: string;
84
+ propType: string;
85
+ defaultValue: boolean;
86
+ editable: boolean;
87
+ required: boolean;
88
+ group: string;
89
+ };
90
+ uppercase: {
91
+ label: string;
92
+ description: string;
93
+ formType: string;
94
+ propType: string;
95
+ defaultValue: boolean;
96
+ editable: boolean;
97
+ required: boolean;
98
+ group: string;
99
+ };
100
+ startYear: {
101
+ label: string;
102
+ description: string;
103
+ formType: string;
104
+ propType: string;
105
+ group: string;
106
+ defaultValue: null;
107
+ editable: boolean;
108
+ required: boolean;
109
+ step: number;
110
+ };
111
+ endYear: {
112
+ label: string;
113
+ description: string;
114
+ formType: string;
115
+ propType: string;
116
+ group: string;
117
+ defaultValue: null;
118
+ editable: boolean;
119
+ required: boolean;
120
+ step: number;
121
+ };
122
+ mode: {
123
+ group: string;
124
+ label: string;
125
+ description: string;
126
+ editable: boolean;
127
+ required: boolean;
128
+ formType: string;
129
+ propType: string;
130
+ defaultValue: null;
131
+ options: never[];
132
+ };
133
+ fieldName: {
134
+ handlerPropName: string;
135
+ valuePropName: string;
136
+ defaultValue: string;
137
+ group: string;
138
+ label: string;
139
+ description: string;
140
+ formType: string;
141
+ propType: string;
142
+ editable: boolean;
143
+ required: boolean;
144
+ };
145
+ };
146
+ packageName: string;
147
+ triggers: string[];
148
+ category: string;
149
+ StylesPanelSections: string[];
150
+ layout: null;
151
+ name: string;
152
+ tag: string;
153
+ description: string;
154
+ }[];
155
+ //# sourceMappingURL=DatePickerModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatePickerModal.d.ts","sourceRoot":"","sources":["../../../../src/mappings/DatePickerModal.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,gBAAgB;;;;;;CAY5B,CAAC;AACF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsClC,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyBrB,CAAC"}
@@ -0,0 +1,22 @@
1
+ export declare const SEED_DATA: {
2
+ name: string;
3
+ tag: string;
4
+ description: string;
5
+ category: string;
6
+ stylesPanelSections: string[];
7
+ layout: {};
8
+ triggers: string[];
9
+ props: {
10
+ onPress: {
11
+ label: string;
12
+ description: string;
13
+ editable: boolean;
14
+ required: boolean;
15
+ formType: string;
16
+ propType: string;
17
+ defaultValue: null;
18
+ group: string;
19
+ };
20
+ };
21
+ };
22
+ //# sourceMappingURL=Touchable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Touchable.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Touchable.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;CAerB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "47.0.1-17098e.2+17098ef",
3
+ "version": "47.0.1-5c6c55.2+5c6c558",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@date-io/date-fns": "^1.3.13",
43
43
  "@draftbit/react-theme-provider": "^2.1.1",
44
- "@draftbit/types": "^47.0.1-17098e.2+17098ef",
44
+ "@draftbit/types": "^47.0.1-5c6c55.2+5c6c558",
45
45
  "@material-ui/core": "^4.11.0",
46
46
  "@material-ui/pickers": "^3.2.10",
47
47
  "@react-native-community/slider": "4.2.4",
@@ -91,5 +91,5 @@
91
91
  ]
92
92
  ]
93
93
  },
94
- "gitHead": "17098ef43f2803aa04abc191f3f193bd8f8e7103"
94
+ "gitHead": "5c6c558c833f8d761b88c7698e34c7e7e4fdca56"
95
95
  }
@@ -1,4 +1,4 @@
1
- import React, { useCallback } from "react";
1
+ import * as React from "react";
2
2
  import { Text, Pressable, Platform, StyleSheet, ActivityIndicator, } from "react-native";
3
3
  import { withTheme } from "../theming";
4
4
  const CONSTANTS = {
@@ -7,7 +7,7 @@ const CONSTANTS = {
7
7
  padding: 8,
8
8
  icon: 24,
9
9
  };
10
- function Base({ Icon, icon, title, onPress, onLongPress, activeOpacity, disabledOpacity, loading, disabled, style, ...props }) {
10
+ function Base({ Icon, icon, title, onPress, loading, disabled, style, ...props }) {
11
11
  const { color, fontFamily, fontWeight, fontSize, lineHeight, letterSpacing, textTransform, textAlign, textDecorationLine, textDecorationColor, textDecorationStyle, ...buttonStyles } = StyleSheet.flatten(style || {});
12
12
  const titleStyles = {
13
13
  color,
@@ -28,22 +28,15 @@ function Base({ Icon, icon, title, onPress, onLongPress, activeOpacity, disabled
28
28
  if (textAlign === "right") {
29
29
  buttonStyles.justifyContent = "flex-end";
30
30
  }
31
- const getOpacity = useCallback((pressed) => {
32
- if (disabled) {
33
- return disabledOpacity;
34
- }
35
- else {
36
- if (pressed)
37
- return activeOpacity;
38
- else
39
- return 1;
40
- }
41
- }, [activeOpacity, disabled, disabledOpacity]);
42
- const _style = useCallback(({ pressed }) => [
43
- buttonStyles,
44
- { opacity: getOpacity(pressed) },
45
- ], [getOpacity, buttonStyles]);
46
- return (React.createElement(Pressable, { onPress: onPress, onLongPress: onLongPress, disabled: disabled || loading, style: (styles.base, _style), ...props },
31
+ return (React.createElement(Pressable, { onPress: onPress, disabled: disabled || loading, style: ({ pressed }) => {
32
+ return [
33
+ styles.base,
34
+ {
35
+ opacity: pressed || disabled ? 0.75 : 1,
36
+ },
37
+ buttonStyles,
38
+ ];
39
+ }, ...props },
47
40
  loading ? (React.createElement(ActivityIndicator, { size: "small", color: color, style: styles.loading })) : null,
48
41
  icon && !loading ? (React.createElement(Icon, { name: icon, color: color, style: styles.icon, size: CONSTANTS.icon })) : null,
49
42
  React.createElement(Text, { style: titleStyles }, title)));
@@ -1,14 +1,11 @@
1
- import React, { useCallback } from "react";
1
+ import * as React from "react";
2
2
  import {
3
3
  Text,
4
4
  Pressable,
5
- PressableProps,
6
- PressableStateCallbackType,
7
5
  Platform,
8
6
  StyleSheet,
9
- StyleProp,
10
7
  TextStyle,
11
- ViewStyle,
8
+ PressableProps,
12
9
  ActivityIndicator,
13
10
  } from "react-native";
14
11
 
@@ -30,12 +27,6 @@ type BaseProps = {
30
27
  loading: boolean;
31
28
  style?: TextStyle;
32
29
  onPress: () => void;
33
- onLongPress?: () => void;
34
- activeOpacity?: number;
35
- disabledOpacity?: number;
36
- delayLongPress?: number;
37
- hitSlop?: number;
38
- pressRetentionOffset?: number;
39
30
  icon?: string;
40
31
  } & PressableProps &
41
32
  IconSlot;
@@ -46,29 +37,16 @@ type Props = {
46
37
  loading: boolean;
47
38
  style?: TextStyle;
48
39
  onPress: () => void;
49
- onLongPress?: () => void;
50
- activeOpacity?: number;
51
- disabledOpacity?: number;
52
- delayLongPress?: number;
53
- hitSlop?: number;
54
- pressRetentionOffset?: number;
55
40
  icon?: string;
56
41
  theme: Theme;
57
42
  } & PressableProps &
58
43
  IconSlot;
59
44
 
60
- export type StyleType = (
61
- state: PressableStateCallbackType
62
- ) => StyleProp<ViewStyle>;
63
-
64
45
  function Base({
65
46
  Icon,
66
47
  icon,
67
48
  title,
68
49
  onPress,
69
- onLongPress,
70
- activeOpacity,
71
- disabledOpacity,
72
50
  loading,
73
51
  disabled,
74
52
  style,
@@ -111,31 +89,19 @@ function Base({
111
89
  buttonStyles.justifyContent = "flex-end";
112
90
  }
113
91
 
114
- const getOpacity = useCallback(
115
- (pressed: boolean) => {
116
- if (disabled) {
117
- return disabledOpacity;
118
- } else {
119
- if (pressed) return activeOpacity;
120
- else return 1;
121
- }
122
- },
123
- [activeOpacity, disabled, disabledOpacity]
124
- );
125
- const _style = useCallback<StyleType>(
126
- ({ pressed }) => [
127
- buttonStyles as ViewStyle,
128
- { opacity: getOpacity(pressed) },
129
- ],
130
- [getOpacity, buttonStyles]
131
- );
132
-
133
92
  return (
134
93
  <Pressable
135
94
  onPress={onPress}
136
- onLongPress={onLongPress}
137
95
  disabled={disabled || loading}
138
- style={(styles.base, _style)}
96
+ style={({ pressed }) => {
97
+ return [
98
+ styles.base,
99
+ {
100
+ opacity: pressed || disabled ? 0.75 : 1,
101
+ },
102
+ buttonStyles,
103
+ ];
104
+ }}
139
105
  {...props}
140
106
  >
141
107
  {loading ? (
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
- import { View, StyleSheet, Pressable, } from "react-native";
2
+ import { View, StyleSheet, } from "react-native";
3
3
  import { useTheme } from "../../theming";
4
+ import Touchable from "../Touchable";
4
5
  import { usePrevious } from "../../hooks";
5
6
  const Checkbox = ({ Icon, status, disabled = false, onPress, onCheck, onUncheck, color, uncheckedColor, defaultValue, checkedIcon = "MaterialCommunityIcons/checkbox-marked", uncheckedIcon = "MaterialCommunityIcons/checkbox-blank-outline", size = 24, style, ...rest }) => {
6
7
  const [internalValue, setInternalValue] = React.useState(status || defaultValue || false);
@@ -32,7 +33,7 @@ const Checkbox = ({ Icon, status, disabled = false, onPress, onCheck, onUncheck,
32
33
  onUncheck === null || onUncheck === void 0 ? void 0 : onUncheck();
33
34
  }
34
35
  };
35
- return (React.createElement(Pressable, { ...rest, onPress: handlePress, disabled: disabled, accessibilityState: { disabled }, accessibilityRole: "button", accessibilityLiveRegion: "polite", style: [styles.container, style, { width: size, height: size }] },
36
+ return (React.createElement(Touchable, { ...rest, onPress: handlePress, disabled: disabled, accessibilityState: { disabled }, accessibilityRole: "button", accessibilityLiveRegion: "polite", style: [styles.container, style, { width: size, height: size }] },
36
37
  React.createElement(Icon, { style: styles.icon, name: internalValue ? checkedIcon : uncheckedIcon, size: size, color: checkboxColor }),
37
38
  React.createElement(View, { style: [StyleSheet.absoluteFill, styles.fillContainer] },
38
39
  React.createElement(View, { style: [
@@ -2,14 +2,14 @@ import * as React from "react";
2
2
  import {
3
3
  View,
4
4
  StyleSheet,
5
+ TouchableHighlightProps,
5
6
  StyleProp,
6
7
  ViewStyle,
7
- Pressable,
8
- PressableProps,
9
8
  } from "react-native";
10
9
  import { useTheme } from "../../theming";
11
10
  import type { IconSlot } from "../../interfaces/Icon";
12
11
 
12
+ import Touchable from "../Touchable";
13
13
  import { usePrevious } from "../../hooks";
14
14
 
15
15
  export interface CheckboxProps {
@@ -27,7 +27,9 @@ export interface CheckboxProps {
27
27
  style?: StyleProp<ViewStyle>;
28
28
  }
29
29
 
30
- const Checkbox: React.FC<CheckboxProps & PressableProps & IconSlot> = ({
30
+ const Checkbox: React.FC<
31
+ CheckboxProps & TouchableHighlightProps & IconSlot
32
+ > = ({
31
33
  Icon,
32
34
  status,
33
35
  disabled = false,
@@ -85,7 +87,7 @@ const Checkbox: React.FC<CheckboxProps & PressableProps & IconSlot> = ({
85
87
  };
86
88
 
87
89
  return (
88
- <Pressable
90
+ <Touchable
89
91
  {...rest}
90
92
  onPress={handlePress}
91
93
  disabled={disabled}
@@ -109,7 +111,7 @@ const Checkbox: React.FC<CheckboxProps & PressableProps & IconSlot> = ({
109
111
  ]}
110
112
  />
111
113
  </View>
112
- </Pressable>
114
+ </Touchable>
113
115
  );
114
116
  };
115
117