react-navigation-reanimated-top-tabs 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/ReanimatedTopTab/ReanimatedTabView.js +5 -3
- package/lib/commonjs/components/ReanimatedTopTab/ReanimatedTabView.js.map +1 -1
- package/lib/commonjs/components/elements/TabBarBaseComponent.js +6 -5
- package/lib/commonjs/components/elements/TabBarBaseComponent.js.map +1 -1
- package/lib/commonjs/components/elements/TabBarLabelBaseComponent.js +2 -4
- package/lib/commonjs/components/elements/TabBarLabelBaseComponent.js.map +1 -1
- package/lib/commonjs/components/wrappers/GestureWrapper.js +18 -26
- package/lib/commonjs/components/wrappers/GestureWrapper.js.map +1 -1
- package/lib/commonjs/components/wrappers/ScreenWrapper.js +4 -4
- package/lib/commonjs/components/wrappers/ScreenWrapper.js.map +1 -1
- package/lib/commonjs/components/wrappers/ScrollView.js +27 -16
- package/lib/commonjs/components/wrappers/ScrollView.js.map +1 -1
- package/lib/commonjs/context/Context.helpers.js +19 -0
- package/lib/commonjs/context/Context.helpers.js.map +1 -0
- package/lib/commonjs/context/Context.hooks.js +216 -0
- package/lib/commonjs/context/Context.hooks.js.map +1 -0
- package/lib/commonjs/context/Context.js +68 -0
- package/lib/commonjs/context/Context.js.map +1 -0
- package/lib/commonjs/hooks/useHeader.js +30 -0
- package/lib/commonjs/hooks/useHeader.js.map +1 -0
- package/lib/commonjs/hooks/useScreenGesture.js +21 -0
- package/lib/commonjs/hooks/useScreenGesture.js.map +1 -0
- package/lib/commonjs/hooks/useScreenProperties.js +21 -0
- package/lib/commonjs/hooks/useScreenProperties.js.map +1 -0
- package/lib/commonjs/hooks/{Tab.hooks.js → useScreenScrollable.js} +14 -83
- package/lib/commonjs/hooks/useScreenScrollable.js.map +1 -0
- package/lib/commonjs/hooks/useTabContext.js +11 -0
- package/lib/commonjs/hooks/useTabContext.js.map +1 -0
- package/lib/commonjs/hooks/useTabOffset.js +18 -0
- package/lib/commonjs/hooks/useTabOffset.js.map +1 -0
- package/lib/commonjs/index.js +25 -11
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/navigator/createReanimatedTopTabNavigator.js +14 -29
- package/lib/commonjs/navigator/createReanimatedTopTabNavigator.js.map +1 -1
- package/lib/commonjs/services/Warning.service.js +16 -0
- package/lib/commonjs/services/Warning.service.js.map +1 -0
- package/lib/module/components/ReanimatedTopTab/ReanimatedTabView.js +8 -6
- package/lib/module/components/ReanimatedTopTab/ReanimatedTabView.js.map +1 -1
- package/lib/module/components/elements/TabBarBaseComponent.js +5 -4
- package/lib/module/components/elements/TabBarBaseComponent.js.map +1 -1
- package/lib/module/components/elements/TabBarLabelBaseComponent.js +2 -4
- package/lib/module/components/elements/TabBarLabelBaseComponent.js.map +1 -1
- package/lib/module/components/wrappers/GestureWrapper.js +18 -27
- package/lib/module/components/wrappers/GestureWrapper.js.map +1 -1
- package/lib/module/components/wrappers/ScreenWrapper.js +3 -3
- package/lib/module/components/wrappers/ScreenWrapper.js.map +1 -1
- package/lib/module/components/wrappers/ScrollView.js +23 -12
- package/lib/module/components/wrappers/ScrollView.js.map +1 -1
- package/lib/module/context/Context.helpers.js +15 -0
- package/lib/module/context/Context.helpers.js.map +1 -0
- package/lib/module/context/Context.hooks.js +213 -0
- package/lib/module/context/Context.hooks.js.map +1 -0
- package/lib/module/context/Context.js +64 -0
- package/lib/module/context/Context.js.map +1 -0
- package/lib/module/hooks/useHeader.js +25 -0
- package/lib/module/hooks/useHeader.js.map +1 -0
- package/lib/module/hooks/useScreenGesture.js +16 -0
- package/lib/module/hooks/useScreenGesture.js.map +1 -0
- package/lib/module/hooks/useScreenProperties.js +16 -0
- package/lib/module/hooks/useScreenProperties.js.map +1 -0
- package/lib/module/hooks/useScreenScrollable.js +57 -0
- package/lib/module/hooks/useScreenScrollable.js.map +1 -0
- package/lib/module/hooks/useTabContext.js +6 -0
- package/lib/module/hooks/useTabContext.js.map +1 -0
- package/lib/module/hooks/useTabOffset.js +12 -0
- package/lib/module/hooks/useTabOffset.js.map +1 -0
- package/lib/module/index.js +21 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigator/createReanimatedTopTabNavigator.js +13 -27
- package/lib/module/navigator/createReanimatedTopTabNavigator.js.map +1 -1
- package/lib/module/services/Warning.service.js +12 -0
- package/lib/module/services/Warning.service.js.map +1 -0
- package/lib/typescript/src/components/ReanimatedTopTab/AnimationHelper.d.ts.map +1 -0
- package/lib/typescript/src/components/ReanimatedTopTab/ReanimatedTabView.d.ts.map +1 -0
- package/lib/typescript/src/components/ReanimatedTopTab/types.d.ts.map +1 -0
- package/lib/typescript/src/components/elements/TabBarBaseComponent.d.ts.map +1 -0
- package/lib/typescript/src/components/elements/TabBarLabelBaseComponent.d.ts.map +1 -0
- package/lib/typescript/src/components/wrappers/GestureWrapper.d.ts +7 -0
- package/lib/typescript/src/components/wrappers/GestureWrapper.d.ts.map +1 -0
- package/lib/typescript/src/components/wrappers/ScreenWrapper.d.ts.map +1 -0
- package/lib/typescript/src/components/wrappers/ScrollView.d.ts +5 -0
- package/lib/typescript/src/components/wrappers/ScrollView.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src/context/TabContext.d.ts → src/context/Context.d.ts} +2 -2
- package/lib/typescript/src/context/Context.d.ts.map +1 -0
- package/lib/typescript/src/context/Context.helpers.d.ts +4 -0
- package/lib/typescript/src/context/Context.helpers.d.ts.map +1 -0
- package/lib/typescript/src/context/Context.hooks.d.ts +15 -0
- package/lib/typescript/src/context/Context.hooks.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useHeader.d.ts +10 -0
- package/lib/typescript/src/hooks/useHeader.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useScreenGesture.d.ts +2 -0
- package/lib/typescript/src/hooks/useScreenGesture.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useScreenProperties.d.ts +10 -0
- package/lib/typescript/src/hooks/useScreenProperties.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useScreenScrollable.d.ts +14 -0
- package/lib/typescript/src/hooks/useScreenScrollable.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useTabContext.d.ts +2 -0
- package/lib/typescript/src/hooks/useTabContext.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useTabOffset.d.ts +2 -0
- package/lib/typescript/src/hooks/useTabOffset.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src → src}/index.d.ts +11 -1
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/navigator/createReanimatedTopTabNavigator.d.ts.map +1 -0
- package/lib/typescript/src/services/Warning.service.d.ts +5 -0
- package/lib/typescript/src/services/Warning.service.d.ts.map +1 -0
- package/lib/typescript/{module/src → src}/types.d.ts +24 -17
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +24 -38
- package/src/components/ReanimatedTopTab/ReanimatedTabView.tsx +7 -6
- package/src/components/elements/TabBarBaseComponent.tsx +6 -2
- package/src/components/elements/TabBarLabelBaseComponent.tsx +3 -2
- package/src/components/wrappers/GestureWrapper.tsx +27 -29
- package/src/components/wrappers/ScreenWrapper.tsx +4 -3
- package/src/components/wrappers/ScrollView.tsx +33 -19
- package/src/context/Context.helpers.tsx +10 -0
- package/src/context/Context.hooks.ts +253 -0
- package/src/context/Context.tsx +69 -0
- package/src/hooks/useHeader.ts +30 -0
- package/src/hooks/useScreenGesture.ts +13 -0
- package/src/hooks/useScreenProperties.ts +11 -0
- package/src/hooks/useScreenScrollable.ts +69 -0
- package/src/hooks/useTabContext.ts +4 -0
- package/src/hooks/useTabOffset.ts +8 -0
- package/src/index.tsx +18 -8
- package/src/navigator/createReanimatedTopTabNavigator.tsx +8 -32
- package/src/services/Warning.service.ts +11 -0
- package/src/types.ts +23 -19
- package/lib/commonjs/context/TabContext.hooks.js +0 -48
- package/lib/commonjs/context/TabContext.hooks.js.map +0 -1
- package/lib/commonjs/context/TabContext.js +0 -86
- package/lib/commonjs/context/TabContext.js.map +0 -1
- package/lib/commonjs/hooks/Tab.hooks.js.map +0 -1
- package/lib/module/context/TabContext.hooks.js +0 -44
- package/lib/module/context/TabContext.hooks.js.map +0 -1
- package/lib/module/context/TabContext.js +0 -82
- package/lib/module/context/TabContext.js.map +0 -1
- package/lib/module/hooks/Tab.hooks.js +0 -121
- package/lib/module/hooks/Tab.hooks.js.map +0 -1
- package/lib/typescript/commonjs/src/components/ReanimatedTopTab/AnimationHelper.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/ReanimatedTopTab/ReanimatedTabView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/ReanimatedTopTab/types.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/elements/TabBarBaseComponent.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/elements/TabBarLabelBaseComponent.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/wrappers/GestureWrapper.d.ts +0 -2
- package/lib/typescript/commonjs/src/components/wrappers/GestureWrapper.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/wrappers/ScreenWrapper.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/wrappers/ScrollView.d.ts +0 -6
- package/lib/typescript/commonjs/src/components/wrappers/ScrollView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/context/TabContext.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/context/TabContext.hooks.d.ts +0 -5
- package/lib/typescript/commonjs/src/context/TabContext.hooks.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/hooks/Tab.hooks.d.ts +0 -33
- package/lib/typescript/commonjs/src/hooks/Tab.hooks.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/navigator/createReanimatedTopTabNavigator.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/types.d.ts +0 -56
- package/lib/typescript/commonjs/src/types.d.ts.map +0 -1
- package/lib/typescript/module/src/components/ReanimatedTopTab/AnimationHelper.d.ts +0 -11
- package/lib/typescript/module/src/components/ReanimatedTopTab/AnimationHelper.d.ts.map +0 -1
- package/lib/typescript/module/src/components/ReanimatedTopTab/ReanimatedTabView.d.ts +0 -14
- package/lib/typescript/module/src/components/ReanimatedTopTab/ReanimatedTabView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/ReanimatedTopTab/types.d.ts +0 -30
- package/lib/typescript/module/src/components/ReanimatedTopTab/types.d.ts.map +0 -1
- package/lib/typescript/module/src/components/elements/TabBarBaseComponent.d.ts +0 -23
- package/lib/typescript/module/src/components/elements/TabBarBaseComponent.d.ts.map +0 -1
- package/lib/typescript/module/src/components/elements/TabBarLabelBaseComponent.d.ts +0 -7
- package/lib/typescript/module/src/components/elements/TabBarLabelBaseComponent.d.ts.map +0 -1
- package/lib/typescript/module/src/components/wrappers/GestureWrapper.d.ts +0 -2
- package/lib/typescript/module/src/components/wrappers/GestureWrapper.d.ts.map +0 -1
- package/lib/typescript/module/src/components/wrappers/ScreenWrapper.d.ts +0 -6
- package/lib/typescript/module/src/components/wrappers/ScreenWrapper.d.ts.map +0 -1
- package/lib/typescript/module/src/components/wrappers/ScrollView.d.ts +0 -6
- package/lib/typescript/module/src/components/wrappers/ScrollView.d.ts.map +0 -1
- package/lib/typescript/module/src/context/TabContext.d.ts +0 -4
- package/lib/typescript/module/src/context/TabContext.d.ts.map +0 -1
- package/lib/typescript/module/src/context/TabContext.hooks.d.ts +0 -5
- package/lib/typescript/module/src/context/TabContext.hooks.d.ts.map +0 -1
- package/lib/typescript/module/src/hooks/Tab.hooks.d.ts +0 -33
- package/lib/typescript/module/src/hooks/Tab.hooks.d.ts.map +0 -1
- package/lib/typescript/module/src/index.d.ts +0 -35
- package/lib/typescript/module/src/index.d.ts.map +0 -1
- package/lib/typescript/module/src/navigator/createReanimatedTopTabNavigator.d.ts +0 -4
- package/lib/typescript/module/src/navigator/createReanimatedTopTabNavigator.d.ts.map +0 -1
- package/lib/typescript/module/src/types.d.ts.map +0 -1
- package/src/context/TabContext.hooks.ts +0 -55
- package/src/context/TabContext.tsx +0 -115
- package/src/hooks/Tab.hooks.ts +0 -127
- /package/lib/{typescript/commonjs → commonjs}/package.json +0 -0
- /package/lib/{typescript/module → module}/package.json +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/ReanimatedTopTab/AnimationHelper.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/ReanimatedTopTab/ReanimatedTabView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/ReanimatedTopTab/types.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/elements/TabBarBaseComponent.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/elements/TabBarLabelBaseComponent.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/wrappers/ScreenWrapper.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/navigator/createReanimatedTopTabNavigator.d.ts +0 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ContextHooks = void 0;
|
|
7
|
+
var _reactNativeReanimated = require("react-native-reanimated");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _reactNativeGestureHandler = require("react-native-gesture-handler");
|
|
10
|
+
var _lodash = require("lodash");
|
|
11
|
+
var _Context = require("./Context.helpers");
|
|
12
|
+
/**
|
|
13
|
+
* Hook to reset the scroll offset for the approaching screen in a tab navigation context.
|
|
14
|
+
*
|
|
15
|
+
* @param {Object} params - The parameters for configuring the scroll offset reset.
|
|
16
|
+
* @param {ReanimatedTopTabNavigation.ContextType["context"]} params.context - The context containing navigation and screen information.
|
|
17
|
+
* @param {ReanimatedTopTabNavigation.ContextType["transformationX"]} params.transformationX - The horizontal transformation value used in animations.
|
|
18
|
+
* @param {ReanimatedTopTabNavigation.ContextType["currentYPosition"]} params.currentYPosition - The current vertical scroll position.
|
|
19
|
+
*
|
|
20
|
+
* The hook is responsible for resetting the vertical scroll offset of the "approaching" screen within a tabbed navigation interface,
|
|
21
|
+
* ensuring a smooth user experience by resetting the scroll position to the top under certain conditions.
|
|
22
|
+
* When the user swipes across tabs, it checks if the approaching screen has a non-zero scroll offset and resets it
|
|
23
|
+
* if the current screen is at the top position.
|
|
24
|
+
*/
|
|
25
|
+
const useResetApproachingScreenScrollOffset = ({
|
|
26
|
+
context,
|
|
27
|
+
transformationX,
|
|
28
|
+
currentYPosition
|
|
29
|
+
}) => {
|
|
30
|
+
const screenOffsets = (0, _reactNativeReanimated.useDerivedValue)(() => Object.values(context.screen.properties).map(({
|
|
31
|
+
scrollY
|
|
32
|
+
}) => scrollY.value));
|
|
33
|
+
const resetApproachingScreenOffset = (index, shouldReset) => {
|
|
34
|
+
if (shouldReset) {
|
|
35
|
+
const {
|
|
36
|
+
scrollTo
|
|
37
|
+
} = context.screen.getRef(context.route.getKeyForIndex(index)).current ?? {
|
|
38
|
+
scrollTo: () => {}
|
|
39
|
+
};
|
|
40
|
+
//NOTE: use reanimated scrollTo does not work
|
|
41
|
+
scrollTo({
|
|
42
|
+
y: 0,
|
|
43
|
+
animated: false
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
(0, _reactNativeReanimated.useAnimatedReaction)(() => transformationX.value, (current, previous) => {
|
|
48
|
+
const approachingIndex = _Context.ContextHelpers.getTargetIndex(current, previous);
|
|
49
|
+
const approachingScreenOffset = screenOffsets.value[approachingIndex] ?? -1;
|
|
50
|
+
(0, _reactNativeReanimated.runOnJS)(resetApproachingScreenOffset)(approachingIndex, approachingScreenOffset > 0 && currentYPosition.value === 0);
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Custom hook to prepare a key map for Tab Navigation.
|
|
56
|
+
*
|
|
57
|
+
* @param {Object} params - The parameters for the hook.
|
|
58
|
+
* @param {TabNavigationState<any>} params.state - The navigation state object containing route information.
|
|
59
|
+
* @returns {ReanimatedTopTabNavigation.TopTabContextProps['context']['route']} An object containing:
|
|
60
|
+
* - map: A mapping of tab indices to route keys.
|
|
61
|
+
* - getKeyForIndex: A function that takes an index and returns the corresponding route key.
|
|
62
|
+
* @throws Will throw an error if the key for the provided index does not exist.
|
|
63
|
+
*/
|
|
64
|
+
const usePrepareKeyMap = ({
|
|
65
|
+
state
|
|
66
|
+
}) => {
|
|
67
|
+
const indexToKeyMap = (0, _react.useRef)(state.routes.reduce((previousValue, currentValue, currentIndex) => ({
|
|
68
|
+
...previousValue,
|
|
69
|
+
[currentIndex]: currentValue.key
|
|
70
|
+
}), {}));
|
|
71
|
+
const getKeyForIndex = index => {
|
|
72
|
+
const key = indexToKeyMap.current[index];
|
|
73
|
+
if (!key) throw '[getKeyForIndex]: Key does not exist';
|
|
74
|
+
return key;
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
map: indexToKeyMap.current,
|
|
78
|
+
getKeyForIndex
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Prepares screen properties and manages scroll references for each route in the navigation state.
|
|
84
|
+
*
|
|
85
|
+
* @param {Object} params - The parameters for preparing the screen.
|
|
86
|
+
* @param {TabNavigationState<any>} params.state - The navigation state containing route information.
|
|
87
|
+
* @returns {Object} An object containing screen properties, and methods to set and get scroll references.
|
|
88
|
+
* @property {Object} properties - The current screen properties.
|
|
89
|
+
* @property {Function} setRef - Function to set the scroll reference for a specific route.
|
|
90
|
+
* @property {Function} getRef - Function to get the scroll reference of a specific route.
|
|
91
|
+
*/
|
|
92
|
+
const usePrepareScreen = ({
|
|
93
|
+
state
|
|
94
|
+
}) => {
|
|
95
|
+
const screenProperties = (0, _react.useRef)(state.routes.reduce((prev, route) => ({
|
|
96
|
+
...prev,
|
|
97
|
+
[route.key]: {
|
|
98
|
+
innerLayout: (0, _reactNativeReanimated.makeMutable)({
|
|
99
|
+
height: 0,
|
|
100
|
+
width: 0,
|
|
101
|
+
x: 0,
|
|
102
|
+
y: 0
|
|
103
|
+
}),
|
|
104
|
+
nativeGesture: _reactNativeGestureHandler.Gesture.Native(),
|
|
105
|
+
outerLayout: (0, _reactNativeReanimated.makeMutable)({
|
|
106
|
+
height: 0,
|
|
107
|
+
width: 0,
|
|
108
|
+
x: 0,
|
|
109
|
+
y: 0
|
|
110
|
+
}),
|
|
111
|
+
scrollY: (0, _reactNativeReanimated.makeMutable)(0),
|
|
112
|
+
scrollRef: {
|
|
113
|
+
current: null
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}), {}));
|
|
117
|
+
const setRef = (key, ref) => {
|
|
118
|
+
const newProperties = (0, _lodash.assign)({}, screenProperties.current[key], {
|
|
119
|
+
scrollRef: {
|
|
120
|
+
current: ref
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
screenProperties.current = (0, _lodash.assign)({}, screenProperties.current, {
|
|
124
|
+
[key]: newProperties
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
const getRef = key => {
|
|
128
|
+
const _ref = screenProperties.current[key]?.scrollRef;
|
|
129
|
+
if (!_ref) throw '[getRef]: Ref does not exist';
|
|
130
|
+
return _ref;
|
|
131
|
+
};
|
|
132
|
+
return {
|
|
133
|
+
properties: screenProperties.current,
|
|
134
|
+
setRef,
|
|
135
|
+
getRef
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Prepares the context required for top tab navigation.
|
|
141
|
+
*
|
|
142
|
+
* This function takes the current state of the navigation
|
|
143
|
+
* and prepares the necessary context properties such as `screen`
|
|
144
|
+
* and `route`, which are then used for navigation purposes.
|
|
145
|
+
*
|
|
146
|
+
* @param {Object} params - The parameters for preparing the context.
|
|
147
|
+
* @param {TabNavigationState<any>} params.state - The current state of the navigation.
|
|
148
|
+
*
|
|
149
|
+
* @returns {ReanimatedTopTabNavigation.TopTabContextProps['context']} The prepared context containing screen and route properties.
|
|
150
|
+
*/
|
|
151
|
+
const usePrepareContext = ({
|
|
152
|
+
state
|
|
153
|
+
}) => {
|
|
154
|
+
const screen = usePrepareScreen({
|
|
155
|
+
state
|
|
156
|
+
});
|
|
157
|
+
const route = usePrepareKeyMap({
|
|
158
|
+
state
|
|
159
|
+
});
|
|
160
|
+
return {
|
|
161
|
+
screen,
|
|
162
|
+
route
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Custom hook that handles the transformation of a header component based on tab changes, particularly
|
|
168
|
+
* for animations and configurations involving header behavior. Utilizes shared and derived values to
|
|
169
|
+
* manage the translation of the header on the Y-axis and maintain its position based on the specified
|
|
170
|
+
* configurations.
|
|
171
|
+
*
|
|
172
|
+
* @param {Object} params - The parameters object.
|
|
173
|
+
* @param {Array} params.config - An array of configuration settings to determine the header's transformation.
|
|
174
|
+
* @returns {Object} An object containing shared values for header transformations and positioning:
|
|
175
|
+
* - transformationY: The derived Y-axis transformation value for the header.
|
|
176
|
+
* - transformationX: The shared X-axis transformation value to be observed.
|
|
177
|
+
* - currentYPosition: The shared Y-axis position of the header.
|
|
178
|
+
* - headerHeight: The shared height value of the header.
|
|
179
|
+
*/
|
|
180
|
+
const useTransformHeaderOnTabChange = ({
|
|
181
|
+
config
|
|
182
|
+
}) => {
|
|
183
|
+
const headerHeight = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
184
|
+
const transformationY = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
185
|
+
const transformationX = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
186
|
+
const currentYPosition = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
187
|
+
|
|
188
|
+
//Hide header base on config
|
|
189
|
+
const inputRange = (0, _reactNativeReanimated.useDerivedValue)(() => config.map((_, idx) => idx), [config]);
|
|
190
|
+
const outputRange = (0, _reactNativeReanimated.useDerivedValue)(() => config.map(type => {
|
|
191
|
+
switch (type) {
|
|
192
|
+
case 'normal':
|
|
193
|
+
return 0;
|
|
194
|
+
case 'minimalized':
|
|
195
|
+
return -headerHeight.value;
|
|
196
|
+
default:
|
|
197
|
+
return 0;
|
|
198
|
+
}
|
|
199
|
+
}), [config]);
|
|
200
|
+
(0, _reactNativeReanimated.useAnimatedReaction)(() => transformationX.value, value => {
|
|
201
|
+
if (currentYPosition.value === -headerHeight.value) return;
|
|
202
|
+
transformationY.value = (0, _reactNativeReanimated.interpolate)(value, inputRange.value, outputRange.value, 'clamp');
|
|
203
|
+
});
|
|
204
|
+
return {
|
|
205
|
+
transformationY,
|
|
206
|
+
transformationX,
|
|
207
|
+
currentYPosition,
|
|
208
|
+
headerHeight
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
const ContextHooks = exports.ContextHooks = {
|
|
212
|
+
useResetApproachingScreenScrollOffset,
|
|
213
|
+
usePrepareContext,
|
|
214
|
+
useTransformHeaderOnTabChange
|
|
215
|
+
};
|
|
216
|
+
//# sourceMappingURL=Context.hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNativeReanimated","require","_react","_reactNativeGestureHandler","_lodash","_Context","useResetApproachingScreenScrollOffset","context","transformationX","currentYPosition","screenOffsets","useDerivedValue","Object","values","screen","properties","map","scrollY","value","resetApproachingScreenOffset","index","shouldReset","scrollTo","getRef","route","getKeyForIndex","current","y","animated","useAnimatedReaction","previous","approachingIndex","ContextHelpers","getTargetIndex","approachingScreenOffset","runOnJS","usePrepareKeyMap","state","indexToKeyMap","useRef","routes","reduce","previousValue","currentValue","currentIndex","key","usePrepareScreen","screenProperties","prev","innerLayout","makeMutable","height","width","x","nativeGesture","Gesture","Native","outerLayout","scrollRef","setRef","ref","newProperties","assign","_ref","usePrepareContext","useTransformHeaderOnTabChange","config","headerHeight","useSharedValue","transformationY","inputRange","_","idx","outputRange","type","interpolate","ContextHooks","exports"],"sourceRoot":"../../../src","sources":["context/Context.hooks.ts"],"mappings":";;;;;;AAAA,IAAAA,sB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GAAAC,OAAA,CAAAD,YAAA,GAAG;EAC1BtE,qCAAqC;EACrC0D,iBAAiB;EACjBC;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Provider = exports.Context = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNativeGestureHandler = require("react-native-gesture-handler");
|
|
9
|
+
var _reactNativeReanimated = require("react-native-reanimated");
|
|
10
|
+
var _Context = require("./Context.hooks");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
const Context = exports.Context = /*#__PURE__*/(0, _react.createContext)({});
|
|
13
|
+
const Provider = exports.Provider = /*#__PURE__*/(0, _react.memo)(({
|
|
14
|
+
children,
|
|
15
|
+
config,
|
|
16
|
+
context
|
|
17
|
+
}) => {
|
|
18
|
+
const gestureEnabled = (0, _reactNativeReanimated.useSharedValue)(true);
|
|
19
|
+
const currentScreenIndex = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
20
|
+
const navHeight = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
21
|
+
const closeOffset = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
22
|
+
const topTabHeight = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
23
|
+
const topTabNativeGesture = (0, _react.useRef)(_reactNativeGestureHandler.Gesture.Native()).current;
|
|
24
|
+
const {
|
|
25
|
+
transformationX,
|
|
26
|
+
transformationY,
|
|
27
|
+
currentYPosition,
|
|
28
|
+
headerHeight
|
|
29
|
+
} = _Context.ContextHooks.useTransformHeaderOnTabChange({
|
|
30
|
+
config
|
|
31
|
+
});
|
|
32
|
+
_Context.ContextHooks.useResetApproachingScreenScrollOffset({
|
|
33
|
+
currentYPosition,
|
|
34
|
+
transformationX,
|
|
35
|
+
context
|
|
36
|
+
});
|
|
37
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Context.Provider, {
|
|
38
|
+
value: {
|
|
39
|
+
closeOffset,
|
|
40
|
+
config,
|
|
41
|
+
currentScreenIndex,
|
|
42
|
+
currentYPosition,
|
|
43
|
+
gestureEnabled,
|
|
44
|
+
headerHeight,
|
|
45
|
+
navHeight,
|
|
46
|
+
topTabHeight,
|
|
47
|
+
topTabNativeGesture,
|
|
48
|
+
transformationX,
|
|
49
|
+
transformationY,
|
|
50
|
+
context
|
|
51
|
+
},
|
|
52
|
+
children: children({
|
|
53
|
+
closeOffset,
|
|
54
|
+
config,
|
|
55
|
+
currentScreenIndex,
|
|
56
|
+
currentYPosition,
|
|
57
|
+
gestureEnabled,
|
|
58
|
+
headerHeight,
|
|
59
|
+
navHeight,
|
|
60
|
+
topTabHeight,
|
|
61
|
+
topTabNativeGesture,
|
|
62
|
+
transformationX,
|
|
63
|
+
transformationY,
|
|
64
|
+
context
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=Context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNativeGestureHandler","_reactNativeReanimated","_Context","_jsxRuntime","Context","exports","createContext","Provider","memo","children","config","context","gestureEnabled","useSharedValue","currentScreenIndex","navHeight","closeOffset","topTabHeight","topTabNativeGesture","useRef","Gesture","Native","current","transformationX","transformationY","currentYPosition","headerHeight","ContextHooks","useTransformHeaderOnTabChange","useResetApproachingScreenScrollOffset","jsx","value"],"sourceRoot":"../../../src","sources":["context/Context.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,0BAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAA+C,IAAAI,WAAA,GAAAJ,OAAA;AAExC,MAAMK,OAAO,GAAAC,OAAA,CAAAD,OAAA,gBAAG,IAAAE,oBAAa,EAClC,C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CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useHeader = void 0;
|
|
7
|
+
var _useTabContext = require("./useTabContext");
|
|
8
|
+
var _reactNativeReanimated = require("react-native-reanimated");
|
|
9
|
+
const useHeader = () => {
|
|
10
|
+
const {
|
|
11
|
+
headerHeight,
|
|
12
|
+
transformationX,
|
|
13
|
+
transformationY
|
|
14
|
+
} = (0, _useTabContext.useTabContext)();
|
|
15
|
+
const hideHeader = () => {
|
|
16
|
+
transformationX.value = (0, _reactNativeReanimated.withTiming)(-headerHeight.value);
|
|
17
|
+
};
|
|
18
|
+
const defaultStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
19
|
+
transform: [{
|
|
20
|
+
translateY: (0, _reactNativeReanimated.interpolate)(transformationY.value, [0, -headerHeight.value], [0, -headerHeight.value], 'clamp')
|
|
21
|
+
}],
|
|
22
|
+
zIndex: -1
|
|
23
|
+
}));
|
|
24
|
+
return {
|
|
25
|
+
hideHeader,
|
|
26
|
+
defaultStyle
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
exports.useHeader = useHeader;
|
|
30
|
+
//# sourceMappingURL=useHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_useTabContext","require","_reactNativeReanimated","useHeader","headerHeight","transformationX","transformationY","useTabContext","hideHeader","value","withTiming","defaultStyle","useAnimatedStyle","transform","translateY","interpolate","zIndex","exports"],"sourceRoot":"../../../src","sources":["hooks/useHeader.ts"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAMO,MAAME,SAAS,GAAGA,CAAA,KAAM;EAC7B,MAAM;IAAEC,YAAY;IAAEC,eAAe;IAAEC;EAAgB,CAAC,GAAG,IAAAC,4BAAa,EAAC,CAAC;EAE1E,MAAMC,UAAU,GAAGA,CAAA,KAAM;IACvBH,eAAe,CAACI,KAAK,GAAG,IAAAC,iCAAU,EAAC,CAACN,YAAY,CAACK,KAAK,CAAC;EACzD,CAAC;EAED,MAAME,YAAY,GAAG,IAAAC,uCAAgB,EAAC,OAAO;IAC3CC,SAAS,EAAE,CACT;MACEC,UAAU,EAAE,IAAAC,kCAAW,EACrBT,eAAe,CAACG,KAAK,EACrB,CAAC,CAAC,EAAE,CAACL,YAAY,CAACK,KAAK,CAAC,EACxB,CAAC,CAAC,EAAE,CAACL,YAAY,CAACK,KAAK,CAAC,EACxB,OACF;IACF,CAAC,CACF;IACDO,MAAM,EAAE,CAAC;EACX,CAAC,CAAC,CAAC;EAEH,OAAO;IAAER,UAAU;IAAEG;EAAa,CAAC;AACrC,CAAC;AAACM,OAAA,CAAAd,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useScreenGesture = void 0;
|
|
7
|
+
var _native = require("@react-navigation/native");
|
|
8
|
+
var _useTabContext = require("./useTabContext");
|
|
9
|
+
const useScreenGesture = () => {
|
|
10
|
+
const {
|
|
11
|
+
key
|
|
12
|
+
} = (0, _native.useRoute)();
|
|
13
|
+
const {
|
|
14
|
+
context
|
|
15
|
+
} = (0, _useTabContext.useTabContext)();
|
|
16
|
+
const nativeRef = context.screen.properties[key]?.nativeGesture;
|
|
17
|
+
if (!nativeRef) throw 'GestureRef does not exist for this route';
|
|
18
|
+
return nativeRef;
|
|
19
|
+
};
|
|
20
|
+
exports.useScreenGesture = useScreenGesture;
|
|
21
|
+
//# sourceMappingURL=useScreenGesture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_native","require","_useTabContext","useScreenGesture","key","useRoute","context","useTabContext","nativeRef","screen","properties","nativeGesture","exports"],"sourceRoot":"../../../src","sources":["hooks/useScreenGesture.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAEO,MAAME,gBAAgB,GAAGA,CAAA,KAAM;EACpC,MAAM;IAAEC;EAAI,CAAC,GAAG,IAAAC,gBAAQ,EAAC,CAAC;EAC1B,MAAM;IAAEC;EAAQ,CAAC,GAAG,IAAAC,4BAAa,EAAC,CAAC;EAEnC,MAAMC,SAAS,GAAGF,OAAO,CAACG,MAAM,CAACC,UAAU,CAACN,GAAG,CAAC,EAAEO,aAAa;EAE/D,IAAI,CAACH,SAAS,EAAE,MAAM,0CAA0C;EAEhE,OAAOA,SAAS;AAClB,CAAC;AAACI,OAAA,CAAAT,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useScreenProperties = void 0;
|
|
7
|
+
var _native = require("@react-navigation/native");
|
|
8
|
+
var _useTabContext = require("./useTabContext");
|
|
9
|
+
const useScreenProperties = () => {
|
|
10
|
+
const {
|
|
11
|
+
key
|
|
12
|
+
} = (0, _native.useRoute)();
|
|
13
|
+
const {
|
|
14
|
+
context
|
|
15
|
+
} = (0, _useTabContext.useTabContext)();
|
|
16
|
+
const screen = context.screen.properties[key];
|
|
17
|
+
if (!screen) throw 'No screen properties registered for this route';
|
|
18
|
+
return screen;
|
|
19
|
+
};
|
|
20
|
+
exports.useScreenProperties = useScreenProperties;
|
|
21
|
+
//# sourceMappingURL=useScreenProperties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_native","require","_useTabContext","useScreenProperties","key","useRoute","context","useTabContext","screen","properties","exports"],"sourceRoot":"../../../src","sources":["hooks/useScreenProperties.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAEO,MAAME,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAM;IAAEC;EAAI,CAAC,GAAG,IAAAC,gBAAQ,EAAC,CAAC;EAC1B,MAAM;IAAEC;EAAQ,CAAC,GAAG,IAAAC,4BAAa,EAAC,CAAC;EACnC,MAAMC,MAAM,GAAGF,OAAO,CAACE,MAAM,CAACC,UAAU,CAACL,GAAG,CAAC;EAC7C,IAAI,CAACI,MAAM,EAAE,MAAM,gDAAgD;EAEnE,OAAOA,MAAM;AACf,CAAC;AAACE,OAAA,CAAAP,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -3,40 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.useScreenScrollable = void 0;
|
|
7
7
|
var _native = require("@react-navigation/native");
|
|
8
|
-
var _TabContext = require("../context/TabContext.js");
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var React = _react;
|
|
11
|
-
var _reactNativeReanimated = require("react-native-reanimated");
|
|
12
|
-
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
13
8
|
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
10
|
+
var _useTabContext = require("./useTabContext");
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
14
12
|
var _elements = require("@react-navigation/elements");
|
|
13
|
+
var _reactNativeReanimated = require("react-native-reanimated");
|
|
14
|
+
var _useScreenProperties = require("./useScreenProperties");
|
|
15
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
-
const useTabContext = () => {
|
|
18
|
-
if (__DEV__) {
|
|
19
|
-
const stack = new Error().stack;
|
|
20
|
-
const isOutsideLibrary = stack && !stack.includes('react-navigation-reanimated-top-tabs');
|
|
21
|
-
if (isOutsideLibrary) {
|
|
22
|
-
console.warn('[react-navigation-reanimated-top-tabs]: You are directly using the tab context, which may lead to unexpected behavior. Please use the provided hooks or API for better stability.');
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return (0, _react.useContext)(_TabContext.Context);
|
|
26
|
-
};
|
|
27
|
-
exports.useTabContext = useTabContext;
|
|
28
|
-
const useScreenGesture = () => {
|
|
29
|
-
const {
|
|
30
|
-
key
|
|
31
|
-
} = (0, _native.useRoute)();
|
|
32
|
-
const {
|
|
33
|
-
screenProperties
|
|
34
|
-
} = useTabContext();
|
|
35
|
-
const nativeRef = screenProperties[key]?.nativeGesture;
|
|
36
|
-
if (!nativeRef) throw 'GestureRef does not exist for this route';
|
|
37
|
-
return nativeRef;
|
|
38
|
-
};
|
|
39
|
-
exports.useScreenGesture = useScreenGesture;
|
|
40
17
|
const useScreenScrollable = () => {
|
|
41
18
|
const {
|
|
42
19
|
key
|
|
@@ -52,24 +29,26 @@ const useScreenScrollable = () => {
|
|
|
52
29
|
currentYPosition,
|
|
53
30
|
gestureEnabled,
|
|
54
31
|
headerHeight,
|
|
55
|
-
|
|
32
|
+
context,
|
|
56
33
|
topTabHeight,
|
|
57
34
|
transformationY
|
|
58
|
-
} = useTabContext();
|
|
59
|
-
const
|
|
35
|
+
} = (0, _useTabContext.useTabContext)();
|
|
36
|
+
const screen = (0, _useScreenProperties.useScreenProperties)();
|
|
37
|
+
const navigationHeader = React.useContext(_elements.HeaderHeightContext) ?? top;
|
|
60
38
|
const animatedProps = (0, _reactNativeReanimated.useAnimatedProps)(() => ({
|
|
61
39
|
scrollEnabled: !gestureEnabled.value || currentYPosition.value === -headerHeight.value
|
|
62
40
|
}));
|
|
63
41
|
const onScroll = (0, _reactNativeReanimated.useAnimatedScrollHandler)(({
|
|
64
42
|
contentOffset
|
|
65
43
|
}) => {
|
|
66
|
-
const scrollPosition =
|
|
44
|
+
const scrollPosition = context.screen.properties[key]?.scrollY;
|
|
67
45
|
if (!scrollPosition) throw 'ScrollPosition property does not exist for this route';
|
|
68
46
|
scrollPosition.value = contentOffset.y;
|
|
69
47
|
});
|
|
70
48
|
const oppositeHeaderState = (0, _reactNativeReanimated.useDerivedValue)(() => transformationY.value >= 0 ? headerHeight.value : 0);
|
|
49
|
+
const difference = (0, _reactNativeReanimated.useDerivedValue)(() => Math.abs(screen.outerLayout.value.height - screen.innerLayout.value.height));
|
|
71
50
|
const style = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
72
|
-
minHeight: height -
|
|
51
|
+
minHeight: height - topTabHeight.value - oppositeHeaderState.value - navigationHeader - difference.value
|
|
73
52
|
}));
|
|
74
53
|
return {
|
|
75
54
|
animatedProps,
|
|
@@ -82,52 +61,4 @@ const useScreenScrollable = () => {
|
|
|
82
61
|
};
|
|
83
62
|
};
|
|
84
63
|
exports.useScreenScrollable = useScreenScrollable;
|
|
85
|
-
|
|
86
|
-
const {
|
|
87
|
-
key
|
|
88
|
-
} = (0, _native.useRoute)();
|
|
89
|
-
const {
|
|
90
|
-
screenProperties
|
|
91
|
-
} = useTabContext();
|
|
92
|
-
const screen = screenProperties[key];
|
|
93
|
-
if (!screen) throw 'No screen properties registered for this route';
|
|
94
|
-
return screen;
|
|
95
|
-
};
|
|
96
|
-
exports.useScreenProperties = useScreenProperties;
|
|
97
|
-
const useHeader = () => {
|
|
98
|
-
const {
|
|
99
|
-
headerHeight,
|
|
100
|
-
transformationX
|
|
101
|
-
} = useTabContext();
|
|
102
|
-
const hideHeader = () => {
|
|
103
|
-
transformationX.value = (0, _reactNativeReanimated.withTiming)(-headerHeight.value);
|
|
104
|
-
};
|
|
105
|
-
return {
|
|
106
|
-
hideHeader
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
//TODO: make it private
|
|
111
|
-
exports.useHeader = useHeader;
|
|
112
|
-
const useScreenRefs = keys => {
|
|
113
|
-
const refs = {
|
|
114
|
-
current: keys.reduce((prev, key) => ({
|
|
115
|
-
...prev,
|
|
116
|
-
[key]: {
|
|
117
|
-
current: null
|
|
118
|
-
}
|
|
119
|
-
}), {})
|
|
120
|
-
};
|
|
121
|
-
const setRef = (key, ref) => {
|
|
122
|
-
refs.current = {
|
|
123
|
-
...refs.current,
|
|
124
|
-
[key]: ref
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
return {
|
|
128
|
-
setRef,
|
|
129
|
-
refs
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
exports.useScreenRefs = useScreenRefs;
|
|
133
|
-
//# sourceMappingURL=Tab.hooks.js.map
|
|
64
|
+
//# sourceMappingURL=useScreenScrollable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_native","require","_reactNative","_reactNativeSafeAreaContext","_useTabContext","React","_interopRequireWildcard","_elements","_reactNativeReanimated","_useScreenProperties","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","useScreenScrollable","key","useRoute","height","useWindowDimensions","bottom","top","useSafeAreaInsets","currentYPosition","gestureEnabled","headerHeight","context","topTabHeight","transformationY","useTabContext","screen","useScreenProperties","navigationHeader","useContext","HeaderHeightContext","animatedProps","useAnimatedProps","scrollEnabled","value","onScroll","useAnimatedScrollHandler","contentOffset","scrollPosition","properties","scrollY","y","oppositeHeaderState","useDerivedValue","difference","Math","abs","outerLayout","innerLayout","style","useAnimatedStyle","minHeight","bounces","contentContainerStyle","paddingBottom","exports"],"sourceRoot":"../../../src","sources":["hooks/useScreenScrollable.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAC,uBAAA,CAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,sBAAA,GAAAP,OAAA;AAOA,IAAAQ,oBAAA,GAAAR,OAAA;AAA4D,SAAAS,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBA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AAM,uDAAuD;IAC/DA,cAAc,CAACJ,KAAK,GAAGG,aAAa,CAACI,CAAC;EACxC,CAAC,CAAC;EAEF,MAAMC,mBAAmB,GAAG,IAAAC,sCAAe,EAAC,MAC1CnB,eAAe,CAACU,KAAK,IAAI,CAAC,GAAGb,YAAY,CAACa,KAAK,GAAG,CACpD,CAAC;EAED,MAAMU,UAAU,GAAG,IAAAD,sCAAe,EAAC,MACjCE,IAAI,CAACC,GAAG,CAACpB,MAAM,CAACqB,WAAW,CAACb,KAAK,CAACpB,MAAM,GAAGY,MAAM,CAACsB,WAAW,CAACd,KAAK,CAACpB,MAAM,CAC5E,CAAC;EAED,MAAMmC,KAAK,GAAG,IAAAC,uCAAgB,EAAC,OAAO;IACpCC,SAAS,EACPrC,MAAM,GACNS,YAAY,CAACW,KAAK,GAClBQ,mBAAmB,CAACR,KAAK,GACzBN,gBAAgB,GAChBgB,UAAU,CAACV;EACf,CAAC,CAAC,CAAC;EAEH,OAAO;IACLH,aAAa;IACbqB,OAAO,EAAE,KAAK;IACdC,qBAAqB,EAAE;MAAEC,aAAa,EAAEtC;IAAO,CAAC;IAChDmB,QAAQ;IACRc;EACF,CAAC;AACH,CAAC;AAACM,OAAA,CAAA5C,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useTabContext = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _Context = require("../context/Context");
|
|
9
|
+
const useTabContext = () => (0, _react.useContext)(_Context.Context);
|
|
10
|
+
exports.useTabContext = useTabContext;
|
|
11
|
+
//# sourceMappingURL=useTabContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_Context","useTabContext","useContext","Context","exports"],"sourceRoot":"../../../src","sources":["hooks/useTabContext.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,aAAa,GAAGA,CAAA,KAAM,IAAAC,iBAAU,EAACC,gBAAO,CAAC;AAACC,OAAA,CAAAH,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useTabOffset = void 0;
|
|
7
|
+
var _useTabContext = require("./useTabContext");
|
|
8
|
+
var _reactNativeReanimated = require("react-native-reanimated");
|
|
9
|
+
// returns read-only property
|
|
10
|
+
|
|
11
|
+
const useTabOffset = () => {
|
|
12
|
+
const {
|
|
13
|
+
transformationX
|
|
14
|
+
} = (0, _useTabContext.useTabContext)();
|
|
15
|
+
return (0, _reactNativeReanimated.useDerivedValue)(() => transformationX.value);
|
|
16
|
+
};
|
|
17
|
+
exports.useTabOffset = useTabOffset;
|
|
18
|
+
//# sourceMappingURL=useTabOffset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_useTabContext","require","_reactNativeReanimated","useTabOffset","transformationX","useTabContext","useDerivedValue","value","exports"],"sourceRoot":"../../../src","sources":["hooks/useTabOffset.ts"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAFA;;AAIO,MAAME,YAAY,GAAGA,CAAA,KAAM;EAChC,MAAM;IAAEC;EAAgB,CAAC,GAAG,IAAAC,4BAAa,EAAC,CAAC;EAC3C,OAAO,IAAAC,sCAAe,EAAC,MAAMF,eAAe,CAACG,KAAK,CAAC;AACrD,CAAC;AAACC,OAAA,CAAAL,YAAA,GAAAA,YAAA","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -10,18 +10,32 @@ Object.defineProperty(exports, "createReanimatedTopTabNavigator", {
|
|
|
10
10
|
return _createReanimatedTopTabNavigator.createReanimatedTopTabNavigator;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
var _ScrollView = require("./components/wrappers/ScrollView
|
|
14
|
-
var _ScreenWrapper = require("./components/wrappers/ScreenWrapper
|
|
15
|
-
var _TabBarBaseComponent = require("./components/elements/TabBarBaseComponent
|
|
16
|
-
var _TabBarLabelBaseComponent = require("./components/elements/TabBarLabelBaseComponent
|
|
17
|
-
var
|
|
18
|
-
var
|
|
13
|
+
var _ScrollView = require("./components/wrappers/ScrollView");
|
|
14
|
+
var _ScreenWrapper = require("./components/wrappers/ScreenWrapper");
|
|
15
|
+
var _TabBarBaseComponent = require("./components/elements/TabBarBaseComponent");
|
|
16
|
+
var _TabBarLabelBaseComponent = require("./components/elements/TabBarLabelBaseComponent");
|
|
17
|
+
var _react = require("react");
|
|
18
|
+
var _Warning = require("./services/Warning.service");
|
|
19
|
+
var _useTabContext2 = require("./hooks/useTabContext");
|
|
20
|
+
var _useTabOffset = require("./hooks/useTabOffset");
|
|
21
|
+
var _useScreenGesture = require("./hooks/useScreenGesture");
|
|
22
|
+
var _useScreenScrollable = require("./hooks/useScreenScrollable");
|
|
23
|
+
var _useScreenProperties = require("./hooks/useScreenProperties");
|
|
24
|
+
var _useHeader = require("./hooks/useHeader");
|
|
25
|
+
var _createReanimatedTopTabNavigator = require("./navigator/createReanimatedTopTabNavigator");
|
|
26
|
+
const _useTabContext = () => {
|
|
27
|
+
(0, _react.useEffect)(() => {
|
|
28
|
+
_Warning.WarningService.warn();
|
|
29
|
+
}, []);
|
|
30
|
+
return (0, _useTabContext2.useTabContext)();
|
|
31
|
+
};
|
|
19
32
|
const TabHooks = exports.TabHooks = {
|
|
20
|
-
useHeader:
|
|
21
|
-
useScreenProperties:
|
|
22
|
-
useScreenScrollable:
|
|
23
|
-
useScreenGesture:
|
|
24
|
-
useTabContext:
|
|
33
|
+
useHeader: _useHeader.useHeader,
|
|
34
|
+
useScreenProperties: _useScreenProperties.useScreenProperties,
|
|
35
|
+
useScreenScrollable: _useScreenScrollable.useScreenScrollable,
|
|
36
|
+
useScreenGesture: _useScreenGesture.useScreenGesture,
|
|
37
|
+
useTabContext: _useTabContext,
|
|
38
|
+
useTabOffset: _useTabOffset.useTabOffset
|
|
25
39
|
};
|
|
26
40
|
const Tab = exports.Tab = {
|
|
27
41
|
ScrollView: _ScrollView.ScrollView,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_ScrollView","require","_ScreenWrapper","_TabBarBaseComponent","_TabBarLabelBaseComponent","
|
|
1
|
+
{"version":3,"names":["_ScrollView","require","_ScreenWrapper","_TabBarBaseComponent","_TabBarLabelBaseComponent","_react","_Warning","_useTabContext2","_useTabOffset","_useScreenGesture","_useScreenScrollable","_useScreenProperties","_useHeader","_createReanimatedTopTabNavigator","_useTabContext","useEffect","WarningService","warn","useTabContext","TabHooks","exports","useHeader","useScreenProperties","useScreenScrollable","useScreenGesture","useTabOffset","Tab","ScrollView","ScreenWrapper","TabBarBaseComponent","TabBarLabelBaseComponent"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,yBAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,iBAAA,GAAAR,OAAA;AACA,IAAAS,oBAAA,GAAAT,OAAA;AACA,IAAAU,oBAAA,GAAAV,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AAGA,IAAAY,gCAAA,GAAAZ,OAAA;AAEA,MAAMa,cAAc,GAAGA,CAAA,KAAM;EAC3B,IAAAC,gBAAS,EAAC,MAAM;IACdC,uBAAc,CAACC,IAAI,CAAC,CAAC;EACvB,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAAC,6BAAa,EAAC,CAAC;AACxB,CAAC;AAEM,MAAMC,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG;EACtBE,SAAS,EAATA,oBAAS;EACTC,mBAAmB,EAAnBA,wCAAmB;EACnBC,mBAAmB,EAAnBA,wCAAmB;EACnBC,gBAAgB,EAAhBA,kCAAgB;EAChBN,aAAa,EAAEJ,cAAc;EAC7BW,YAAY,EAAZA;AACF,CAAC;AAEM,MAAMC,GAAG,GAAAN,OAAA,CAAAM,GAAA,GAAG;EACjBC,UAAU,EAAVA,sBAAU;EACVC,aAAa,EAAbA,4BAAa;EACbC,mBAAmB,EAAnBA,wCAAmB;EACnBC,wBAAwB,EAAxBA;AACF,CAAC","ignoreList":[]}
|