@draftbit/core 47.0.1-2f600c.2 → 47.0.1-4681da.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 (80) hide show
  1. package/lib/commonjs/components/AspectRatio.js +1 -17
  2. package/lib/commonjs/components/Button.js +3 -3
  3. package/lib/commonjs/components/Checkbox/Checkbox.js +3 -1
  4. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +2 -1
  5. package/lib/commonjs/components/Checkbox/CheckboxRow.js +2 -1
  6. package/lib/commonjs/components/DeprecatedButton.js +27 -3
  7. package/lib/commonjs/components/DeprecatedFAB.js +2 -1
  8. package/lib/commonjs/components/Touchable.js +3 -8
  9. package/lib/commonjs/constants.js +1 -1
  10. package/lib/commonjs/mappings/Button.js +10 -39
  11. package/lib/commonjs/mappings/FlashList.js +45 -2
  12. package/lib/commonjs/mappings/FlatList.js +12 -0
  13. package/lib/commonjs/mappings/Touchable.js +7 -47
  14. package/lib/module/components/Accordion/AccordionItem.js +4 -25
  15. package/lib/module/components/AnimatedCircularProgress.js +1 -13
  16. package/lib/module/components/Button.js +3 -3
  17. package/lib/module/components/Checkbox/Checkbox.js +6 -4
  18. package/lib/module/components/Checkbox/CheckboxGroupRow.js +7 -25
  19. package/lib/module/components/Checkbox/CheckboxRow.js +8 -25
  20. package/lib/module/components/DeprecatedButton.js +28 -4
  21. package/lib/module/components/DeprecatedCardWrapper.js +1 -18
  22. package/lib/module/components/DeprecatedFAB.js +3 -2
  23. package/lib/module/components/NumberInput.js +3 -12
  24. package/lib/module/components/Portal/Portal.js +6 -2
  25. package/lib/module/components/ProgressBar.js +7 -39
  26. package/lib/module/components/Switch.js +10 -21
  27. package/lib/module/components/Touchable.js +3 -8
  28. package/lib/module/constants.js +0 -1
  29. package/lib/module/mappings/Button.js +11 -40
  30. package/lib/module/mappings/FlashList.js +46 -3
  31. package/lib/module/mappings/FlatList.js +13 -1
  32. package/lib/module/mappings/Touchable.js +9 -49
  33. package/lib/typescript/src/components/Button.d.ts.map +1 -1
  34. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
  35. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
  36. package/lib/typescript/src/components/Checkbox/CheckboxGroupRow.d.ts.map +1 -1
  37. package/lib/typescript/src/components/Checkbox/CheckboxRow.d.ts.map +1 -1
  38. package/lib/typescript/src/components/DeprecatedButton.d.ts +2 -2
  39. package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -1
  40. package/lib/typescript/src/components/DeprecatedFAB.d.ts +2 -2
  41. package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
  42. package/lib/typescript/src/components/Touchable.d.ts +2 -7
  43. package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
  44. package/lib/typescript/src/mappings/Button.d.ts +4 -113
  45. package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
  46. package/lib/typescript/src/mappings/FlashList.d.ts +112 -2
  47. package/lib/typescript/src/mappings/FlashList.d.ts.map +1 -1
  48. package/lib/typescript/src/mappings/FlatList.d.ts +42 -0
  49. package/lib/typescript/src/mappings/FlatList.d.ts.map +1 -1
  50. package/lib/typescript/src/mappings/Touchable.d.ts +5 -59
  51. package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -1
  52. package/package.json +3 -3
  53. package/src/components/Button.js +3 -3
  54. package/src/components/Button.tsx +4 -14
  55. package/src/components/Checkbox/Checkbox.js +3 -2
  56. package/src/components/Checkbox/Checkbox.tsx +7 -5
  57. package/src/components/Checkbox/CheckboxGroupRow.js +3 -2
  58. package/src/components/Checkbox/CheckboxGroupRow.tsx +3 -3
  59. package/src/components/Checkbox/CheckboxRow.js +3 -2
  60. package/src/components/Checkbox/CheckboxRow.tsx +3 -3
  61. package/src/components/DeprecatedButton.js +16 -4
  62. package/src/components/DeprecatedButton.tsx +31 -7
  63. package/src/components/DeprecatedFAB.js +3 -2
  64. package/src/components/DeprecatedFAB.tsx +5 -5
  65. package/src/components/Touchable.js +3 -3
  66. package/src/components/Touchable.tsx +4 -14
  67. package/src/mappings/Button.js +10 -39
  68. package/src/mappings/Button.ts +10 -41
  69. package/src/mappings/FlashList.js +77 -31
  70. package/src/mappings/FlashList.ts +82 -30
  71. package/src/mappings/FlatList.js +13 -1
  72. package/src/mappings/FlatList.ts +16 -0
  73. package/src/mappings/Touchable.js +7 -50
  74. package/src/mappings/Touchable.ts +6 -53
  75. package/lib/commonjs/components/Pressable.js +0 -37
  76. package/lib/module/components/Pressable.js +0 -30
  77. package/lib/typescript/src/components/Pressable.d.ts +0 -16
  78. package/lib/typescript/src/components/Pressable.d.ts.map +0 -1
  79. package/src/components/Pressable.js +0 -12
  80. package/src/components/Pressable.tsx +0 -50
@@ -1,33 +1,79 @@
1
- import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, createNumberProp, CONTAINER_COMPONENT_STYLES_SECTIONS, GROUPS, } from "@draftbit/types";
2
- export const SEED_DATA = {
3
- name: "FlashList",
4
- tag: "FlashList",
5
- description: "Flashlist by Shopify",
6
- packageName: "@shopify/flash-list",
7
- category: COMPONENT_TYPES.data,
8
- stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
9
- layout: {
10
- flex: 1,
1
+ import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, createNumberProp, CONTAINER_COMPONENT_STYLES_SECTIONS, GROUPS, Triggers, createActionProp, createStaticNumberProp, } from "@draftbit/types";
2
+ export const SEED_DATA = [
3
+ {
4
+ name: "Masonry List",
5
+ tag: "MasonryFlashList",
6
+ description: "Masonry Flashlist by Shopify",
7
+ packageName: "@shopify/flash-list",
8
+ category: COMPONENT_TYPES.data,
9
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
10
+ layout: {
11
+ flex: 1,
12
+ },
13
+ triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
14
+ props: {
15
+ onRefresh: createActionProp(),
16
+ onEndReached: createActionProp(),
17
+ numColumns: createNumColumnsType({
18
+ editable: true,
19
+ }),
20
+ estimatedItemSize: createNumberProp({
21
+ group: GROUPS.basic,
22
+ label: "Est. Item Size",
23
+ description: "Approximate size of the items before rendering.",
24
+ defaultValue: 50,
25
+ step: 1,
26
+ precision: 0,
27
+ }),
28
+ optimizeItemArrangement: createStaticBoolProp({
29
+ label: "Optimize Item Arrangement",
30
+ description: "If enabled, MasonryFlashList will try to reduce difference in column height by modifying item order. If true, specifying overrideItemLayout is required. Default value is false.",
31
+ }),
32
+ onEndReachedThreshold: createStaticNumberProp({
33
+ label: "End Reached Threshold",
34
+ description: "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
35
+ defaultValue: 0.5,
36
+ }),
37
+ },
11
38
  },
12
- props: {
13
- estimatedItemSize: createNumberProp({
14
- group: GROUPS.basic,
15
- label: "Est. Item Size",
16
- description: "Approximate size of the items before rendering.",
17
- defaultValue: 50,
18
- step: 1,
19
- precision: 0,
20
- }),
21
- horizontal: createStaticBoolProp({
22
- label: "Horizontal",
23
- description: "Render list horizontally",
24
- }),
25
- inverted: createStaticBoolProp({
26
- label: "Inverted",
27
- description: "If true, reverses the direction.",
28
- }),
29
- numColumns: createNumColumnsType({
30
- editable: true,
31
- }),
39
+ {
40
+ name: "FlashList",
41
+ tag: "FlashList",
42
+ description: "Flashlist by Shopify",
43
+ packageName: "@shopify/flash-list",
44
+ category: COMPONENT_TYPES.data,
45
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
46
+ layout: {
47
+ flex: 1,
48
+ },
49
+ triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
50
+ props: {
51
+ onRefresh: createActionProp(),
52
+ onEndReached: createActionProp(),
53
+ estimatedItemSize: createNumberProp({
54
+ group: GROUPS.basic,
55
+ label: "Est. Item Size",
56
+ description: "Approximate size of the items before rendering.",
57
+ defaultValue: 50,
58
+ step: 1,
59
+ precision: 0,
60
+ }),
61
+ horizontal: createStaticBoolProp({
62
+ label: "Horizontal",
63
+ description: "Render list horizontally",
64
+ }),
65
+ inverted: createStaticBoolProp({
66
+ label: "Inverted",
67
+ description: "If true, reverses the direction.",
68
+ }),
69
+ numColumns: createNumColumnsType({
70
+ editable: true,
71
+ }),
72
+ onEndReachedThreshold: createStaticNumberProp({
73
+ label: "End Reached Threshold",
74
+ description: "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
75
+ defaultValue: 0.5,
76
+ }),
77
+ },
32
78
  },
33
- };
79
+ ];
@@ -5,37 +5,89 @@ import {
5
5
  createNumberProp,
6
6
  CONTAINER_COMPONENT_STYLES_SECTIONS,
7
7
  GROUPS,
8
+ Triggers,
9
+ createActionProp,
10
+ createStaticNumberProp,
8
11
  } from "@draftbit/types";
9
12
 
10
- export const SEED_DATA = {
11
- name: "FlashList",
12
- tag: "FlashList",
13
- description: "Flashlist by Shopify",
14
- packageName: "@shopify/flash-list",
15
- category: COMPONENT_TYPES.data,
16
- stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
17
- layout: {
18
- flex: 1,
13
+ export const SEED_DATA = [
14
+ {
15
+ name: "Masonry List",
16
+ tag: "MasonryFlashList",
17
+ description: "Masonry Flashlist by Shopify",
18
+ packageName: "@shopify/flash-list",
19
+ category: COMPONENT_TYPES.data,
20
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
21
+ layout: {
22
+ flex: 1,
23
+ },
24
+ triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
25
+ props: {
26
+ onRefresh: createActionProp(),
27
+ onEndReached: createActionProp(),
28
+ numColumns: createNumColumnsType({
29
+ editable: true,
30
+ }),
31
+ estimatedItemSize: createNumberProp({
32
+ group: GROUPS.basic,
33
+ label: "Est. Item Size",
34
+ description: "Approximate size of the items before rendering.",
35
+ defaultValue: 50,
36
+ step: 1,
37
+ precision: 0,
38
+ }),
39
+ optimizeItemArrangement: createStaticBoolProp({
40
+ label: "Optimize Item Arrangement",
41
+ description:
42
+ "If enabled, MasonryFlashList will try to reduce difference in column height by modifying item order. If true, specifying overrideItemLayout is required. Default value is false.",
43
+ }),
44
+ onEndReachedThreshold: createStaticNumberProp({
45
+ label: "End Reached Threshold",
46
+ description:
47
+ "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
48
+ defaultValue: 0.5,
49
+ }),
50
+ },
19
51
  },
20
- props: {
21
- estimatedItemSize: createNumberProp({
22
- group: GROUPS.basic,
23
- label: "Est. Item Size",
24
- description: "Approximate size of the items before rendering.",
25
- defaultValue: 50,
26
- step: 1,
27
- precision: 0,
28
- }),
29
- horizontal: createStaticBoolProp({
30
- label: "Horizontal",
31
- description: "Render list horizontally",
32
- }),
33
- inverted: createStaticBoolProp({
34
- label: "Inverted",
35
- description: "If true, reverses the direction.",
36
- }),
37
- numColumns: createNumColumnsType({
38
- editable: true,
39
- }),
52
+ {
53
+ name: "FlashList",
54
+ tag: "FlashList",
55
+ description: "Flashlist by Shopify",
56
+ packageName: "@shopify/flash-list",
57
+ category: COMPONENT_TYPES.data,
58
+ stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
59
+ layout: {
60
+ flex: 1,
61
+ },
62
+ triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
63
+ props: {
64
+ onRefresh: createActionProp(),
65
+ onEndReached: createActionProp(),
66
+ estimatedItemSize: createNumberProp({
67
+ group: GROUPS.basic,
68
+ label: "Est. Item Size",
69
+ description: "Approximate size of the items before rendering.",
70
+ defaultValue: 50,
71
+ step: 1,
72
+ precision: 0,
73
+ }),
74
+ horizontal: createStaticBoolProp({
75
+ label: "Horizontal",
76
+ description: "Render list horizontally",
77
+ }),
78
+ inverted: createStaticBoolProp({
79
+ label: "Inverted",
80
+ description: "If true, reverses the direction.",
81
+ }),
82
+ numColumns: createNumColumnsType({
83
+ editable: true,
84
+ }),
85
+ onEndReachedThreshold: createStaticNumberProp({
86
+ label: "End Reached Threshold",
87
+ description:
88
+ "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
89
+ defaultValue: 0.5,
90
+ }),
91
+ },
40
92
  },
41
- };
93
+ ];
@@ -1,4 +1,4 @@
1
- import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, CONTAINER_COMPONENT_STYLES_SECTIONS, } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, createNumColumnsType, createStaticBoolProp, CONTAINER_COMPONENT_STYLES_SECTIONS, Triggers, createActionProp, createStaticNumberProp, } from "@draftbit/types";
2
2
  export const SEED_DATA = {
3
3
  name: "List",
4
4
  tag: "FlatList",
@@ -8,7 +8,10 @@ export const SEED_DATA = {
8
8
  layout: {
9
9
  flex: 1,
10
10
  },
11
+ triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
11
12
  props: {
13
+ onRefresh: createActionProp(),
14
+ onEndReached: createActionProp(),
12
15
  horizontal: createStaticBoolProp({
13
16
  label: "Horizontal",
14
17
  description: "Render list horizontally",
@@ -20,5 +23,14 @@ export const SEED_DATA = {
20
23
  numColumns: createNumColumnsType({
21
24
  editable: true,
22
25
  }),
26
+ initialNumToRender: createStaticBoolProp({
27
+ label: "Initial Num To Render",
28
+ descriprion: "How many items to render in the initial batch",
29
+ }),
30
+ onEndReachedThreshold: createStaticNumberProp({
31
+ label: "End Reached Threshold",
32
+ description: "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
33
+ defaultValue: 0.5,
34
+ }),
23
35
  },
24
36
  };
@@ -3,6 +3,9 @@ import {
3
3
  createNumColumnsType,
4
4
  createStaticBoolProp,
5
5
  CONTAINER_COMPONENT_STYLES_SECTIONS,
6
+ Triggers,
7
+ createActionProp,
8
+ createStaticNumberProp,
6
9
  } from "@draftbit/types";
7
10
 
8
11
  export const SEED_DATA = {
@@ -14,7 +17,10 @@ export const SEED_DATA = {
14
17
  layout: {
15
18
  flex: 1,
16
19
  },
20
+ triggers: [Triggers.OnRefresh, Triggers.OnEndReached],
17
21
  props: {
22
+ onRefresh: createActionProp(),
23
+ onEndReached: createActionProp(),
18
24
  horizontal: createStaticBoolProp({
19
25
  label: "Horizontal",
20
26
  description: "Render list horizontally",
@@ -26,5 +32,15 @@ export const SEED_DATA = {
26
32
  numColumns: createNumColumnsType({
27
33
  editable: true,
28
34
  }),
35
+ initialNumToRender: createStaticBoolProp({
36
+ label: "Initial Num To Render",
37
+ descriprion: "How many items to render in the initial batch",
38
+ }),
39
+ onEndReachedThreshold: createStaticNumberProp({
40
+ label: "End Reached Threshold",
41
+ description:
42
+ "How far from the end (in units of visible length of the list) the bottom edge of the list must be from the end of the content to trigger the onEndReached callback. Thus a value of 0.5 will trigger onEndReached when the end of the content is within half the visible length of the list.",
43
+ defaultValue: 0.5,
44
+ }),
29
45
  },
30
46
  };
@@ -1,60 +1,17 @@
1
- import { COMPONENT_TYPES, createActionProp, Triggers, createStaticNumberProp, StylesPanelSections, } from "@draftbit/types";
2
- const SEED_DATA_PROPS = {
1
+ import { COMPONENT_TYPES, createActionProp, Triggers, StylesPanelSections, } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "Touchable",
4
+ tag: "Touchable",
5
+ description: "Simple button with no styles",
6
+ category: COMPONENT_TYPES.button,
3
7
  stylesPanelSections: [
4
8
  StylesPanelSections.Size,
5
9
  StylesPanelSections.Margins,
6
10
  StylesPanelSections.Borders,
7
11
  ],
8
12
  layout: {},
9
- triggers: [Triggers.OnPress, Triggers.OnLongPress],
13
+ triggers: [Triggers.OnPress],
10
14
  props: {
11
15
  onPress: createActionProp(),
12
- onLongPress: createActionProp(),
13
- activeOpacity: createStaticNumberProp({
14
- label: "Active Opacity",
15
- description: "The opacity when the button is pressed.",
16
- defaultValue: 0.8,
17
- min: 0,
18
- max: 1,
19
- step: 0.01,
20
- precision: 2,
21
- required: false,
22
- }),
23
- disabledOpacity: createStaticNumberProp({
24
- label: "Disabled Opacity",
25
- description: "The opacity when the button is disabled.",
26
- defaultValue: 0.8,
27
- min: 0,
28
- max: 1,
29
- step: 0.01,
30
- precision: 2,
31
- required: false,
32
- }),
33
- delayLongPress: createStaticNumberProp({
34
- label: "Delay Long Press",
35
- description: "Duration (in milliseconds) from onPressIn before onLongPress is called.",
36
- required: false,
37
- }),
38
- hitSlop: createStaticNumberProp({
39
- label: "Hit Slop",
40
- description: "Sets additional distance outside of element in which a press can be detected.",
41
- required: false,
42
- }),
43
16
  },
44
17
  };
45
- export const SEED_DATA = [
46
- {
47
- name: "Touchable",
48
- tag: "Touchable",
49
- description: "An interactive view with no styles",
50
- category: COMPONENT_TYPES.deprecated,
51
- ...SEED_DATA_PROPS,
52
- },
53
- {
54
- name: "Pressable",
55
- tag: "Pressable",
56
- description: "An interactive view with no styles",
57
- category: COMPONENT_TYPES.button,
58
- ...SEED_DATA_PROPS,
59
- },
60
- ];
@@ -2,69 +2,22 @@ import {
2
2
  COMPONENT_TYPES,
3
3
  createActionProp,
4
4
  Triggers,
5
- createStaticNumberProp,
6
5
  StylesPanelSections,
7
6
  } from "@draftbit/types";
8
7
 
9
- const SEED_DATA_PROPS = {
8
+ export const SEED_DATA = {
9
+ name: "Touchable",
10
+ tag: "Touchable",
11
+ description: "Simple button with no styles",
12
+ category: COMPONENT_TYPES.button,
10
13
  stylesPanelSections: [
11
14
  StylesPanelSections.Size,
12
15
  StylesPanelSections.Margins,
13
16
  StylesPanelSections.Borders,
14
17
  ],
15
18
  layout: {},
16
- triggers: [Triggers.OnPress, Triggers.OnLongPress],
19
+ triggers: [Triggers.OnPress],
17
20
  props: {
18
21
  onPress: createActionProp(),
19
- onLongPress: createActionProp(),
20
- activeOpacity: createStaticNumberProp({
21
- label: "Active Opacity",
22
- description: "The opacity when the button is pressed.",
23
- defaultValue: 0.8,
24
- min: 0,
25
- max: 1,
26
- step: 0.01,
27
- precision: 2,
28
- required: false,
29
- }),
30
- disabledOpacity: createStaticNumberProp({
31
- label: "Disabled Opacity",
32
- description: "The opacity when the button is disabled.",
33
- defaultValue: 0.8,
34
- min: 0,
35
- max: 1,
36
- step: 0.01,
37
- precision: 2,
38
- required: false,
39
- }),
40
- delayLongPress: createStaticNumberProp({
41
- label: "Delay Long Press",
42
- description:
43
- "Duration (in milliseconds) from onPressIn before onLongPress is called.",
44
- required: false,
45
- }),
46
- hitSlop: createStaticNumberProp({
47
- label: "Hit Slop",
48
- description:
49
- "Sets additional distance outside of element in which a press can be detected.",
50
- required: false,
51
- }),
52
22
  },
53
23
  };
54
-
55
- export const SEED_DATA = [
56
- {
57
- name: "Touchable",
58
- tag: "Touchable",
59
- description: "An interactive view with no styles",
60
- category: COMPONENT_TYPES.deprecated,
61
- ...SEED_DATA_PROPS,
62
- },
63
- {
64
- name: "Pressable",
65
- tag: "Pressable",
66
- description: "An interactive view with no styles",
67
- category: COMPONENT_TYPES.button,
68
- ...SEED_DATA_PROPS,
69
- },
70
- ];
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = Pressable;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _reactNative = require("react-native");
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
11
- function Pressable(_ref) {
12
- let {
13
- children,
14
- disabled,
15
- onPress,
16
- activeOpacity,
17
- disabledOpacity,
18
- delayLongPress,
19
- hitSlop,
20
- style,
21
- ...props
22
- } = _ref;
23
- return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, _extends({
24
- onPress: onPress,
25
- disabled: disabled,
26
- delayLongPress: delayLongPress ? delayLongPress : 500,
27
- hitSlop: hitSlop ? hitSlop : 8,
28
- style: _ref2 => {
29
- let {
30
- pressed
31
- } = _ref2;
32
- return [{
33
- opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
34
- }, style];
35
- }
36
- }, props), children);
37
- }
@@ -1,30 +0,0 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import React from "react";
3
- import { Pressable as NativePressable } from "react-native";
4
- export default function Pressable(_ref) {
5
- let {
6
- children,
7
- disabled,
8
- onPress,
9
- activeOpacity,
10
- disabledOpacity,
11
- delayLongPress,
12
- hitSlop,
13
- style,
14
- ...props
15
- } = _ref;
16
- return /*#__PURE__*/React.createElement(NativePressable, _extends({
17
- onPress: onPress,
18
- disabled: disabled,
19
- delayLongPress: delayLongPress ? delayLongPress : 500,
20
- hitSlop: hitSlop ? hitSlop : 8,
21
- style: _ref2 => {
22
- let {
23
- pressed
24
- } = _ref2;
25
- return [{
26
- opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
27
- }, style];
28
- }
29
- }, props), children);
30
- }
@@ -1,16 +0,0 @@
1
- import React from "react";
2
- import { PressableProps, ViewStyle } from "react-native";
3
- declare type Props = {
4
- disabled?: boolean;
5
- children: React.ReactNode;
6
- style?: ViewStyle;
7
- onPress?: () => void;
8
- onLongPress?: () => void;
9
- delayLongPress?: number;
10
- hitSlop?: number;
11
- activeOpacity?: number;
12
- disabledOpacity?: number;
13
- } & PressableProps;
14
- export default function Pressable({ children, disabled, onPress, activeOpacity, disabledOpacity, delayLongPress, hitSlop, style, ...props }: Props): JSX.Element;
15
- export {};
16
- //# sourceMappingURL=Pressable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../../../src/components/Pressable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,cAAc,EACd,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,aAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,cAAc,CAAC;AAEnB,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,aAAa,EACb,eAAe,EACf,cAAc,EACd,OAAO,EACP,KAAK,EACL,GAAG,KAAK,EACT,EAAE,KAAK,eAoBP"}
@@ -1,12 +0,0 @@
1
- import React from "react";
2
- import { Pressable as NativePressable, } from "react-native";
3
- export default function Pressable({ children, disabled, onPress, activeOpacity, disabledOpacity, delayLongPress, hitSlop, style, ...props }) {
4
- return (React.createElement(NativePressable, { onPress: onPress, disabled: disabled, delayLongPress: delayLongPress ? delayLongPress : 500, hitSlop: hitSlop ? hitSlop : 8, style: ({ pressed }) => {
5
- return [
6
- {
7
- opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
8
- },
9
- style,
10
- ];
11
- }, ...props }, children));
12
- }
@@ -1,50 +0,0 @@
1
- import React from "react";
2
- import {
3
- Pressable as NativePressable,
4
- PressableProps,
5
- ViewStyle,
6
- } from "react-native";
7
-
8
- type Props = {
9
- disabled?: boolean;
10
- children: React.ReactNode;
11
- style?: ViewStyle;
12
- onPress?: () => void;
13
- onLongPress?: () => void;
14
- delayLongPress?: number;
15
- hitSlop?: number;
16
- activeOpacity?: number;
17
- disabledOpacity?: number;
18
- } & PressableProps;
19
-
20
- export default function Pressable({
21
- children,
22
- disabled,
23
- onPress,
24
- activeOpacity,
25
- disabledOpacity,
26
- delayLongPress,
27
- hitSlop,
28
- style,
29
- ...props
30
- }: Props) {
31
- return (
32
- <NativePressable
33
- onPress={onPress}
34
- disabled={disabled}
35
- delayLongPress={delayLongPress ? delayLongPress : 500}
36
- hitSlop={hitSlop ? hitSlop : 8}
37
- style={({ pressed }) => {
38
- return [
39
- {
40
- opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
41
- },
42
- style,
43
- ];
44
- }}
45
- {...props}
46
- >
47
- {children}
48
- </NativePressable>
49
- );
50
- }