react-native-hold-menu-actions 0.1.6

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 (219) hide show
  1. package/LICENCE +21 -0
  2. package/README.md +38 -0
  3. package/lib/commonjs/components/backdrop/Backdrop.js +104 -0
  4. package/lib/commonjs/components/backdrop/Backdrop.js.map +1 -0
  5. package/lib/commonjs/components/backdrop/constants.js +14 -0
  6. package/lib/commonjs/components/backdrop/constants.js.map +1 -0
  7. package/lib/commonjs/components/backdrop/index.js +16 -0
  8. package/lib/commonjs/components/backdrop/index.js.map +1 -0
  9. package/lib/commonjs/components/backdrop/styles.js +17 -0
  10. package/lib/commonjs/components/backdrop/styles.js.map +1 -0
  11. package/lib/commonjs/components/flatList/FlatList.js +35 -0
  12. package/lib/commonjs/components/flatList/FlatList.js.map +1 -0
  13. package/lib/commonjs/components/flatList/index.js +16 -0
  14. package/lib/commonjs/components/flatList/index.js.map +1 -0
  15. package/lib/commonjs/components/holdItem/HoldItem.js +369 -0
  16. package/lib/commonjs/components/holdItem/HoldItem.js.map +1 -0
  17. package/lib/commonjs/components/holdItem/index.js +16 -0
  18. package/lib/commonjs/components/holdItem/index.js.map +1 -0
  19. package/lib/commonjs/components/holdItem/styles.js +22 -0
  20. package/lib/commonjs/components/holdItem/styles.js.map +1 -0
  21. package/lib/commonjs/components/holdItem/types.d.js +2 -0
  22. package/lib/commonjs/components/holdItem/types.d.js.map +1 -0
  23. package/lib/commonjs/components/icon/Icon.js +43 -0
  24. package/lib/commonjs/components/icon/Icon.js.map +1 -0
  25. package/lib/commonjs/components/icon/index.js +16 -0
  26. package/lib/commonjs/components/icon/index.js.map +1 -0
  27. package/lib/commonjs/components/menu/Menu.js +57 -0
  28. package/lib/commonjs/components/menu/Menu.js.map +1 -0
  29. package/lib/commonjs/components/menu/MenuItem.js +85 -0
  30. package/lib/commonjs/components/menu/MenuItem.js.map +1 -0
  31. package/lib/commonjs/components/menu/MenuItems.js +35 -0
  32. package/lib/commonjs/components/menu/MenuItems.js.map +1 -0
  33. package/lib/commonjs/components/menu/MenuList.js +121 -0
  34. package/lib/commonjs/components/menu/MenuList.js.map +1 -0
  35. package/lib/commonjs/components/menu/Separator.js +47 -0
  36. package/lib/commonjs/components/menu/Separator.js.map +1 -0
  37. package/lib/commonjs/components/menu/calculations.js +31 -0
  38. package/lib/commonjs/components/menu/calculations.js.map +1 -0
  39. package/lib/commonjs/components/menu/constants.js +21 -0
  40. package/lib/commonjs/components/menu/constants.js.map +1 -0
  41. package/lib/commonjs/components/menu/index.js +16 -0
  42. package/lib/commonjs/components/menu/index.js.map +1 -0
  43. package/lib/commonjs/components/menu/styles.js +77 -0
  44. package/lib/commonjs/components/menu/styles.js.map +1 -0
  45. package/lib/commonjs/components/menu/types.d.js +2 -0
  46. package/lib/commonjs/components/menu/types.d.js.map +1 -0
  47. package/lib/commonjs/components/provider/Provider.js +98 -0
  48. package/lib/commonjs/components/provider/Provider.js.map +1 -0
  49. package/lib/commonjs/components/provider/index.js +16 -0
  50. package/lib/commonjs/components/provider/index.js.map +1 -0
  51. package/lib/commonjs/components/provider/reducer.js +50 -0
  52. package/lib/commonjs/components/provider/reducer.js.map +1 -0
  53. package/lib/commonjs/components/provider/types.d.js +2 -0
  54. package/lib/commonjs/components/provider/types.d.js.map +1 -0
  55. package/lib/commonjs/constants.js +60 -0
  56. package/lib/commonjs/constants.js.map +1 -0
  57. package/lib/commonjs/context/index.js +14 -0
  58. package/lib/commonjs/context/index.js.map +1 -0
  59. package/lib/commonjs/context/internal.js +13 -0
  60. package/lib/commonjs/context/internal.js.map +1 -0
  61. package/lib/commonjs/hooks/index.js +24 -0
  62. package/lib/commonjs/hooks/index.js.map +1 -0
  63. package/lib/commonjs/hooks/useDeviceOrientation.js +38 -0
  64. package/lib/commonjs/hooks/useDeviceOrientation.js.map +1 -0
  65. package/lib/commonjs/hooks/useInternal.js +15 -0
  66. package/lib/commonjs/hooks/useInternal.js.map +1 -0
  67. package/lib/commonjs/index.js +40 -0
  68. package/lib/commonjs/index.js.map +1 -0
  69. package/lib/commonjs/styleGuide.js +39 -0
  70. package/lib/commonjs/styleGuide.js.map +1 -0
  71. package/lib/commonjs/utils/calculations.js +73 -0
  72. package/lib/commonjs/utils/calculations.js.map +1 -0
  73. package/lib/commonjs/utils/validations.js +43 -0
  74. package/lib/commonjs/utils/validations.js.map +1 -0
  75. package/lib/module/components/backdrop/Backdrop.js +83 -0
  76. package/lib/module/components/backdrop/Backdrop.js.map +1 -0
  77. package/lib/module/components/backdrop/constants.js +4 -0
  78. package/lib/module/components/backdrop/constants.js.map +1 -0
  79. package/lib/module/components/backdrop/index.js +2 -0
  80. package/lib/module/components/backdrop/index.js.map +1 -0
  81. package/lib/module/components/backdrop/styles.js +7 -0
  82. package/lib/module/components/backdrop/styles.js.map +1 -0
  83. package/lib/module/components/flatList/FlatList.js +17 -0
  84. package/lib/module/components/flatList/FlatList.js.map +1 -0
  85. package/lib/module/components/flatList/index.js +2 -0
  86. package/lib/module/components/flatList/index.js.map +1 -0
  87. package/lib/module/components/holdItem/HoldItem.js +344 -0
  88. package/lib/module/components/holdItem/HoldItem.js.map +1 -0
  89. package/lib/module/components/holdItem/index.js +2 -0
  90. package/lib/module/components/holdItem/index.js.map +1 -0
  91. package/lib/module/components/holdItem/styles.js +12 -0
  92. package/lib/module/components/holdItem/styles.js.map +1 -0
  93. package/lib/module/components/holdItem/types.d.js +2 -0
  94. package/lib/module/components/holdItem/types.d.js.map +1 -0
  95. package/lib/module/components/icon/Icon.js +26 -0
  96. package/lib/module/components/icon/Icon.js.map +1 -0
  97. package/lib/module/components/icon/index.js +2 -0
  98. package/lib/module/components/icon/index.js.map +1 -0
  99. package/lib/module/components/menu/Menu.js +37 -0
  100. package/lib/module/components/menu/Menu.js.map +1 -0
  101. package/lib/module/components/menu/MenuItem.js +59 -0
  102. package/lib/module/components/menu/MenuItem.js.map +1 -0
  103. package/lib/module/components/menu/MenuItems.js +19 -0
  104. package/lib/module/components/menu/MenuItems.js.map +1 -0
  105. package/lib/module/components/menu/MenuList.js +93 -0
  106. package/lib/module/components/menu/MenuList.js.map +1 -0
  107. package/lib/module/components/menu/Separator.js +29 -0
  108. package/lib/module/components/menu/Separator.js.map +1 -0
  109. package/lib/module/components/menu/calculations.js +17 -0
  110. package/lib/module/components/menu/calculations.js.map +1 -0
  111. package/lib/module/components/menu/constants.js +8 -0
  112. package/lib/module/components/menu/constants.js.map +1 -0
  113. package/lib/module/components/menu/index.js +2 -0
  114. package/lib/module/components/menu/index.js.map +1 -0
  115. package/lib/module/components/menu/styles.js +63 -0
  116. package/lib/module/components/menu/styles.js.map +1 -0
  117. package/lib/module/components/menu/types.d.js +2 -0
  118. package/lib/module/components/menu/types.d.js.map +1 -0
  119. package/lib/module/components/provider/Provider.js +75 -0
  120. package/lib/module/components/provider/Provider.js.map +1 -0
  121. package/lib/module/components/provider/index.js +2 -0
  122. package/lib/module/components/provider/index.js.map +1 -0
  123. package/lib/module/components/provider/reducer.js +38 -0
  124. package/lib/module/components/provider/reducer.js.map +1 -0
  125. package/lib/module/components/provider/types.d.js +2 -0
  126. package/lib/module/components/provider/types.d.js.map +1 -0
  127. package/lib/module/constants.js +37 -0
  128. package/lib/module/constants.js.map +1 -0
  129. package/lib/module/context/index.js +2 -0
  130. package/lib/module/context/index.js.map +1 -0
  131. package/lib/module/context/internal.js +4 -0
  132. package/lib/module/context/internal.js.map +1 -0
  133. package/lib/module/hooks/index.js +3 -0
  134. package/lib/module/hooks/index.js.map +1 -0
  135. package/lib/module/hooks/useDeviceOrientation.js +27 -0
  136. package/lib/module/hooks/useDeviceOrientation.js.map +1 -0
  137. package/lib/module/hooks/useInternal.js +4 -0
  138. package/lib/module/hooks/useInternal.js.map +1 -0
  139. package/lib/module/index.js +5 -0
  140. package/lib/module/index.js.map +1 -0
  141. package/lib/module/styleGuide.js +30 -0
  142. package/lib/module/styleGuide.js.map +1 -0
  143. package/lib/module/utils/calculations.js +51 -0
  144. package/lib/module/utils/calculations.js.map +1 -0
  145. package/lib/module/utils/validations.js +38 -0
  146. package/lib/module/utils/validations.js.map +1 -0
  147. package/lib/typescript/components/backdrop/Backdrop.d.ts +3 -0
  148. package/lib/typescript/components/backdrop/constants.d.ts +2 -0
  149. package/lib/typescript/components/backdrop/index.d.ts +1 -0
  150. package/lib/typescript/components/backdrop/styles.d.ts +10 -0
  151. package/lib/typescript/components/flatList/FlatList.d.ts +5 -0
  152. package/lib/typescript/components/flatList/index.d.ts +2 -0
  153. package/lib/typescript/components/holdItem/HoldItem.d.ts +4 -0
  154. package/lib/typescript/components/holdItem/index.d.ts +2 -0
  155. package/lib/typescript/components/holdItem/styles.d.ts +15 -0
  156. package/lib/typescript/components/holdItem/types.d.ts +131 -0
  157. package/lib/typescript/components/icon/Icon.d.ts +7 -0
  158. package/lib/typescript/components/icon/index.d.ts +1 -0
  159. package/lib/typescript/components/menu/Menu.d.ts +3 -0
  160. package/lib/typescript/components/menu/MenuItem.d.ts +8 -0
  161. package/lib/typescript/components/menu/MenuItems.d.ts +6 -0
  162. package/lib/typescript/components/menu/MenuList.d.ts +3 -0
  163. package/lib/typescript/components/menu/Separator.d.ts +3 -0
  164. package/lib/typescript/components/menu/calculations.d.ts +4 -0
  165. package/lib/typescript/components/menu/constants.d.ts +7 -0
  166. package/lib/typescript/components/menu/index.d.ts +1 -0
  167. package/lib/typescript/components/menu/styles.d.ts +59 -0
  168. package/lib/typescript/components/menu/types.d.ts +28 -0
  169. package/lib/typescript/components/provider/Provider.d.ts +10 -0
  170. package/lib/typescript/components/provider/index.d.ts +2 -0
  171. package/lib/typescript/components/provider/reducer.d.ts +20 -0
  172. package/lib/typescript/components/provider/types.d.ts +33 -0
  173. package/lib/typescript/constants.d.ts +29 -0
  174. package/lib/typescript/context/index.d.ts +1 -0
  175. package/lib/typescript/context/internal.d.ts +16 -0
  176. package/lib/typescript/hooks/index.d.ts +2 -0
  177. package/lib/typescript/hooks/useDeviceOrientation.d.ts +3 -0
  178. package/lib/typescript/hooks/useInternal.d.ts +1 -0
  179. package/lib/typescript/index.d.ts +4 -0
  180. package/lib/typescript/styleGuide.d.ts +28 -0
  181. package/lib/typescript/utils/calculations.d.ts +14 -0
  182. package/lib/typescript/utils/validations.d.ts +3 -0
  183. package/package.json +106 -0
  184. package/src/components/backdrop/Backdrop.tsx +138 -0
  185. package/src/components/backdrop/constants.ts +8 -0
  186. package/src/components/backdrop/index.ts +1 -0
  187. package/src/components/backdrop/styles.ts +8 -0
  188. package/src/components/flatList/FlatList.tsx +23 -0
  189. package/src/components/flatList/index.ts +2 -0
  190. package/src/components/holdItem/HoldItem.tsx +449 -0
  191. package/src/components/holdItem/index.ts +2 -0
  192. package/src/components/holdItem/styles.ts +11 -0
  193. package/src/components/holdItem/types.d.ts +131 -0
  194. package/src/components/icon/Icon.tsx +33 -0
  195. package/src/components/icon/index.ts +1 -0
  196. package/src/components/menu/Menu.tsx +57 -0
  197. package/src/components/menu/MenuItem.tsx +79 -0
  198. package/src/components/menu/MenuItems.tsx +26 -0
  199. package/src/components/menu/MenuList.tsx +151 -0
  200. package/src/components/menu/Separator.tsx +28 -0
  201. package/src/components/menu/calculations.ts +49 -0
  202. package/src/components/menu/constants.ts +9 -0
  203. package/src/components/menu/index.ts +1 -0
  204. package/src/components/menu/styles.ts +64 -0
  205. package/src/components/menu/types.d.ts +28 -0
  206. package/src/components/provider/Provider.tsx +105 -0
  207. package/src/components/provider/index.ts +2 -0
  208. package/src/components/provider/reducer.ts +48 -0
  209. package/src/components/provider/types.d.ts +33 -0
  210. package/src/constants.ts +54 -0
  211. package/src/context/index.ts +1 -0
  212. package/src/context/internal.ts +19 -0
  213. package/src/hooks/index.ts +2 -0
  214. package/src/hooks/useDeviceOrientation.ts +28 -0
  215. package/src/hooks/useInternal.ts +4 -0
  216. package/src/index.ts +4 -0
  217. package/src/styleGuide.ts +31 -0
  218. package/src/utils/calculations.ts +110 -0
  219. package/src/utils/validations.ts +42 -0
package/LICENCE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Enes Ozturk
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # React Native Hold Menu
2
+
3
+ [![Reanimated v2 version](https://img.shields.io/github/package-json/v/enesozturk/react-native-hold-menu/develop?label=Reanimated%20v2&style=flat-square)](https://www.npmjs.com/package/react-native-hold-menu) [![npm](https://img.shields.io/npm/l/react-native-hold-menu?style=flat-square)](https://www.npmjs.com/package/react-native-hold-menu) [![npm](https://img.shields.io/badge/types-included-blue?style=flat-square)](https://www.npmjs.com/package/react-native-hold-menu) [![runs with expo](https://img.shields.io/badge/Runs%20with%20Expo-4630EB.svg?style=flat-square&logo=EXPO&labelColor=f3f3f3&logoColor=000)](https://expo.io/)
4
+
5
+ A performant, easy to use hold to open context menu for React Native powered by Reanimated. 🔥
6
+
7
+ > This package is experimental and still in progress. Using it in production is not preffered yet.
8
+
9
+ ---
10
+
11
+ ![hold-menu-preview](./preview.gif)
12
+
13
+ ## Features
14
+
15
+ - Powered with Reanimated v2. 🚀
16
+ - Smooth interactions & animations.
17
+ - Supports dark/light Mode. 🌚 🌝
18
+ - Supports device orientation change.
19
+ - Compatible with Expo.
20
+ - Written in `TypeScript`.
21
+
22
+ ## Getting Started
23
+
24
+ Check out [the documentation website](https://enesozturk.github.io/react-native-hold-menu).
25
+
26
+ ---
27
+
28
+ ## Contributors
29
+
30
+ - [Mo Gorhom](https://gorhom.dev/)
31
+
32
+ ## License
33
+
34
+ [MIT](./LICENSE)
35
+
36
+ #### Show Your Support
37
+
38
+ Please give a star if you like this project! 🤩
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
13
+
14
+ var _reactNativeGestureHandler = require("react-native-gesture-handler");
15
+
16
+ var _blur = require("@react-native-community/blur");
17
+
18
+ var _styles = require("./styles");
19
+
20
+ var _constants = require("../../constants");
21
+
22
+ var _constants2 = require("./constants");
23
+
24
+ var _hooks = require("../../hooks");
25
+
26
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
27
+
28
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
29
+
30
+ // Components
31
+ // @ts-ignore
32
+ // Utils
33
+ const AnimatedBlurView = _constants.IS_IOS ? _reactNativeReanimated.default.createAnimatedComponent(_blur.BlurView) : _reactNativeReanimated.default.View;
34
+
35
+ const BackdropComponent = () => {
36
+ const {
37
+ state,
38
+ theme
39
+ } = (0, _hooks.useInternal)();
40
+ const tapGestureEvent = (0, _reactNativeReanimated.useAnimatedGestureHandler)({
41
+ onStart: (event, context) => {
42
+ context.startPosition = {
43
+ x: event.x,
44
+ y: event.y
45
+ };
46
+ },
47
+ onCancel: () => {
48
+ state.value = _constants.CONTEXT_MENU_STATE.END;
49
+ },
50
+ onEnd: (event, context) => {
51
+ const distance = Math.hypot(event.x - context.startPosition.x, event.y - context.startPosition.y);
52
+ const shouldClose = distance < 10;
53
+ const isStateActive = state.value === _constants.CONTEXT_MENU_STATE.ACTIVE;
54
+
55
+ if (shouldClose && isStateActive) {
56
+ state.value = _constants.CONTEXT_MENU_STATE.END;
57
+ }
58
+ }
59
+ }, [state]);
60
+ const animatedContainerStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
61
+ const topValueAnimation = () => state.value === _constants.CONTEXT_MENU_STATE.ACTIVE ? 0 : (0, _reactNativeReanimated.withDelay)(_constants.HOLD_ITEM_TRANSFORM_DURATION, (0, _reactNativeReanimated.withTiming)(_constants.WINDOW_HEIGHT, {
62
+ duration: 0
63
+ }));
64
+
65
+ const opacityValueAnimation = () => (0, _reactNativeReanimated.withTiming)(state.value === _constants.CONTEXT_MENU_STATE.ACTIVE ? 1 : 0, {
66
+ duration: _constants.HOLD_ITEM_TRANSFORM_DURATION
67
+ });
68
+
69
+ return {
70
+ top: topValueAnimation(),
71
+ opacity: opacityValueAnimation()
72
+ };
73
+ });
74
+ const animatedContainerProps = (0, _reactNativeReanimated.useAnimatedProps)(() => {
75
+ return {
76
+ blurAmount: (0, _reactNativeReanimated.withTiming)(state.value === _constants.CONTEXT_MENU_STATE.ACTIVE ? 100 : 0, {
77
+ duration: _constants.HOLD_ITEM_TRANSFORM_DURATION
78
+ })
79
+ };
80
+ });
81
+ const animatedInnerContainerStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
82
+ const backgroundColor = theme.value === 'light' ? _constants2.BACKDROP_LIGHT_BACKGROUND_COLOR : _constants2.BACKDROP_DARK_BACKGROUND_COLOR;
83
+ return {
84
+ backgroundColor
85
+ };
86
+ }, [theme]);
87
+ return /*#__PURE__*/_react.default.createElement(_reactNativeGestureHandler.TapGestureHandler, {
88
+ onHandlerStateChange: tapGestureEvent
89
+ }, /*#__PURE__*/_react.default.createElement(AnimatedBlurView // @ts-ignore
90
+ , {
91
+ tint: "default" // @ts-ignore
92
+ ,
93
+ animatedProps: animatedContainerProps,
94
+ style: [_styles.styles.container, animatedContainerStyle]
95
+ }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
96
+ style: [{ ..._reactNative.StyleSheet.absoluteFillObject
97
+ }, animatedInnerContainerStyle]
98
+ })));
99
+ };
100
+
101
+ const Backdrop = /*#__PURE__*/(0, _react.memo)(BackdropComponent);
102
+ var _default = Backdrop;
103
+ exports.default = _default;
104
+ //# sourceMappingURL=Backdrop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Backdrop.tsx"],"names":["AnimatedBlurView","IS_IOS","Animated","createAnimatedComponent","BlurView","View","BackdropComponent","state","theme","tapGestureEvent","onStart","event","context","startPosition","x","y","onCancel","value","CONTEXT_MENU_STATE","END","onEnd","distance","Math","hypot","shouldClose","isStateActive","ACTIVE","animatedContainerStyle","topValueAnimation","HOLD_ITEM_TRANSFORM_DURATION","WINDOW_HEIGHT","duration","opacityValueAnimation","top","opacity","animatedContainerProps","blurAmount","animatedInnerContainerStyle","backgroundColor","BACKDROP_LIGHT_BACKGROUND_COLOR","BACKDROP_DARK_BACKGROUND_COLOR","styles","container","St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ACL,EAAE,GAAGgB,wBAAWC;AAAhB,KADK,EAELP,2BAFK;AADT,IAPF,CADF,CADF;AAkBD,CA1FD;;AA4FA,MAAMQ,QAAQ,gBAAG,iBAAKvC,iBAAL,CAAjB;eAEeuC,Q","sourcesContent":["import React, { memo } from 'react';\nimport { StyleSheet } from 'react-native';\nimport Animated, {\n useAnimatedGestureHandler,\n useAnimatedProps,\n useAnimatedStyle,\n withDelay,\n withTiming,\n} from 'react-native-reanimated';\nimport {\n TapGestureHandler,\n TapGestureHandlerGestureEvent,\n} from 'react-native-gesture-handler';\n\n// Components\n// @ts-ignore\nimport { BlurView } from '@react-native-community/blur';\n\n// Utils\nimport { styles } from './styles';\nimport {\n CONTEXT_MENU_STATE,\n HOLD_ITEM_TRANSFORM_DURATION,\n IS_IOS,\n WINDOW_HEIGHT,\n} from '../../constants';\nimport {\n BACKDROP_LIGHT_BACKGROUND_COLOR,\n BACKDROP_DARK_BACKGROUND_COLOR,\n} from './constants';\nimport { useInternal } from '../../hooks';\n\nconst AnimatedBlurView = IS_IOS\n ? Animated.createAnimatedComponent(BlurView)\n : Animated.View;\n\ntype Context = {\n startPosition: {\n x: number;\n y: number;\n };\n};\n\nconst BackdropComponent = () => {\n const { state, theme } = useInternal();\n\n const tapGestureEvent = useAnimatedGestureHandler<\n TapGestureHandlerGestureEvent,\n Context\n >(\n {\n onStart: (event, context) => {\n context.startPosition = { x: event.x, y: event.y };\n },\n onCancel: () => {\n state.value = CONTEXT_MENU_STATE.END;\n },\n onEnd: (event, context) => {\n const distance = Math.hypot(\n event.x - context.startPosition.x,\n event.y - context.startPosition.y\n );\n const shouldClose = distance < 10;\n const isStateActive = state.value === CONTEXT_MENU_STATE.ACTIVE;\n\n if (shouldClose && isStateActive) {\n state.value = CONTEXT_MENU_STATE.END;\n }\n },\n },\n [state]\n );\n\n const animatedContainerStyle = useAnimatedStyle(() => {\n const topValueAnimation = () =>\n state.value === CONTEXT_MENU_STATE.ACTIVE\n ? 0\n : withDelay(\n HOLD_ITEM_TRANSFORM_DURATION,\n withTiming(WINDOW_HEIGHT, {\n duration: 0,\n })\n );\n\n const opacityValueAnimation = () =>\n withTiming(state.value === CONTEXT_MENU_STATE.ACTIVE ? 1 : 0, {\n duration: HOLD_ITEM_TRANSFORM_DURATION,\n });\n\n return {\n top: topValueAnimation(),\n opacity: opacityValueAnimation(),\n };\n });\n\n const animatedContainerProps = useAnimatedProps(() => {\n return {\n blurAmount: withTiming(\n state.value === CONTEXT_MENU_STATE.ACTIVE ? 100 : 0,\n {\n duration: HOLD_ITEM_TRANSFORM_DURATION,\n }\n ),\n };\n });\n\n const animatedInnerContainerStyle = useAnimatedStyle(() => {\n const backgroundColor =\n theme.value === 'light'\n ? BACKDROP_LIGHT_BACKGROUND_COLOR\n : BACKDROP_DARK_BACKGROUND_COLOR;\n\n return { backgroundColor };\n }, [theme]);\n\n return (\n <TapGestureHandler onHandlerStateChange={tapGestureEvent}>\n <AnimatedBlurView\n // @ts-ignore\n tint=\"default\"\n // @ts-ignore\n animatedProps={animatedContainerProps}\n style={[styles.container, animatedContainerStyle]}\n >\n <Animated.View\n style={[\n { ...StyleSheet.absoluteFillObject },\n animatedInnerContainerStyle,\n ]}\n />\n </AnimatedBlurView>\n </TapGestureHandler>\n );\n};\n\nconst Backdrop = memo(BackdropComponent);\n\nexport default Backdrop;\n"]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BACKDROP_DARK_BACKGROUND_COLOR = exports.BACKDROP_LIGHT_BACKGROUND_COLOR = void 0;
7
+
8
+ var _constants = require("../../constants");
9
+
10
+ const BACKDROP_LIGHT_BACKGROUND_COLOR = _constants.IS_IOS ? 'rgba(0,0,0,0.2)' : 'rgba(19, 19, 19, 0.95)';
11
+ exports.BACKDROP_LIGHT_BACKGROUND_COLOR = BACKDROP_LIGHT_BACKGROUND_COLOR;
12
+ const BACKDROP_DARK_BACKGROUND_COLOR = _constants.IS_IOS ? 'rgba(0,0,0,0.75)' : 'rgba(0,0,0,0.95)';
13
+ exports.BACKDROP_DARK_BACKGROUND_COLOR = BACKDROP_DARK_BACKGROUND_COLOR;
14
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["constants.ts"],"names":["BACKDROP_LIGHT_BACKGROUND_COLOR","IS_IOS","BACKDROP_DARK_BACKGROUND_COLOR"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,+BAA+B,GAAGC,oBAC3C,iBAD2C,GAE3C,wBAFG;;AAGA,MAAMC,8BAA8B,GAAGD,oBAC1C,kBAD0C,GAE1C,kBAFG","sourcesContent":["import { IS_IOS } from '../../constants';\n\nexport const BACKDROP_LIGHT_BACKGROUND_COLOR = IS_IOS\n ? 'rgba(0,0,0,0.2)'\n : 'rgba(19, 19, 19, 0.95)';\nexport const BACKDROP_DARK_BACKGROUND_COLOR = IS_IOS\n ? 'rgba(0,0,0,0.75)'\n : 'rgba(0,0,0,0.95)';\n"]}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Backdrop", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Backdrop.default;
10
+ }
11
+ });
12
+
13
+ var _Backdrop = _interopRequireDefault(require("./Backdrop"));
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default as Backdrop } from './Backdrop';\n"]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.styles = void 0;
7
+
8
+ var _reactNative = require("react-native");
9
+
10
+ const styles = _reactNative.StyleSheet.create({
11
+ container: { ..._reactNative.StyleSheet.absoluteFillObject,
12
+ zIndex: 0
13
+ }
14
+ });
15
+
16
+ exports.styles = styles;
17
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["styles.ts"],"names":["styles","StyleSheet","create","container","absoluteFillObject","zIndex"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,MAAM,GAAGC,wBAAWC,MAAX,CAAkB;AACtCC,EAAAA,SAAS,EAAE,EACT,GAAGF,wBAAWG,kBADL;AAETC,IAAAA,MAAM,EAAE;AAFC;AAD2B,CAAlB,CAAf","sourcesContent":["import { StyleSheet } from 'react-native';\n\nexport const styles = StyleSheet.create({\n container: {\n ...StyleSheet.absoluteFillObject,\n zIndex: 0,\n },\n});\n"]}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ var _lodash = _interopRequireDefault(require("lodash.isequal"));
13
+
14
+ var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated"));
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
19
+
20
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
21
+
22
+ function _extends() { _extends = Object.assign || 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); }
23
+
24
+ const AnimatedFlatList = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.FlatList);
25
+
26
+ const HoldMenuFlatListComponent = props => {
27
+ return /*#__PURE__*/_react.default.createElement(AnimatedFlatList, _extends({}, props, {
28
+ scrollEventThrottle: 16
29
+ }));
30
+ };
31
+
32
+ const HoldMenuFlatList = /*#__PURE__*/(0, _react.memo)(HoldMenuFlatListComponent, _lodash.default);
33
+ var _default = HoldMenuFlatList;
34
+ exports.default = _default;
35
+ //# sourceMappingURL=FlatList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["FlatList.tsx"],"names":["AnimatedFlatList","Animated","createAnimatedComponent","RNFlatList","HoldMenuFlatListComponent","props","HoldMenuFlatList","isEqual"],"mappings":";;;;;;;AAAA;;AACA;;AAKA;;AACA;;;;;;;;;;AAEA,MAAMA,gBAAgB,GAAGC,+BAASC,uBAAT,CAAiCC,qBAAjC,CAAzB;;AAOA,MAAMC,yBAAyB,GAAIC,KAAD,IAAuC;AACvE,sBAAO,6BAAC,gBAAD,eAAsBA,KAAtB;AAA6B,IAAA,mBAAmB,EAAE;AAAlD,KAAP;AACD,CAFD;;AAIA,MAAMC,gBAAgB,gBAAG,iBAAKF,yBAAL,EAAgCG,eAAhC,CAAzB;eAEeD,gB","sourcesContent":["import React, { memo } from 'react';\nimport {\n FlatList as RNFlatList,\n FlatListProps as RNFlatListProps,\n} from 'react-native';\n\nimport isEqual from 'lodash.isequal';\nimport Animated from 'react-native-reanimated';\n\nconst AnimatedFlatList = Animated.createAnimatedComponent(RNFlatList);\n\nexport type HoldMenuFlatListProps<T> = Omit<\n RNFlatListProps<T>,\n 'scrollEventThrottle'\n>;\n\nconst HoldMenuFlatListComponent = (props: HoldMenuFlatListProps<any>) => {\n return <AnimatedFlatList {...props} scrollEventThrottle={16} />;\n};\n\nconst HoldMenuFlatList = memo(HoldMenuFlatListComponent, isEqual);\n\nexport default HoldMenuFlatList;\n"]}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "default", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _FlatList.default;
10
+ }
11
+ });
12
+
13
+ var _FlatList = _interopRequireDefault(require("./FlatList"));
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { default } from './FlatList';\nexport type { HoldMenuFlatListProps } from './FlatList';\n"]}