@draftbit/core 46.5.2-13b65f.2 → 46.5.2-404403.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.
- package/lib/commonjs/components/Button.js +15 -27
- package/lib/commonjs/components/Checkbox/Checkbox.js +3 -1
- package/lib/commonjs/components/DeprecatedButton.js +151 -0
- package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -2
- package/lib/commonjs/components/DeprecatedFAB.js +2 -1
- package/lib/commonjs/components/Picker/Picker.js +4 -3
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
- package/lib/commonjs/components/Touchable.js +11 -27
- package/lib/commonjs/components/Touchable.web.js +9 -0
- package/lib/commonjs/constants.js +1 -1
- package/lib/commonjs/mappings/Button.js +10 -13
- package/lib/commonjs/mappings/Touchable.js +20 -0
- package/lib/module/components/Button.js +9 -21
- package/lib/module/components/Checkbox/Checkbox.js +3 -2
- package/lib/module/components/DeprecatedButton.js +141 -0
- package/lib/module/components/DeprecatedCardWrapper.js +2 -2
- package/lib/module/components/DeprecatedFAB.js +3 -2
- package/lib/module/components/Picker/Picker.js +4 -3
- package/lib/module/components/Picker/PickerComponent.ios.js +1 -1
- package/lib/module/components/Touchable.js +10 -25
- package/lib/module/components/Touchable.web.js +2 -0
- package/lib/module/mappings/Button.js +11 -14
- package/lib/module/mappings/Touchable.js +13 -0
- package/lib/typescript/src/components/Button.d.ts +0 -2
- package/lib/typescript/src/components/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/src/components/DeprecatedButton.d.ts +54 -0
- package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -0
- package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +1 -1
- package/lib/typescript/src/components/DeprecatedFAB.d.ts +2 -2
- package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.d.ts +2 -9
- package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable.web.d.ts +3 -0
- package/lib/typescript/src/components/Touchable.web.d.ts.map +1 -0
- package/lib/typescript/src/mappings/Button.d.ts +4 -113
- package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Touchable.d.ts +22 -0
- package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -0
- package/package.json +7 -7
- package/src/components/Button.js +11 -18
- package/src/components/Button.tsx +11 -45
- package/src/components/Checkbox/Checkbox.js +3 -2
- package/src/components/Checkbox/Checkbox.tsx +7 -5
- package/src/components/DeprecatedButton.js +95 -0
- package/src/components/DeprecatedButton.tsx +214 -0
- package/src/components/DeprecatedCardWrapper.js +2 -2
- package/src/components/DeprecatedCardWrapper.tsx +4 -3
- package/src/components/DeprecatedFAB.js +3 -2
- package/src/components/DeprecatedFAB.tsx +5 -5
- package/src/components/Picker/Picker.js +4 -3
- package/src/components/Picker/Picker.tsx +4 -4
- package/src/components/Picker/PickerComponent.ios.js +1 -1
- package/src/components/Picker/PickerComponent.ios.tsx +1 -1
- package/src/components/Touchable.js +11 -16
- package/src/components/Touchable.tsx +11 -42
- package/src/components/Touchable.web.js +2 -0
- package/src/components/Touchable.web.tsx +3 -0
- package/src/mappings/Button.js +10 -13
- package/src/mappings/Button.ts +10 -13
- package/src/mappings/Touchable.js +17 -0
- package/src/mappings/Touchable.ts +23 -0
- package/lib/commonjs/components/Pressable.js +0 -48
- package/lib/commonjs/mappings/Pressable.js +0 -34
- package/lib/module/components/Pressable.js +0 -40
- package/lib/module/mappings/Pressable.js +0 -27
- package/lib/typescript/src/components/Pressable.d.ts +0 -18
- package/lib/typescript/src/components/Pressable.d.ts.map +0 -1
- package/lib/typescript/src/mappings/Pressable.d.ts +0 -76
- package/lib/typescript/src/mappings/Pressable.d.ts.map +0 -1
- package/src/components/Pressable.js +0 -17
- package/src/components/Pressable.tsx +0 -67
- package/src/mappings/Pressable.js +0 -34
- package/src/mappings/Pressable.ts +0 -42
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = Pressable;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
-
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); }
|
|
12
|
-
function Pressable(_ref) {
|
|
13
|
-
let {
|
|
14
|
-
children,
|
|
15
|
-
disabled,
|
|
16
|
-
onPress,
|
|
17
|
-
onLongPress,
|
|
18
|
-
hitSlop,
|
|
19
|
-
delayLongPress,
|
|
20
|
-
activeOpacity,
|
|
21
|
-
disabledOpacity,
|
|
22
|
-
style,
|
|
23
|
-
...props
|
|
24
|
-
} = _ref;
|
|
25
|
-
const getOpacity = (0, _react.useCallback)(pressed => {
|
|
26
|
-
if (disabled) {
|
|
27
|
-
return disabledOpacity;
|
|
28
|
-
} else {
|
|
29
|
-
if (pressed) return activeOpacity;else return 1;
|
|
30
|
-
}
|
|
31
|
-
}, [activeOpacity, disabled, disabledOpacity]);
|
|
32
|
-
const _style = (0, _react.useCallback)(_ref2 => {
|
|
33
|
-
let {
|
|
34
|
-
pressed
|
|
35
|
-
} = _ref2;
|
|
36
|
-
return [style, {
|
|
37
|
-
opacity: getOpacity(pressed)
|
|
38
|
-
}];
|
|
39
|
-
}, [getOpacity, style]);
|
|
40
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, _extends({
|
|
41
|
-
onPress: onPress,
|
|
42
|
-
onLongPress: onLongPress,
|
|
43
|
-
disabled: disabled,
|
|
44
|
-
delayLongPress: delayLongPress ? delayLongPress : 500,
|
|
45
|
-
hitSlop: hitSlop ? hitSlop : 8,
|
|
46
|
-
style: _style
|
|
47
|
-
}, props), children);
|
|
48
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SEED_DATA = void 0;
|
|
7
|
-
var _types = require("@draftbit/types");
|
|
8
|
-
const SEED_DATA_PROPS = {
|
|
9
|
-
stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins, _types.StylesPanelSections.Borders],
|
|
10
|
-
layout: {},
|
|
11
|
-
triggers: [_types.Triggers.OnPress, _types.Triggers.OnLongPress],
|
|
12
|
-
props: {
|
|
13
|
-
onPress: (0, _types.createActionProp)(),
|
|
14
|
-
onLongPress: (0, _types.createActionProp)(),
|
|
15
|
-
activeOpacity: (0, _types.createNumberProp)(),
|
|
16
|
-
disabledOpacity: (0, _types.createNumberProp)(),
|
|
17
|
-
delayLongPress: (0, _types.createNumberProp)(),
|
|
18
|
-
hitSlop: (0, _types.createNumberProp)()
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
const SEED_DATA = [{
|
|
22
|
-
name: "Touchable",
|
|
23
|
-
tag: "Touchable",
|
|
24
|
-
description: "An interactive view with no styles",
|
|
25
|
-
category: _types.COMPONENT_TYPES.deprecated,
|
|
26
|
-
...SEED_DATA_PROPS
|
|
27
|
-
}, {
|
|
28
|
-
name: "Pressable",
|
|
29
|
-
tag: "Pressable",
|
|
30
|
-
description: "An interactive view with no styles",
|
|
31
|
-
category: _types.COMPONENT_TYPES.button,
|
|
32
|
-
...SEED_DATA_PROPS
|
|
33
|
-
}];
|
|
34
|
-
exports.SEED_DATA = SEED_DATA;
|
|
@@ -1,40 +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, { useCallback } 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
|
-
onLongPress,
|
|
10
|
-
hitSlop,
|
|
11
|
-
delayLongPress,
|
|
12
|
-
activeOpacity,
|
|
13
|
-
disabledOpacity,
|
|
14
|
-
style,
|
|
15
|
-
...props
|
|
16
|
-
} = _ref;
|
|
17
|
-
const getOpacity = useCallback(pressed => {
|
|
18
|
-
if (disabled) {
|
|
19
|
-
return disabledOpacity;
|
|
20
|
-
} else {
|
|
21
|
-
if (pressed) return activeOpacity;else return 1;
|
|
22
|
-
}
|
|
23
|
-
}, [activeOpacity, disabled, disabledOpacity]);
|
|
24
|
-
const _style = useCallback(_ref2 => {
|
|
25
|
-
let {
|
|
26
|
-
pressed
|
|
27
|
-
} = _ref2;
|
|
28
|
-
return [style, {
|
|
29
|
-
opacity: getOpacity(pressed)
|
|
30
|
-
}];
|
|
31
|
-
}, [getOpacity, style]);
|
|
32
|
-
return /*#__PURE__*/React.createElement(NativePressable, _extends({
|
|
33
|
-
onPress: onPress,
|
|
34
|
-
onLongPress: onLongPress,
|
|
35
|
-
disabled: disabled,
|
|
36
|
-
delayLongPress: delayLongPress ? delayLongPress : 500,
|
|
37
|
-
hitSlop: hitSlop ? hitSlop : 8,
|
|
38
|
-
style: _style
|
|
39
|
-
}, props), children);
|
|
40
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createActionProp, Triggers, createNumberProp, StylesPanelSections } from "@draftbit/types";
|
|
2
|
-
const SEED_DATA_PROPS = {
|
|
3
|
-
stylesPanelSections: [StylesPanelSections.Size, StylesPanelSections.Margins, StylesPanelSections.Borders],
|
|
4
|
-
layout: {},
|
|
5
|
-
triggers: [Triggers.OnPress, Triggers.OnLongPress],
|
|
6
|
-
props: {
|
|
7
|
-
onPress: createActionProp(),
|
|
8
|
-
onLongPress: createActionProp(),
|
|
9
|
-
activeOpacity: createNumberProp(),
|
|
10
|
-
disabledOpacity: createNumberProp(),
|
|
11
|
-
delayLongPress: createNumberProp(),
|
|
12
|
-
hitSlop: createNumberProp()
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
export const SEED_DATA = [{
|
|
16
|
-
name: "Touchable",
|
|
17
|
-
tag: "Touchable",
|
|
18
|
-
description: "An interactive view with no styles",
|
|
19
|
-
category: COMPONENT_TYPES.deprecated,
|
|
20
|
-
...SEED_DATA_PROPS
|
|
21
|
-
}, {
|
|
22
|
-
name: "Pressable",
|
|
23
|
-
tag: "Pressable",
|
|
24
|
-
description: "An interactive view with no styles",
|
|
25
|
-
category: COMPONENT_TYPES.button,
|
|
26
|
-
...SEED_DATA_PROPS
|
|
27
|
-
}];
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { PressableProps, PressableStateCallbackType, StyleProp, 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
|
-
pressRetentionOffset?: number;
|
|
12
|
-
activeOpacity?: number;
|
|
13
|
-
disabledOpacity?: number;
|
|
14
|
-
} & PressableProps;
|
|
15
|
-
export declare type StyleType = (state: PressableStateCallbackType) => StyleProp<ViewStyle>;
|
|
16
|
-
export default function Pressable({ children, disabled, onPress, onLongPress, hitSlop, delayLongPress, activeOpacity, disabledOpacity, style, ...props }: Props): JSX.Element;
|
|
17
|
-
export {};
|
|
18
|
-
//# 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,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAEL,cAAc,EACd,0BAA0B,EAC1B,SAAS,EACT,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,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,cAAc,CAAC;AAEnB,oBAAY,SAAS,GAAG,CACtB,KAAK,EAAE,0BAA0B,KAC9B,SAAS,CAAC,SAAS,CAAC,CAAC;AAE1B,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,WAAW,EACX,OAAO,EACP,cAAc,EACd,aAAa,EACb,eAAe,EACf,KAAK,EACL,GAAG,KAAK,EACT,EAAE,KAAK,eA6BP"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
export declare const SEED_DATA: {
|
|
2
|
-
stylesPanelSections: string[];
|
|
3
|
-
layout: {};
|
|
4
|
-
triggers: string[];
|
|
5
|
-
props: {
|
|
6
|
-
onPress: {
|
|
7
|
-
label: string;
|
|
8
|
-
description: string;
|
|
9
|
-
editable: boolean;
|
|
10
|
-
required: boolean;
|
|
11
|
-
formType: string;
|
|
12
|
-
propType: string;
|
|
13
|
-
defaultValue: null;
|
|
14
|
-
group: string;
|
|
15
|
-
};
|
|
16
|
-
onLongPress: {
|
|
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
|
-
activeOpacity: {
|
|
27
|
-
label: string;
|
|
28
|
-
description: string;
|
|
29
|
-
formType: string;
|
|
30
|
-
propType: string;
|
|
31
|
-
group: string;
|
|
32
|
-
defaultValue: null;
|
|
33
|
-
editable: boolean;
|
|
34
|
-
required: boolean;
|
|
35
|
-
step: number;
|
|
36
|
-
};
|
|
37
|
-
disabledOpacity: {
|
|
38
|
-
label: string;
|
|
39
|
-
description: string;
|
|
40
|
-
formType: string;
|
|
41
|
-
propType: string;
|
|
42
|
-
group: string;
|
|
43
|
-
defaultValue: null;
|
|
44
|
-
editable: boolean;
|
|
45
|
-
required: boolean;
|
|
46
|
-
step: number;
|
|
47
|
-
};
|
|
48
|
-
delayLongPress: {
|
|
49
|
-
label: string;
|
|
50
|
-
description: string;
|
|
51
|
-
formType: string;
|
|
52
|
-
propType: string;
|
|
53
|
-
group: string;
|
|
54
|
-
defaultValue: null;
|
|
55
|
-
editable: boolean;
|
|
56
|
-
required: boolean;
|
|
57
|
-
step: number;
|
|
58
|
-
};
|
|
59
|
-
hitSlop: {
|
|
60
|
-
label: string;
|
|
61
|
-
description: string;
|
|
62
|
-
formType: string;
|
|
63
|
-
propType: string;
|
|
64
|
-
group: string;
|
|
65
|
-
defaultValue: null;
|
|
66
|
-
editable: boolean;
|
|
67
|
-
required: boolean;
|
|
68
|
-
step: number;
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
name: string;
|
|
72
|
-
tag: string;
|
|
73
|
-
description: string;
|
|
74
|
-
category: string;
|
|
75
|
-
}[];
|
|
76
|
-
//# sourceMappingURL=Pressable.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Pressable.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAerB,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from "react";
|
|
2
|
-
import { Pressable as NativePressable, } from "react-native";
|
|
3
|
-
export default function Pressable({ children, disabled, onPress, onLongPress, hitSlop, delayLongPress, activeOpacity, disabledOpacity, style, ...props }) {
|
|
4
|
-
const getOpacity = useCallback((pressed) => {
|
|
5
|
-
if (disabled) {
|
|
6
|
-
return disabledOpacity;
|
|
7
|
-
}
|
|
8
|
-
else {
|
|
9
|
-
if (pressed)
|
|
10
|
-
return activeOpacity;
|
|
11
|
-
else
|
|
12
|
-
return 1;
|
|
13
|
-
}
|
|
14
|
-
}, [activeOpacity, disabled, disabledOpacity]);
|
|
15
|
-
const _style = useCallback(({ pressed }) => [style, { opacity: getOpacity(pressed) }], [getOpacity, style]);
|
|
16
|
-
return (React.createElement(NativePressable, { onPress: onPress, onLongPress: onLongPress, disabled: disabled, delayLongPress: delayLongPress ? delayLongPress : 500, hitSlop: hitSlop ? hitSlop : 8, style: _style, ...props }, children));
|
|
17
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from "react";
|
|
2
|
-
import {
|
|
3
|
-
Pressable as NativePressable,
|
|
4
|
-
PressableProps,
|
|
5
|
-
PressableStateCallbackType,
|
|
6
|
-
StyleProp,
|
|
7
|
-
ViewStyle,
|
|
8
|
-
} from "react-native";
|
|
9
|
-
|
|
10
|
-
type Props = {
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
children: React.ReactNode;
|
|
13
|
-
style?: ViewStyle;
|
|
14
|
-
onPress?: () => void;
|
|
15
|
-
onLongPress?: () => void;
|
|
16
|
-
delayLongPress?: number;
|
|
17
|
-
hitSlop?: number;
|
|
18
|
-
pressRetentionOffset?: number;
|
|
19
|
-
activeOpacity?: number;
|
|
20
|
-
disabledOpacity?: number;
|
|
21
|
-
} & PressableProps;
|
|
22
|
-
|
|
23
|
-
export type StyleType = (
|
|
24
|
-
state: PressableStateCallbackType
|
|
25
|
-
) => StyleProp<ViewStyle>;
|
|
26
|
-
|
|
27
|
-
export default function Pressable({
|
|
28
|
-
children,
|
|
29
|
-
disabled,
|
|
30
|
-
onPress,
|
|
31
|
-
onLongPress,
|
|
32
|
-
hitSlop,
|
|
33
|
-
delayLongPress,
|
|
34
|
-
activeOpacity,
|
|
35
|
-
disabledOpacity,
|
|
36
|
-
style,
|
|
37
|
-
...props
|
|
38
|
-
}: Props) {
|
|
39
|
-
const getOpacity = useCallback(
|
|
40
|
-
(pressed: boolean) => {
|
|
41
|
-
if (disabled) {
|
|
42
|
-
return disabledOpacity;
|
|
43
|
-
} else {
|
|
44
|
-
if (pressed) return activeOpacity;
|
|
45
|
-
else return 1;
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
[activeOpacity, disabled, disabledOpacity]
|
|
49
|
-
);
|
|
50
|
-
const _style = useCallback<StyleType>(
|
|
51
|
-
({ pressed }) => [style as ViewStyle, { opacity: getOpacity(pressed) }],
|
|
52
|
-
[getOpacity, style]
|
|
53
|
-
);
|
|
54
|
-
return (
|
|
55
|
-
<NativePressable
|
|
56
|
-
onPress={onPress}
|
|
57
|
-
onLongPress={onLongPress}
|
|
58
|
-
disabled={disabled}
|
|
59
|
-
delayLongPress={delayLongPress ? delayLongPress : 500}
|
|
60
|
-
hitSlop={hitSlop ? hitSlop : 8}
|
|
61
|
-
style={_style}
|
|
62
|
-
{...props}
|
|
63
|
-
>
|
|
64
|
-
{children}
|
|
65
|
-
</NativePressable>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createActionProp, Triggers, createNumberProp, StylesPanelSections, } from "@draftbit/types";
|
|
2
|
-
const SEED_DATA_PROPS = {
|
|
3
|
-
stylesPanelSections: [
|
|
4
|
-
StylesPanelSections.Size,
|
|
5
|
-
StylesPanelSections.Margins,
|
|
6
|
-
StylesPanelSections.Borders,
|
|
7
|
-
],
|
|
8
|
-
layout: {},
|
|
9
|
-
triggers: [Triggers.OnPress, Triggers.OnLongPress],
|
|
10
|
-
props: {
|
|
11
|
-
onPress: createActionProp(),
|
|
12
|
-
onLongPress: createActionProp(),
|
|
13
|
-
activeOpacity: createNumberProp(),
|
|
14
|
-
disabledOpacity: createNumberProp(),
|
|
15
|
-
delayLongPress: createNumberProp(),
|
|
16
|
-
hitSlop: createNumberProp(),
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
export const SEED_DATA = [
|
|
20
|
-
{
|
|
21
|
-
name: "Touchable",
|
|
22
|
-
tag: "Touchable",
|
|
23
|
-
description: "An interactive view with no styles",
|
|
24
|
-
category: COMPONENT_TYPES.deprecated,
|
|
25
|
-
...SEED_DATA_PROPS,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: "Pressable",
|
|
29
|
-
tag: "Pressable",
|
|
30
|
-
description: "An interactive view with no styles",
|
|
31
|
-
category: COMPONENT_TYPES.button,
|
|
32
|
-
...SEED_DATA_PROPS,
|
|
33
|
-
},
|
|
34
|
-
];
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
COMPONENT_TYPES,
|
|
3
|
-
createActionProp,
|
|
4
|
-
Triggers,
|
|
5
|
-
createNumberProp,
|
|
6
|
-
StylesPanelSections,
|
|
7
|
-
} from "@draftbit/types";
|
|
8
|
-
|
|
9
|
-
const SEED_DATA_PROPS = {
|
|
10
|
-
stylesPanelSections: [
|
|
11
|
-
StylesPanelSections.Size,
|
|
12
|
-
StylesPanelSections.Margins,
|
|
13
|
-
StylesPanelSections.Borders,
|
|
14
|
-
],
|
|
15
|
-
layout: {},
|
|
16
|
-
triggers: [Triggers.OnPress, Triggers.OnLongPress],
|
|
17
|
-
props: {
|
|
18
|
-
onPress: createActionProp(),
|
|
19
|
-
onLongPress: createActionProp(),
|
|
20
|
-
activeOpacity: createNumberProp(),
|
|
21
|
-
disabledOpacity: createNumberProp(),
|
|
22
|
-
delayLongPress: createNumberProp(),
|
|
23
|
-
hitSlop: createNumberProp(),
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const SEED_DATA = [
|
|
28
|
-
{
|
|
29
|
-
name: "Touchable",
|
|
30
|
-
tag: "Touchable",
|
|
31
|
-
description: "An interactive view with no styles",
|
|
32
|
-
category: COMPONENT_TYPES.deprecated,
|
|
33
|
-
...SEED_DATA_PROPS,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: "Pressable",
|
|
37
|
-
tag: "Pressable",
|
|
38
|
-
description: "An interactive view with no styles",
|
|
39
|
-
category: COMPONENT_TYPES.button,
|
|
40
|
-
...SEED_DATA_PROPS,
|
|
41
|
-
},
|
|
42
|
-
];
|