@evlop/native-components 1.0.253 → 1.0.255
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/README.md +456 -0
- package/dist/cjs/src/Actionable.d.ts +1 -1
- package/dist/cjs/src/Actionable.d.ts.map +1 -1
- package/dist/cjs/src/Actionable.js +2 -163
- package/dist/cjs/src/Actionable.js.map +1 -1
- package/dist/cjs/src/Button.d.ts +3 -0
- package/dist/cjs/src/Button.d.ts.map +1 -1
- package/dist/cjs/src/Button.js +35 -26
- package/dist/cjs/src/Button.js.map +1 -1
- package/dist/cjs/src/hooks/index.d.ts +2 -0
- package/dist/cjs/src/hooks/index.d.ts.map +1 -0
- package/dist/cjs/src/hooks/index.js +18 -0
- package/dist/cjs/src/hooks/index.js.map +1 -0
- package/dist/cjs/src/hooks/useAnimatedPress.d.ts +56 -0
- package/dist/cjs/src/hooks/useAnimatedPress.d.ts.map +1 -0
- package/dist/cjs/src/hooks/useAnimatedPress.js +168 -0
- package/dist/cjs/src/hooks/useAnimatedPress.js.map +1 -0
- package/dist/cjs/src/utils/index.d.ts +1 -0
- package/dist/cjs/src/utils/index.d.ts.map +1 -1
- package/dist/cjs/src/utils/index.js +1 -0
- package/dist/cjs/src/utils/index.js.map +1 -1
- package/dist/cjs/src/utils/pushNotification.d.ts +13 -0
- package/dist/cjs/src/utils/pushNotification.d.ts.map +1 -0
- package/dist/cjs/src/utils/pushNotification.js +21 -0
- package/dist/cjs/src/utils/pushNotification.js.map +1 -0
- package/dist/cjs/src/utils/pushNotification.native.d.ts +19 -0
- package/dist/cjs/src/utils/pushNotification.native.d.ts.map +1 -0
- package/dist/cjs/src/utils/pushNotification.native.js +113 -0
- package/dist/cjs/src/utils/pushNotification.native.js.map +1 -0
- package/dist/types/main.ai.d.ts +3 -1
- package/dist/types/src/Actionable.d.ts +1 -1
- package/dist/types/src/Actionable.d.ts.map +1 -1
- package/dist/types/src/Button.d.ts +3 -0
- package/dist/types/src/Button.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +2 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useAnimatedPress.d.ts +56 -0
- package/dist/types/src/hooks/useAnimatedPress.d.ts.map +1 -0
- package/dist/types/src/utils/index.d.ts +1 -0
- package/dist/types/src/utils/index.d.ts.map +1 -1
- package/dist/types/src/utils/pushNotification.d.ts +13 -0
- package/dist/types/src/utils/pushNotification.d.ts.map +1 -0
- package/dist/types/src/utils/pushNotification.native.d.ts +19 -0
- package/dist/types/src/utils/pushNotification.native.d.ts.map +1 -0
- package/package.json +3 -1
package/dist/cjs/src/Button.js
CHANGED
|
@@ -24,6 +24,7 @@ const styled_system_1 = require("styled-system");
|
|
|
24
24
|
const Flexbox_1 = require("./Flexbox");
|
|
25
25
|
const Text_1 = require("./Text");
|
|
26
26
|
const Icon_1 = require("./Icon");
|
|
27
|
+
const useAnimatedPress_1 = require("./hooks/useAnimatedPress");
|
|
27
28
|
const buttonVariant = ({ variant, color, theme }) => {
|
|
28
29
|
var _a, _b;
|
|
29
30
|
const _color = color ? ((_a = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _a === void 0 ? void 0 : _a[color]) || color : ((_b = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _b === void 0 ? void 0 : _b.primary) || '#000';
|
|
@@ -64,22 +65,28 @@ const sizeVariant = (0, styled_system_1.variant)({
|
|
|
64
65
|
prop: 'size',
|
|
65
66
|
variants: {
|
|
66
67
|
sm: {
|
|
67
|
-
|
|
68
|
+
paddingVertical: 6,
|
|
69
|
+
paddingHorizontal: 14,
|
|
68
70
|
},
|
|
69
71
|
md: {
|
|
70
|
-
|
|
72
|
+
paddingVertical: 10,
|
|
73
|
+
paddingHorizontal: 20,
|
|
71
74
|
},
|
|
72
75
|
lg: {
|
|
73
|
-
|
|
76
|
+
paddingVertical: 14,
|
|
77
|
+
paddingHorizontal: 28,
|
|
74
78
|
},
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
xl: {
|
|
80
|
+
paddingVertical: 18,
|
|
81
|
+
paddingHorizontal: 36,
|
|
77
82
|
},
|
|
78
83
|
'2xl': {
|
|
79
|
-
|
|
84
|
+
paddingVertical: 22,
|
|
85
|
+
paddingHorizontal: 44,
|
|
80
86
|
},
|
|
81
87
|
},
|
|
82
88
|
});
|
|
89
|
+
const AnimatedPressable = react_native_1.Animated.createAnimatedComponent(react_native_1.Pressable);
|
|
83
90
|
const StyledActivityIndicator = (0, native_1.default)(react_native_1.ActivityIndicator).attrs(({ color, theme }) => {
|
|
84
91
|
var _a;
|
|
85
92
|
return ({
|
|
@@ -97,46 +104,48 @@ const StyledButtonView = (0, native_1.default)(react_native_1.View)({
|
|
|
97
104
|
opacity: props.disabled ? 0.5 : 1
|
|
98
105
|
}));
|
|
99
106
|
const fontSizes = {
|
|
100
|
-
sm:
|
|
101
|
-
md:
|
|
102
|
-
lg:
|
|
103
|
-
xl:
|
|
104
|
-
'2xl':
|
|
107
|
+
sm: 13,
|
|
108
|
+
md: 15,
|
|
109
|
+
lg: 17,
|
|
110
|
+
xl: 19,
|
|
111
|
+
'2xl': 22,
|
|
105
112
|
};
|
|
106
113
|
const fontWeights = {
|
|
107
|
-
sm: '
|
|
108
|
-
md: '
|
|
109
|
-
lg: '
|
|
110
|
-
xl: '
|
|
114
|
+
sm: 'Medium',
|
|
115
|
+
md: 'Medium',
|
|
116
|
+
lg: 'Semibold',
|
|
117
|
+
xl: 'Semibold',
|
|
111
118
|
'2xl': 'Bold',
|
|
112
119
|
};
|
|
113
120
|
const iconSizes = {
|
|
114
121
|
sm: 16,
|
|
115
|
-
md:
|
|
116
|
-
lg:
|
|
117
|
-
xl:
|
|
118
|
-
'2xl':
|
|
122
|
+
md: 18,
|
|
123
|
+
lg: 20,
|
|
124
|
+
xl: 24,
|
|
125
|
+
'2xl': 28,
|
|
119
126
|
};
|
|
120
127
|
const gapBetweenIconAndText = {
|
|
121
|
-
sm:
|
|
128
|
+
sm: 6,
|
|
122
129
|
md: 8,
|
|
123
|
-
lg:
|
|
124
|
-
xl:
|
|
125
|
-
'2xl':
|
|
130
|
+
lg: 10,
|
|
131
|
+
xl: 12,
|
|
132
|
+
'2xl': 14,
|
|
126
133
|
};
|
|
127
134
|
const BaseButton = (_a) => {
|
|
128
135
|
var { variant = 'filled', size = 'md', loading = false, disabled = false, color = 'primary', textColor, label, textStyle, action: __action,
|
|
129
136
|
// @ts-ignore
|
|
130
|
-
icon, iconPosition = 'left', fontWeight, fontSize } = _a, props = __rest(_a, ["variant", "size", "loading", "disabled", "color", "textColor", "label", "textStyle", "action", "icon", "iconPosition", "fontWeight", "fontSize"]);
|
|
137
|
+
icon, iconPosition = 'left', iconSize, pressEffect = 'none', fontWeight, fontSize } = _a, props = __rest(_a, ["variant", "size", "loading", "disabled", "color", "textColor", "label", "textStyle", "action", "icon", "iconPosition", "iconSize", "pressEffect", "fontWeight", "fontSize"]);
|
|
131
138
|
const [isProcessing, actionHandeller] = (0, commons_1.useAsyncAction)(__action);
|
|
139
|
+
const { handlePressIn, handlePressOut, animatedStyle } = (0, useAnimatedPress_1.useAnimatedPress)(pressEffect);
|
|
132
140
|
const textColorToUse = textColor || (variant === 'filled' ? 'white' : color);
|
|
133
141
|
const isDisabled = disabled || isProcessing;
|
|
134
142
|
const isLoading = loading || isProcessing;
|
|
135
|
-
|
|
143
|
+
const PressableComponent = pressEffect === 'none' ? react_native_1.Pressable : AnimatedPressable;
|
|
144
|
+
return (react_1.default.createElement(PressableComponent, { onPress: actionHandeller, disabled: isDisabled, onPressIn: handlePressIn, onPressOut: handlePressOut, style: animatedStyle },
|
|
136
145
|
react_1.default.createElement(StyledButtonView, Object.assign({ disabled: isDisabled, variant: variant, size: size, color: color }, props),
|
|
137
146
|
isLoading && (react_1.default.createElement(StyledActivityIndicator, { color: textColorToUse })),
|
|
138
147
|
react_1.default.createElement(Flexbox_1.BaseFlexbox, { flexDirection: iconPosition === 'right' ? 'row-reverse' : 'row', alignItems: "center", justifyContent: "center", gap: gapBetweenIconAndText[size], opacity: isLoading ? 0 : 1 },
|
|
139
|
-
icon && react_1.default.createElement(Icon_1.BaseIcon, { icon: icon, size: iconSizes[size], color: textColorToUse }),
|
|
148
|
+
icon && react_1.default.createElement(Icon_1.BaseIcon, { icon: icon, size: iconSize || iconSizes[size], color: textColorToUse }),
|
|
140
149
|
react_1.default.createElement(Text_1.BaseText, { color: textColorToUse, fontWeight: fontWeight || fontWeights[size], fontSize: fontSize || fontSizes[size], style: textStyle }, label)))));
|
|
141
150
|
};
|
|
142
151
|
exports.BaseButton = BaseButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/Button.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4CAAoG;AACpG,uCAA0C;AAC1C,kDAA0B;AAC1B,+
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/Button.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4CAAoG;AACpG,uCAA0C;AAC1C,kDAA0B;AAC1B,+CAAkG;AAClG,sEAA8C;AAC9C,iDAAwL;AACxL,uCAAwC;AACxC,iCAAkC;AAClC,iCAAkC;AAClC,+DAAwE;AA0BxE,MAAM,aAAa,GAAG,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAsB,EAAE,EAAE;;IACtE,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,0CAAG,KAAK,CAAC,KAAI,KAAK,CAAC,CAAC,CAAC,CAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,0CAAE,OAAO,KAAI,MAAM,CAAC;IAE1F,QAAQ,OAAO,EAAE;QACf,KAAK,QAAQ;YACX,OAAO;gBACL,eAAe,EAAE,MAAM;gBACvB,WAAW,EAAE,CAAC;aACf,CAAC;QACJ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AC,uBAAuB,IAAC,KAAK,EAAE,cAAc,GAAG,CAAC;YACjE,8BAAC,qBAAW,IACV,aAAa,EAAE,YAAY,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,EAC/D,UAAU,EAAC,QAAQ,EACnB,cAAc,EAAC,QAAQ,EACvB,GAAG,EAAE,qBAAqB,CAAC,IAAI,CAAQ,EACvC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAEzB,IAAI,IAAI,8BAAC,eAAQ,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,cAAc,GAAI;gBAC3F,8BAAC,eAAQ,IACP,KAAK,EAAE,cAAqB,EAC5B,UAAU,EAAE,UAAU,IAAI,WAAW,CAAC,IAAI,CAAC,EAC3C,QAAQ,EAAE,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAQ,EAC5C,KAAK,EAAE,SAAS,IAEf,KAAK,CACG,CACC,CACG,CACA,CACtB,CAAC;AACJ,CAAC,CAAC;AAjEW,QAAA,UAAU,cAiErB;AAEF,MAAM,kBAAkB,GAAG,IAAA,sBAAY,EAAC;IACpC,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,EAAE;IAChB,oBAAoB,EAAE,EAAE;CAC3B,CAAC,CAAC,kBAAU,CAAC,CAAC;AAEf,kBAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useAnimatedPress"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Animated } from 'react-native';
|
|
2
|
+
export declare type EffectType = 'none' | 'shrink' | 'dim' | 'shrink-dim' | 'push-down' | 'gentle-shrink' | 'tilt' | 'bounce' | 'squeeze' | 'pop' | 'wobble';
|
|
3
|
+
export declare const useAnimatedPress: (effect: EffectType) => {
|
|
4
|
+
handlePressIn?: undefined;
|
|
5
|
+
handlePressOut?: undefined;
|
|
6
|
+
animatedStyle?: undefined;
|
|
7
|
+
} | {
|
|
8
|
+
handlePressIn: () => void;
|
|
9
|
+
handlePressOut: () => void;
|
|
10
|
+
animatedStyle: {
|
|
11
|
+
opacity: Animated.AnimatedInterpolation<string | number>;
|
|
12
|
+
transform?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
transform: {
|
|
15
|
+
scale: Animated.AnimatedInterpolation<string | number>;
|
|
16
|
+
}[];
|
|
17
|
+
opacity: Animated.AnimatedInterpolation<string | number>;
|
|
18
|
+
} | {
|
|
19
|
+
transform: ({
|
|
20
|
+
scale: Animated.AnimatedInterpolation<string | number>;
|
|
21
|
+
translateY?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
translateY: Animated.AnimatedInterpolation<string | number>;
|
|
24
|
+
scale?: undefined;
|
|
25
|
+
})[];
|
|
26
|
+
opacity?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
transform: ({
|
|
29
|
+
scale: Animated.AnimatedInterpolation<string | number>;
|
|
30
|
+
rotateZ?: undefined;
|
|
31
|
+
perspective?: undefined;
|
|
32
|
+
} | {
|
|
33
|
+
rotateZ: Animated.AnimatedInterpolation<string | number>;
|
|
34
|
+
scale?: undefined;
|
|
35
|
+
perspective?: undefined;
|
|
36
|
+
} | {
|
|
37
|
+
perspective: Animated.AnimatedInterpolation<string | number>;
|
|
38
|
+
scale?: undefined;
|
|
39
|
+
rotateZ?: undefined;
|
|
40
|
+
})[];
|
|
41
|
+
opacity?: undefined;
|
|
42
|
+
} | {
|
|
43
|
+
transform: ({
|
|
44
|
+
scaleX: Animated.AnimatedInterpolation<string | number>;
|
|
45
|
+
scaleY?: undefined;
|
|
46
|
+
} | {
|
|
47
|
+
scaleY: Animated.AnimatedInterpolation<string | number>;
|
|
48
|
+
scaleX?: undefined;
|
|
49
|
+
})[];
|
|
50
|
+
opacity?: undefined;
|
|
51
|
+
} | {
|
|
52
|
+
opacity?: undefined;
|
|
53
|
+
transform?: undefined;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=useAnimatedPress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAnimatedPress.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAnimatedPress.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,oBAAY,UAAU,GAChB,MAAM,GACN,QAAQ,GACR,KAAK,GACL,YAAY,GACZ,WAAW,GACX,eAAe,GACf,MAAM,GACN,QAAQ,GACR,SAAS,GACT,KAAK,GACL,QAAQ,CAAC;AAEf,eAAO,MAAM,gBAAgB,WAAY,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqKlD,CAAC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAnimatedPress = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const useAnimatedPress = (effect) => {
|
|
7
|
+
return (0, react_1.useMemo)(() => {
|
|
8
|
+
if (effect === 'none') {
|
|
9
|
+
return {};
|
|
10
|
+
}
|
|
11
|
+
const animatedValue = new react_native_1.Animated.Value(1);
|
|
12
|
+
const handlePressIn = () => {
|
|
13
|
+
react_native_1.Animated.spring(animatedValue, {
|
|
14
|
+
toValue: 0,
|
|
15
|
+
useNativeDriver: true,
|
|
16
|
+
speed: 50,
|
|
17
|
+
bounciness: 4,
|
|
18
|
+
}).start();
|
|
19
|
+
};
|
|
20
|
+
const handlePressOut = () => {
|
|
21
|
+
react_native_1.Animated.spring(animatedValue, {
|
|
22
|
+
toValue: 1,
|
|
23
|
+
useNativeDriver: true,
|
|
24
|
+
speed: 20,
|
|
25
|
+
bounciness: 6,
|
|
26
|
+
}).start();
|
|
27
|
+
};
|
|
28
|
+
const getAnimatedStyle = () => {
|
|
29
|
+
switch (effect) {
|
|
30
|
+
case 'shrink':
|
|
31
|
+
return {
|
|
32
|
+
transform: [{
|
|
33
|
+
scale: animatedValue.interpolate({
|
|
34
|
+
inputRange: [0, 1],
|
|
35
|
+
outputRange: [0.95, 1],
|
|
36
|
+
}),
|
|
37
|
+
}],
|
|
38
|
+
};
|
|
39
|
+
case 'dim':
|
|
40
|
+
return {
|
|
41
|
+
opacity: animatedValue.interpolate({
|
|
42
|
+
inputRange: [0, 1],
|
|
43
|
+
outputRange: [0.7, 1],
|
|
44
|
+
}),
|
|
45
|
+
};
|
|
46
|
+
case 'shrink-dim':
|
|
47
|
+
return {
|
|
48
|
+
transform: [{
|
|
49
|
+
scale: animatedValue.interpolate({
|
|
50
|
+
inputRange: [0, 1],
|
|
51
|
+
outputRange: [0.95, 1],
|
|
52
|
+
}),
|
|
53
|
+
}],
|
|
54
|
+
opacity: animatedValue.interpolate({
|
|
55
|
+
inputRange: [0, 1],
|
|
56
|
+
outputRange: [0.7, 1],
|
|
57
|
+
}),
|
|
58
|
+
};
|
|
59
|
+
case 'push-down':
|
|
60
|
+
return {
|
|
61
|
+
transform: [
|
|
62
|
+
{
|
|
63
|
+
scale: animatedValue.interpolate({
|
|
64
|
+
inputRange: [0, 1],
|
|
65
|
+
outputRange: [0.97, 1],
|
|
66
|
+
}),
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
translateY: animatedValue.interpolate({
|
|
70
|
+
inputRange: [0, 1],
|
|
71
|
+
outputRange: [2, 0],
|
|
72
|
+
}),
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
};
|
|
76
|
+
case 'gentle-shrink':
|
|
77
|
+
return {
|
|
78
|
+
transform: [{
|
|
79
|
+
scale: animatedValue.interpolate({
|
|
80
|
+
inputRange: [0, 1],
|
|
81
|
+
outputRange: [0.98, 1],
|
|
82
|
+
}),
|
|
83
|
+
}],
|
|
84
|
+
};
|
|
85
|
+
case 'tilt':
|
|
86
|
+
return {
|
|
87
|
+
transform: [
|
|
88
|
+
{
|
|
89
|
+
scale: animatedValue.interpolate({
|
|
90
|
+
inputRange: [0, 1],
|
|
91
|
+
outputRange: [0.97, 1],
|
|
92
|
+
}),
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
rotateZ: animatedValue.interpolate({
|
|
96
|
+
inputRange: [0, 1],
|
|
97
|
+
outputRange: ['-2deg', '0deg'],
|
|
98
|
+
}),
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
perspective: animatedValue.interpolate({
|
|
102
|
+
inputRange: [0, 1],
|
|
103
|
+
outputRange: [800, 1000],
|
|
104
|
+
}),
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
};
|
|
108
|
+
case 'bounce':
|
|
109
|
+
return {
|
|
110
|
+
transform: [{
|
|
111
|
+
scale: animatedValue.interpolate({
|
|
112
|
+
inputRange: [0, 0.5, 1],
|
|
113
|
+
outputRange: [0.9, 0.95, 1],
|
|
114
|
+
}),
|
|
115
|
+
}],
|
|
116
|
+
};
|
|
117
|
+
case 'squeeze':
|
|
118
|
+
return {
|
|
119
|
+
transform: [
|
|
120
|
+
{
|
|
121
|
+
scaleX: animatedValue.interpolate({
|
|
122
|
+
inputRange: [0, 1],
|
|
123
|
+
outputRange: [0.92, 1],
|
|
124
|
+
}),
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
scaleY: animatedValue.interpolate({
|
|
128
|
+
inputRange: [0, 1],
|
|
129
|
+
outputRange: [1.04, 1],
|
|
130
|
+
}),
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
};
|
|
134
|
+
case 'pop':
|
|
135
|
+
return {
|
|
136
|
+
transform: [{
|
|
137
|
+
scale: animatedValue.interpolate({
|
|
138
|
+
inputRange: [0, 1],
|
|
139
|
+
outputRange: [1.05, 1],
|
|
140
|
+
}),
|
|
141
|
+
}],
|
|
142
|
+
};
|
|
143
|
+
case 'wobble':
|
|
144
|
+
return {
|
|
145
|
+
transform: [
|
|
146
|
+
{
|
|
147
|
+
scale: animatedValue.interpolate({
|
|
148
|
+
inputRange: [0, 1],
|
|
149
|
+
outputRange: [0.97, 1],
|
|
150
|
+
}),
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
rotateZ: animatedValue.interpolate({
|
|
154
|
+
inputRange: [0, 0.25, 0.5, 0.75, 1],
|
|
155
|
+
outputRange: ['0deg', '-1deg', '1deg', '-0.5deg', '0deg'],
|
|
156
|
+
}),
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
};
|
|
160
|
+
default:
|
|
161
|
+
return {};
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
return { handlePressIn, handlePressOut, animatedStyle: getAnimatedStyle() };
|
|
165
|
+
}, [effect]);
|
|
166
|
+
};
|
|
167
|
+
exports.useAnimatedPress = useAnimatedPress;
|
|
168
|
+
//# sourceMappingURL=useAnimatedPress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAnimatedPress.js","sourceRoot":"","sources":["../../../../src/hooks/useAnimatedPress.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAChC,+CAAwC;AAejC,MAAM,gBAAgB,GAAG,CAAC,MAAkB,EAAE,EAAE;IACnD,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE;QAChB,IAAI,MAAM,KAAK,MAAM,EAAE;YACnB,OAAO,EAAE,CAAC;SACb;QAED,MAAM,aAAa,GAAG,IAAI,uBAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAE5C,MAAM,aAAa,GAAG,GAAG,EAAE;YACvB,uBAAQ,CAAC,MAAM,CAAC,aAAa,EAAE;gBAC3B,OAAO,EAAE,CAAC;gBACV,eAAe,EAAE,IAAI;gBACrB,KAAK,EAAE,EAAE;gBACT,UAAU,EAAE,CAAC;aAChB,CAAC,CAAC,KAAK,EAAE,CAAC;QACf,CAAC,CAAC;QAEF,MAAM,cAAc,GAAG,GAAG,EAAE;YACxB,uBAAQ,CAAC,MAAM,CAAC,aAAa,EAAE;gBAC3B,OAAO,EAAE,CAAC;gBACV,eAAe,EAAE,IAAI;gBACrB,KAAK,EAAE,EAAE;gBACT,UAAU,EAAE,CAAC;aAChB,CAAC,CAAC,KAAK,EAAE,CAAC;QACf,CAAC,CAAC;QAEF,MAAM,gBAAgB,GAAG,GAAG,EAAE;YAC1B,QAAQ,MAAM,EAAE;gBACZ,KAAK,QAAQ;oBACT,OAAO;wBACH,S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"AAAA,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC"}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./haptic"), exports);
|
|
18
|
+
__exportStar(require("./pushNotification"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,qDAAmC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Action } from "@evlop/commons";
|
|
2
|
+
interface TriggerPushNotificationOptions {
|
|
3
|
+
id?: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
body?: string;
|
|
6
|
+
image?: string;
|
|
7
|
+
action?: Action;
|
|
8
|
+
sendAt?: Date;
|
|
9
|
+
}
|
|
10
|
+
export declare function triggerPushNotification({ id, title, body, image, action, sendAt }: TriggerPushNotificationOptions): Promise<void>;
|
|
11
|
+
export declare function cancelTriggerPushNotification(id: string): Promise<void>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=pushNotification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pushNotification.d.ts","sourceRoot":"","sources":["../../../../src/utils/pushNotification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,UAAU,8BAA8B;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,IAAI,CAAC;CACjB;AAED,wBAAsB,uBAAuB,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,8BAA8B,iBAAI;AAE5H,wBAAsB,6BAA6B,CAAC,EAAE,EAAE,MAAM,iBAAI"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.cancelTriggerPushNotification = exports.triggerPushNotification = void 0;
|
|
13
|
+
function triggerPushNotification({ id, title, body, image, action, sendAt }) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
15
|
+
}
|
|
16
|
+
exports.triggerPushNotification = triggerPushNotification;
|
|
17
|
+
function cancelTriggerPushNotification(id) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
19
|
+
}
|
|
20
|
+
exports.cancelTriggerPushNotification = cancelTriggerPushNotification;
|
|
21
|
+
//# sourceMappingURL=pushNotification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pushNotification.js","sourceRoot":"","sources":["../../../../src/utils/pushNotification.ts"],"names":[],"mappings":";;;;;;;;;;;;AAWA,SAAsB,uBAAuB,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAkC;0DAAG,CAAC;CAAA;AAA5H,0DAA4H;AAE5H,SAAsB,6BAA6B,CAAC,EAAU;0DAAG,CAAC;CAAA;AAAlE,sEAAkE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Action } from '@evlop/commons';
|
|
2
|
+
interface TriggerPushNotificationOptions {
|
|
3
|
+
id?: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
body?: string;
|
|
6
|
+
image?: string;
|
|
7
|
+
action?: Action;
|
|
8
|
+
sendAt?: Date;
|
|
9
|
+
}
|
|
10
|
+
export declare const triggerPushNotification: ({ id: notificationId, title: notificationTitle, body: notificationBody, image: notificationImageUrl, action, sendAt }: TriggerPushNotificationOptions) => Promise<void>;
|
|
11
|
+
interface CancelTriggerPushNotificationOptions {
|
|
12
|
+
id: string;
|
|
13
|
+
/**
|
|
14
|
+
* If true, cancel the scheduled notification. If false, cancel the displayed notification. (default: false) */
|
|
15
|
+
scheduled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const cancelTriggerPushNotification: ({ id, scheduled }: CancelTriggerPushNotificationOptions) => Promise<void>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=pushNotification.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pushNotification.native.d.ts","sourceRoot":"","sources":["../../../../src/utils/pushNotification.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAIxC,UAAU,8BAA8B;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,IAAI,CAAC;CACf;AAED,eAAO,MAAM,uBAAuB,0HAAiI,8BAA8B,kBAmElM,CAAA;AAED,UAAU,oCAAoC;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX;mHAC+G;IAC/G,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,6BAA6B,sBAA6B,oCAAoC,kBAO1G,CAAA"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.cancelTriggerPushNotification = exports.triggerPushNotification = void 0;
|
|
36
|
+
const react_native_1 = __importStar(require("@notifee/react-native"));
|
|
37
|
+
const react_native_2 = require("react-native");
|
|
38
|
+
const triggerPushNotification = ({ id: notificationId, title: notificationTitle, body: notificationBody, image: notificationImageUrl, action, sendAt }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
let notificationTimeStampDate = null;
|
|
40
|
+
let shouldSendInstantly = true;
|
|
41
|
+
if (sendAt) {
|
|
42
|
+
notificationTimeStampDate = sendAt instanceof Date ? sendAt : new Date(sendAt);
|
|
43
|
+
shouldSendInstantly = notificationTimeStampDate.getTime() <= Date.now();
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
// Request permissions (required for iOS)
|
|
47
|
+
react_native_2.Platform.OS == 'ios' && (yield react_native_1.default.requestPermission());
|
|
48
|
+
// Create a channel (required for Android)
|
|
49
|
+
const channelId = yield react_native_1.default.createChannel({
|
|
50
|
+
id: 'default',
|
|
51
|
+
name: 'Default Channel',
|
|
52
|
+
});
|
|
53
|
+
// /** @type {import('@notifee/react-native').Notification} */
|
|
54
|
+
const notification = {
|
|
55
|
+
id: notificationId,
|
|
56
|
+
title: notificationTitle,
|
|
57
|
+
body: notificationBody,
|
|
58
|
+
android: {
|
|
59
|
+
channelId,
|
|
60
|
+
pressAction: {
|
|
61
|
+
id: 'default',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
data: {},
|
|
65
|
+
};
|
|
66
|
+
if (notificationImageUrl) {
|
|
67
|
+
notification.android.style = {
|
|
68
|
+
type: react_native_1.AndroidStyle.BIGPICTURE,
|
|
69
|
+
picture: notificationImageUrl,
|
|
70
|
+
};
|
|
71
|
+
notification.ios = {
|
|
72
|
+
attachments: [{
|
|
73
|
+
url: notificationImageUrl,
|
|
74
|
+
}]
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (action) {
|
|
78
|
+
notification.data.action = typeof action === 'object' ? JSON.stringify(action) : action;
|
|
79
|
+
}
|
|
80
|
+
if (shouldSendInstantly) {
|
|
81
|
+
// Display notification immediately
|
|
82
|
+
yield react_native_1.default.displayNotification(notification);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// Schedule notification for future
|
|
86
|
+
const trigger = {
|
|
87
|
+
type: react_native_1.TriggerType.TIMESTAMP,
|
|
88
|
+
timestamp: notificationTimeStampDate.getTime(),
|
|
89
|
+
alarmManager: {
|
|
90
|
+
allowWhileIdle: true,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
yield react_native_1.default.createTriggerNotification(notification, trigger);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.error('error', error);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
exports.triggerPushNotification = triggerPushNotification;
|
|
101
|
+
const cancelTriggerPushNotification = ({ id, scheduled }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
102
|
+
try {
|
|
103
|
+
if (scheduled)
|
|
104
|
+
yield react_native_1.default.cancelTriggerNotification(id);
|
|
105
|
+
else
|
|
106
|
+
yield react_native_1.default.cancelDisplayedNotification(id);
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
console.error('error', error);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
exports.cancelTriggerPushNotification = cancelTriggerPushNotification;
|
|
113
|
+
//# sourceMappingURL=pushNotification.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pushNotification.native.js","sourceRoot":"","sources":["../../../../src/utils/pushNotification.native.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sEAAyH;AACzH,+CAAwC;AAWjC,MAAM,uBAAuB,GAAG,CAAO,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,EAAkC,EAAE,EAAE;IAErM,IAAI,yBAAyB,GAAS,IAAI,CAAC;IAC3C,IAAI,mBAAmB,GAAG,IAAI,CAAC;IAE/B,IAAI,MAAM,EAAE;QACV,yBAAyB,GAAG,MAAM,YAAY,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/E,mBAAmB,GAAG,yBAAyB,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;KACzE;IAED,IAAI;QACF,yCAAyC;QACzC,uBAAQ,CAAC,EAAE,IAAI,KAAK,KAAI,MAAM,sBAAO,CAAC,iBAAiB,EAAE,CAAA,CAAA;QAEzD,0CAA0C;QAC1C,MAAM,SAAS,GAAG,MAAM,sBAAO,CAAC,aAAa,CAAC;YAC5C,EAAE,EAAE,SAAS;YACb,IAAI,EAAE,iBAAiB;SACxB,CAAC,CAAC;QACH,8DAA8D;QAC9D,MAAM,YAAY,GAAwB;YACxC,EAAE,EAAE,cAAc;YAClB,KAAK,EAAE,iBAAiB;YACxB,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE;gBACP,SAAS;gBACT,WAAW,EAAE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C,EAAE,CAAC,CAAC;KACpD;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KAC/B;AACH,CAAC,CAAA,CAAA;AAPY,QAAA,6BAA6B,iCAOzC"}
|
package/dist/types/main.ai.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ type BaseIconProps = {
|
|
|
31
31
|
onPress?: any;
|
|
32
32
|
};
|
|
33
33
|
declare const BaseIcon: React$1.ComponentType<BaseIconProps>;
|
|
34
|
+
type EffectType = "none" | "shrink" | "dim" | "shrink-dim" | "push-down" | "gentle-shrink" | "tilt" | "bounce" | "squeeze" | "pop" | "wobble";
|
|
34
35
|
type ButtonSize = "sm" | "md" | "lg" | "xl" | "2xl";
|
|
35
36
|
interface BaseButtonProps extends ViewProps, FontWeightProps<Theme>, FontSizeProps<Theme>, LayoutProps<Theme>, SpaceProps<Theme>, BackgroundColorProps<Theme>, BorderProps<Theme> {
|
|
36
37
|
disabled?: boolean;
|
|
@@ -44,11 +45,12 @@ interface BaseButtonProps extends ViewProps, FontWeightProps<Theme>, FontSizePro
|
|
|
44
45
|
action?: Action;
|
|
45
46
|
icon?: IconIdentifier;
|
|
46
47
|
iconPosition?: "left" | "right";
|
|
48
|
+
iconSize?: number;
|
|
49
|
+
pressEffect?: EffectType;
|
|
47
50
|
}
|
|
48
51
|
declare const BaseButton: React$1.FC<BaseButtonProps>;
|
|
49
52
|
type HapticType = "impactLight" | "impactMedium" | "impactHeavy" | "rigid" | "soft" | "notificationSuccess" | "notificationWarning" | "notificationError";
|
|
50
53
|
export declare const triggerHapticFeedback: (_type: HapticType) => void;
|
|
51
|
-
type EffectType = "none" | "shrink" | "dim" | "shrink-dim" | "push-down" | "gentle-shrink" | "tilt" | "bounce" | "squeeze" | "pop" | "wobble";
|
|
52
54
|
interface BaseActionableProps extends PressableProps {
|
|
53
55
|
pressEffect?: EffectType;
|
|
54
56
|
hapticFeedback?: HapticType;
|