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/package.json ADDED
@@ -0,0 +1,106 @@
1
+ {
2
+ "name": "react-native-hold-menu-actions",
3
+ "version": "0.1.6",
4
+ "description": "A performant, easy to use hold to open context menu for React Native powered by Reanimated.",
5
+ "main": "lib/commonjs/index.js",
6
+ "module": "lib/module/index.js",
7
+ "types": "lib/typescript/index.d.ts",
8
+ "react-native": "src/index.ts",
9
+ "files": [
10
+ "src",
11
+ "lib",
12
+ "!**/__tests__",
13
+ "!**/__fixtures__",
14
+ "!**/__mocks__"
15
+ ],
16
+ "keywords": [
17
+ "react-native",
18
+ "ios",
19
+ "android",
20
+ "hold-menu",
21
+ "context-menu",
22
+ "hold-to-open",
23
+ "reanimated",
24
+ "menu"
25
+ ],
26
+ "repository": "https://github.com/shuraman69/react-native-hold-menu",
27
+ "author": "Enes Ozturk (https://ozturkenes.com)",
28
+ "license": "MIT",
29
+ "bugs": {
30
+ "url": "https://github.com/shuraman69/react-native-hold-menu/issues"
31
+ },
32
+ "homepage": "https://shuraman69.github.io/react-native-hold-menu",
33
+ "scripts": {
34
+ "typescript": "tsc --noEmit",
35
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
36
+ "build": "bob build && yarn copy-dts",
37
+ "copy-dts": "copyfiles -u 1 \"src/**/*.d.ts\" lib/typescript",
38
+ "release": "release-it",
39
+ "example": "yarn --cwd example",
40
+ "bootstrap": "yarn install && yarn example",
41
+ "version": "auto-changelog -p && git add ."
42
+ },
43
+ "dependencies": {
44
+ "@gorhom/portal": "^1.0.3",
45
+ "lodash.isequal": "^4.5.0",
46
+ "nanoid": "^3.1.20"
47
+ },
48
+ "devDependencies": {
49
+ "@babel/core": "~7.9.0",
50
+ "@commitlint/cli": "^11.0.0",
51
+ "@commitlint/config-conventional": "^11.0.0",
52
+ "@react-native-community/eslint-config": "^2.0.0",
53
+ "@release-it/conventional-changelog": "^2.0.0",
54
+ "@types/faker": "^5.1.5",
55
+ "@types/lodash.isequal": "^4.5.5",
56
+ "@types/react": "~16.9.35",
57
+ "@types/react-native": "0.63.4",
58
+ "auto-changelog": "^2.2.1",
59
+ "babel-jest": "~25.2.6",
60
+ "copyfiles": "^2.4.1",
61
+ "eslint": "^7.19.0",
62
+ "eslint-config-prettier": "^7.2.0",
63
+ "eslint-plugin-prettier": "^3.3.1",
64
+ "husky": "^5.0.9",
65
+ "jest": "~25.2.6",
66
+ "prettier": "^2.2.1",
67
+ "react": "16.13.1",
68
+ "react-native": "~0.63.4",
69
+ "react-native-builder-bob": "^0.17.1",
70
+ "react-native-gesture-handler": "1.8.0",
71
+ "react-native-reanimated": "2.1.0",
72
+ "react-test-renderer": "~16.13.1",
73
+ "release-it": "^14.4.1",
74
+ "typescript": "~4.0.0"
75
+ },
76
+ "peerDependencies": {
77
+ "@react-native-community/blur": "*",
78
+ "expo-haptics": "*",
79
+ "react": "*",
80
+ "react-native": "*",
81
+ "react-native-gesture-handler": ">=1.8.0",
82
+ "react-native-reanimated": ">=2.1.0"
83
+ },
84
+ "@react-native-community/bob": {
85
+ "source": "src",
86
+ "output": "lib",
87
+ "targets": [
88
+ "commonjs",
89
+ "module",
90
+ "typescript"
91
+ ]
92
+ },
93
+ "react-native-builder-bob": {
94
+ "source": "src",
95
+ "output": "lib",
96
+ "targets": [
97
+ "commonjs",
98
+ "module",
99
+ "typescript"
100
+ ]
101
+ },
102
+ "eslintIgnore": [
103
+ "node_modules/",
104
+ "lib/"
105
+ ]
106
+ }
@@ -0,0 +1,138 @@
1
+ import React, { memo } from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import Animated, {
4
+ useAnimatedGestureHandler,
5
+ useAnimatedProps,
6
+ useAnimatedStyle,
7
+ withDelay,
8
+ withTiming,
9
+ } from 'react-native-reanimated';
10
+ import {
11
+ TapGestureHandler,
12
+ TapGestureHandlerGestureEvent,
13
+ } from 'react-native-gesture-handler';
14
+
15
+ // Components
16
+ // @ts-ignore
17
+ import { BlurView } from '@react-native-community/blur';
18
+
19
+ // Utils
20
+ import { styles } from './styles';
21
+ import {
22
+ CONTEXT_MENU_STATE,
23
+ HOLD_ITEM_TRANSFORM_DURATION,
24
+ IS_IOS,
25
+ WINDOW_HEIGHT,
26
+ } from '../../constants';
27
+ import {
28
+ BACKDROP_LIGHT_BACKGROUND_COLOR,
29
+ BACKDROP_DARK_BACKGROUND_COLOR,
30
+ } from './constants';
31
+ import { useInternal } from '../../hooks';
32
+
33
+ const AnimatedBlurView = IS_IOS
34
+ ? Animated.createAnimatedComponent(BlurView)
35
+ : Animated.View;
36
+
37
+ type Context = {
38
+ startPosition: {
39
+ x: number;
40
+ y: number;
41
+ };
42
+ };
43
+
44
+ const BackdropComponent = () => {
45
+ const { state, theme } = useInternal();
46
+
47
+ const tapGestureEvent = useAnimatedGestureHandler<
48
+ TapGestureHandlerGestureEvent,
49
+ Context
50
+ >(
51
+ {
52
+ onStart: (event, context) => {
53
+ context.startPosition = { x: event.x, y: event.y };
54
+ },
55
+ onCancel: () => {
56
+ state.value = CONTEXT_MENU_STATE.END;
57
+ },
58
+ onEnd: (event, context) => {
59
+ const distance = Math.hypot(
60
+ event.x - context.startPosition.x,
61
+ event.y - context.startPosition.y
62
+ );
63
+ const shouldClose = distance < 10;
64
+ const isStateActive = state.value === CONTEXT_MENU_STATE.ACTIVE;
65
+
66
+ if (shouldClose && isStateActive) {
67
+ state.value = CONTEXT_MENU_STATE.END;
68
+ }
69
+ },
70
+ },
71
+ [state]
72
+ );
73
+
74
+ const animatedContainerStyle = useAnimatedStyle(() => {
75
+ const topValueAnimation = () =>
76
+ state.value === CONTEXT_MENU_STATE.ACTIVE
77
+ ? 0
78
+ : withDelay(
79
+ HOLD_ITEM_TRANSFORM_DURATION,
80
+ withTiming(WINDOW_HEIGHT, {
81
+ duration: 0,
82
+ })
83
+ );
84
+
85
+ const opacityValueAnimation = () =>
86
+ withTiming(state.value === CONTEXT_MENU_STATE.ACTIVE ? 1 : 0, {
87
+ duration: HOLD_ITEM_TRANSFORM_DURATION,
88
+ });
89
+
90
+ return {
91
+ top: topValueAnimation(),
92
+ opacity: opacityValueAnimation(),
93
+ };
94
+ });
95
+
96
+ const animatedContainerProps = useAnimatedProps(() => {
97
+ return {
98
+ blurAmount: withTiming(
99
+ state.value === CONTEXT_MENU_STATE.ACTIVE ? 100 : 0,
100
+ {
101
+ duration: HOLD_ITEM_TRANSFORM_DURATION,
102
+ }
103
+ ),
104
+ };
105
+ });
106
+
107
+ const animatedInnerContainerStyle = useAnimatedStyle(() => {
108
+ const backgroundColor =
109
+ theme.value === 'light'
110
+ ? BACKDROP_LIGHT_BACKGROUND_COLOR
111
+ : BACKDROP_DARK_BACKGROUND_COLOR;
112
+
113
+ return { backgroundColor };
114
+ }, [theme]);
115
+
116
+ return (
117
+ <TapGestureHandler onHandlerStateChange={tapGestureEvent}>
118
+ <AnimatedBlurView
119
+ // @ts-ignore
120
+ tint="default"
121
+ // @ts-ignore
122
+ animatedProps={animatedContainerProps}
123
+ style={[styles.container, animatedContainerStyle]}
124
+ >
125
+ <Animated.View
126
+ style={[
127
+ { ...StyleSheet.absoluteFillObject },
128
+ animatedInnerContainerStyle,
129
+ ]}
130
+ />
131
+ </AnimatedBlurView>
132
+ </TapGestureHandler>
133
+ );
134
+ };
135
+
136
+ const Backdrop = memo(BackdropComponent);
137
+
138
+ export default Backdrop;
@@ -0,0 +1,8 @@
1
+ import { IS_IOS } from '../../constants';
2
+
3
+ export const BACKDROP_LIGHT_BACKGROUND_COLOR = IS_IOS
4
+ ? 'rgba(0,0,0,0.2)'
5
+ : 'rgba(19, 19, 19, 0.95)';
6
+ export const BACKDROP_DARK_BACKGROUND_COLOR = IS_IOS
7
+ ? 'rgba(0,0,0,0.75)'
8
+ : 'rgba(0,0,0,0.95)';
@@ -0,0 +1 @@
1
+ export { default as Backdrop } from './Backdrop';
@@ -0,0 +1,8 @@
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ export const styles = StyleSheet.create({
4
+ container: {
5
+ ...StyleSheet.absoluteFillObject,
6
+ zIndex: 0,
7
+ },
8
+ });
@@ -0,0 +1,23 @@
1
+ import React, { memo } from 'react';
2
+ import {
3
+ FlatList as RNFlatList,
4
+ FlatListProps as RNFlatListProps,
5
+ } from 'react-native';
6
+
7
+ import isEqual from 'lodash.isequal';
8
+ import Animated from 'react-native-reanimated';
9
+
10
+ const AnimatedFlatList = Animated.createAnimatedComponent(RNFlatList);
11
+
12
+ export type HoldMenuFlatListProps<T> = Omit<
13
+ RNFlatListProps<T>,
14
+ 'scrollEventThrottle'
15
+ >;
16
+
17
+ const HoldMenuFlatListComponent = (props: HoldMenuFlatListProps<any>) => {
18
+ return <AnimatedFlatList {...props} scrollEventThrottle={16} />;
19
+ };
20
+
21
+ const HoldMenuFlatList = memo(HoldMenuFlatListComponent, isEqual);
22
+
23
+ export default HoldMenuFlatList;
@@ -0,0 +1,2 @@
1
+ export { default } from './FlatList';
2
+ export type { HoldMenuFlatListProps } from './FlatList';