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.
- package/LICENCE +21 -0
- package/README.md +38 -0
- package/lib/commonjs/components/backdrop/Backdrop.js +104 -0
- package/lib/commonjs/components/backdrop/Backdrop.js.map +1 -0
- package/lib/commonjs/components/backdrop/constants.js +14 -0
- package/lib/commonjs/components/backdrop/constants.js.map +1 -0
- package/lib/commonjs/components/backdrop/index.js +16 -0
- package/lib/commonjs/components/backdrop/index.js.map +1 -0
- package/lib/commonjs/components/backdrop/styles.js +17 -0
- package/lib/commonjs/components/backdrop/styles.js.map +1 -0
- package/lib/commonjs/components/flatList/FlatList.js +35 -0
- package/lib/commonjs/components/flatList/FlatList.js.map +1 -0
- package/lib/commonjs/components/flatList/index.js +16 -0
- package/lib/commonjs/components/flatList/index.js.map +1 -0
- package/lib/commonjs/components/holdItem/HoldItem.js +369 -0
- package/lib/commonjs/components/holdItem/HoldItem.js.map +1 -0
- package/lib/commonjs/components/holdItem/index.js +16 -0
- package/lib/commonjs/components/holdItem/index.js.map +1 -0
- package/lib/commonjs/components/holdItem/styles.js +22 -0
- package/lib/commonjs/components/holdItem/styles.js.map +1 -0
- package/lib/commonjs/components/holdItem/types.d.js +2 -0
- package/lib/commonjs/components/holdItem/types.d.js.map +1 -0
- package/lib/commonjs/components/icon/Icon.js +43 -0
- package/lib/commonjs/components/icon/Icon.js.map +1 -0
- package/lib/commonjs/components/icon/index.js +16 -0
- package/lib/commonjs/components/icon/index.js.map +1 -0
- package/lib/commonjs/components/menu/Menu.js +57 -0
- package/lib/commonjs/components/menu/Menu.js.map +1 -0
- package/lib/commonjs/components/menu/MenuItem.js +85 -0
- package/lib/commonjs/components/menu/MenuItem.js.map +1 -0
- package/lib/commonjs/components/menu/MenuItems.js +35 -0
- package/lib/commonjs/components/menu/MenuItems.js.map +1 -0
- package/lib/commonjs/components/menu/MenuList.js +121 -0
- package/lib/commonjs/components/menu/MenuList.js.map +1 -0
- package/lib/commonjs/components/menu/Separator.js +47 -0
- package/lib/commonjs/components/menu/Separator.js.map +1 -0
- package/lib/commonjs/components/menu/calculations.js +31 -0
- package/lib/commonjs/components/menu/calculations.js.map +1 -0
- package/lib/commonjs/components/menu/constants.js +21 -0
- package/lib/commonjs/components/menu/constants.js.map +1 -0
- package/lib/commonjs/components/menu/index.js +16 -0
- package/lib/commonjs/components/menu/index.js.map +1 -0
- package/lib/commonjs/components/menu/styles.js +77 -0
- package/lib/commonjs/components/menu/styles.js.map +1 -0
- package/lib/commonjs/components/menu/types.d.js +2 -0
- package/lib/commonjs/components/menu/types.d.js.map +1 -0
- package/lib/commonjs/components/provider/Provider.js +98 -0
- package/lib/commonjs/components/provider/Provider.js.map +1 -0
- package/lib/commonjs/components/provider/index.js +16 -0
- package/lib/commonjs/components/provider/index.js.map +1 -0
- package/lib/commonjs/components/provider/reducer.js +50 -0
- package/lib/commonjs/components/provider/reducer.js.map +1 -0
- package/lib/commonjs/components/provider/types.d.js +2 -0
- package/lib/commonjs/components/provider/types.d.js.map +1 -0
- package/lib/commonjs/constants.js +60 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/context/index.js +14 -0
- package/lib/commonjs/context/index.js.map +1 -0
- package/lib/commonjs/context/internal.js +13 -0
- package/lib/commonjs/context/internal.js.map +1 -0
- package/lib/commonjs/hooks/index.js +24 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/useDeviceOrientation.js +38 -0
- package/lib/commonjs/hooks/useDeviceOrientation.js.map +1 -0
- package/lib/commonjs/hooks/useInternal.js +15 -0
- package/lib/commonjs/hooks/useInternal.js.map +1 -0
- package/lib/commonjs/index.js +40 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/styleGuide.js +39 -0
- package/lib/commonjs/styleGuide.js.map +1 -0
- package/lib/commonjs/utils/calculations.js +73 -0
- package/lib/commonjs/utils/calculations.js.map +1 -0
- package/lib/commonjs/utils/validations.js +43 -0
- package/lib/commonjs/utils/validations.js.map +1 -0
- package/lib/module/components/backdrop/Backdrop.js +83 -0
- package/lib/module/components/backdrop/Backdrop.js.map +1 -0
- package/lib/module/components/backdrop/constants.js +4 -0
- package/lib/module/components/backdrop/constants.js.map +1 -0
- package/lib/module/components/backdrop/index.js +2 -0
- package/lib/module/components/backdrop/index.js.map +1 -0
- package/lib/module/components/backdrop/styles.js +7 -0
- package/lib/module/components/backdrop/styles.js.map +1 -0
- package/lib/module/components/flatList/FlatList.js +17 -0
- package/lib/module/components/flatList/FlatList.js.map +1 -0
- package/lib/module/components/flatList/index.js +2 -0
- package/lib/module/components/flatList/index.js.map +1 -0
- package/lib/module/components/holdItem/HoldItem.js +344 -0
- package/lib/module/components/holdItem/HoldItem.js.map +1 -0
- package/lib/module/components/holdItem/index.js +2 -0
- package/lib/module/components/holdItem/index.js.map +1 -0
- package/lib/module/components/holdItem/styles.js +12 -0
- package/lib/module/components/holdItem/styles.js.map +1 -0
- package/lib/module/components/holdItem/types.d.js +2 -0
- package/lib/module/components/holdItem/types.d.js.map +1 -0
- package/lib/module/components/icon/Icon.js +26 -0
- package/lib/module/components/icon/Icon.js.map +1 -0
- package/lib/module/components/icon/index.js +2 -0
- package/lib/module/components/icon/index.js.map +1 -0
- package/lib/module/components/menu/Menu.js +37 -0
- package/lib/module/components/menu/Menu.js.map +1 -0
- package/lib/module/components/menu/MenuItem.js +59 -0
- package/lib/module/components/menu/MenuItem.js.map +1 -0
- package/lib/module/components/menu/MenuItems.js +19 -0
- package/lib/module/components/menu/MenuItems.js.map +1 -0
- package/lib/module/components/menu/MenuList.js +93 -0
- package/lib/module/components/menu/MenuList.js.map +1 -0
- package/lib/module/components/menu/Separator.js +29 -0
- package/lib/module/components/menu/Separator.js.map +1 -0
- package/lib/module/components/menu/calculations.js +17 -0
- package/lib/module/components/menu/calculations.js.map +1 -0
- package/lib/module/components/menu/constants.js +8 -0
- package/lib/module/components/menu/constants.js.map +1 -0
- package/lib/module/components/menu/index.js +2 -0
- package/lib/module/components/menu/index.js.map +1 -0
- package/lib/module/components/menu/styles.js +63 -0
- package/lib/module/components/menu/styles.js.map +1 -0
- package/lib/module/components/menu/types.d.js +2 -0
- package/lib/module/components/menu/types.d.js.map +1 -0
- package/lib/module/components/provider/Provider.js +75 -0
- package/lib/module/components/provider/Provider.js.map +1 -0
- package/lib/module/components/provider/index.js +2 -0
- package/lib/module/components/provider/index.js.map +1 -0
- package/lib/module/components/provider/reducer.js +38 -0
- package/lib/module/components/provider/reducer.js.map +1 -0
- package/lib/module/components/provider/types.d.js +2 -0
- package/lib/module/components/provider/types.d.js.map +1 -0
- package/lib/module/constants.js +37 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/context/index.js +2 -0
- package/lib/module/context/index.js.map +1 -0
- package/lib/module/context/internal.js +4 -0
- package/lib/module/context/internal.js.map +1 -0
- package/lib/module/hooks/index.js +3 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/useDeviceOrientation.js +27 -0
- package/lib/module/hooks/useDeviceOrientation.js.map +1 -0
- package/lib/module/hooks/useInternal.js +4 -0
- package/lib/module/hooks/useInternal.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/styleGuide.js +30 -0
- package/lib/module/styleGuide.js.map +1 -0
- package/lib/module/utils/calculations.js +51 -0
- package/lib/module/utils/calculations.js.map +1 -0
- package/lib/module/utils/validations.js +38 -0
- package/lib/module/utils/validations.js.map +1 -0
- package/lib/typescript/components/backdrop/Backdrop.d.ts +3 -0
- package/lib/typescript/components/backdrop/constants.d.ts +2 -0
- package/lib/typescript/components/backdrop/index.d.ts +1 -0
- package/lib/typescript/components/backdrop/styles.d.ts +10 -0
- package/lib/typescript/components/flatList/FlatList.d.ts +5 -0
- package/lib/typescript/components/flatList/index.d.ts +2 -0
- package/lib/typescript/components/holdItem/HoldItem.d.ts +4 -0
- package/lib/typescript/components/holdItem/index.d.ts +2 -0
- package/lib/typescript/components/holdItem/styles.d.ts +15 -0
- package/lib/typescript/components/holdItem/types.d.ts +131 -0
- package/lib/typescript/components/icon/Icon.d.ts +7 -0
- package/lib/typescript/components/icon/index.d.ts +1 -0
- package/lib/typescript/components/menu/Menu.d.ts +3 -0
- package/lib/typescript/components/menu/MenuItem.d.ts +8 -0
- package/lib/typescript/components/menu/MenuItems.d.ts +6 -0
- package/lib/typescript/components/menu/MenuList.d.ts +3 -0
- package/lib/typescript/components/menu/Separator.d.ts +3 -0
- package/lib/typescript/components/menu/calculations.d.ts +4 -0
- package/lib/typescript/components/menu/constants.d.ts +7 -0
- package/lib/typescript/components/menu/index.d.ts +1 -0
- package/lib/typescript/components/menu/styles.d.ts +59 -0
- package/lib/typescript/components/menu/types.d.ts +28 -0
- package/lib/typescript/components/provider/Provider.d.ts +10 -0
- package/lib/typescript/components/provider/index.d.ts +2 -0
- package/lib/typescript/components/provider/reducer.d.ts +20 -0
- package/lib/typescript/components/provider/types.d.ts +33 -0
- package/lib/typescript/constants.d.ts +29 -0
- package/lib/typescript/context/index.d.ts +1 -0
- package/lib/typescript/context/internal.d.ts +16 -0
- package/lib/typescript/hooks/index.d.ts +2 -0
- package/lib/typescript/hooks/useDeviceOrientation.d.ts +3 -0
- package/lib/typescript/hooks/useInternal.d.ts +1 -0
- package/lib/typescript/index.d.ts +4 -0
- package/lib/typescript/styleGuide.d.ts +28 -0
- package/lib/typescript/utils/calculations.d.ts +14 -0
- package/lib/typescript/utils/validations.d.ts +3 -0
- package/package.json +106 -0
- package/src/components/backdrop/Backdrop.tsx +138 -0
- package/src/components/backdrop/constants.ts +8 -0
- package/src/components/backdrop/index.ts +1 -0
- package/src/components/backdrop/styles.ts +8 -0
- package/src/components/flatList/FlatList.tsx +23 -0
- package/src/components/flatList/index.ts +2 -0
- package/src/components/holdItem/HoldItem.tsx +449 -0
- package/src/components/holdItem/index.ts +2 -0
- package/src/components/holdItem/styles.ts +11 -0
- package/src/components/holdItem/types.d.ts +131 -0
- package/src/components/icon/Icon.tsx +33 -0
- package/src/components/icon/index.ts +1 -0
- package/src/components/menu/Menu.tsx +57 -0
- package/src/components/menu/MenuItem.tsx +79 -0
- package/src/components/menu/MenuItems.tsx +26 -0
- package/src/components/menu/MenuList.tsx +151 -0
- package/src/components/menu/Separator.tsx +28 -0
- package/src/components/menu/calculations.ts +49 -0
- package/src/components/menu/constants.ts +9 -0
- package/src/components/menu/index.ts +1 -0
- package/src/components/menu/styles.ts +64 -0
- package/src/components/menu/types.d.ts +28 -0
- package/src/components/provider/Provider.tsx +105 -0
- package/src/components/provider/index.ts +2 -0
- package/src/components/provider/reducer.ts +48 -0
- package/src/components/provider/types.d.ts +33 -0
- package/src/constants.ts +54 -0
- package/src/context/index.ts +1 -0
- package/src/context/internal.ts +19 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useDeviceOrientation.ts +28 -0
- package/src/hooks/useInternal.ts +4 -0
- package/src/index.ts +4 -0
- package/src/styleGuide.ts +31 -0
- package/src/utils/calculations.ts +110 -0
- 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 @@
|
|
|
1
|
+
export { default as Backdrop } from './Backdrop';
|
|
@@ -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;
|