react-navigation-reanimated-top-tabs 0.2.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/README.md +5 -17
- 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/useScreenScrollable.js +64 -0
- 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 +34 -80
- 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 +33 -8
- 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/{module/src → src}/components/elements/TabBarBaseComponent.d.ts +1 -2
- package/lib/typescript/src/components/elements/TabBarBaseComponent.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src → src}/components/elements/TabBarLabelBaseComponent.d.ts +1 -2
- 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/TopTabContext.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/src/index.d.ts +45 -0
- 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 +7 -3
- package/src/components/elements/TabBarLabelBaseComponent.tsx +4 -3
- 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 +34 -10
- 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/TopTabContext.hooks.js +0 -48
- package/lib/commonjs/context/TopTabContext.hooks.js.map +0 -1
- package/lib/commonjs/context/TopTabContext.js +0 -86
- package/lib/commonjs/context/TopTabContext.js.map +0 -1
- package/lib/commonjs/hooks/TopTab.hooks.js +0 -120
- package/lib/commonjs/hooks/TopTab.hooks.js.map +0 -1
- package/lib/module/context/TopTabContext.hooks.js +0 -44
- package/lib/module/context/TopTabContext.hooks.js.map +0 -1
- package/lib/module/context/TopTabContext.js +0 -82
- package/lib/module/context/TopTabContext.js.map +0 -1
- package/lib/module/hooks/TopTab.hooks.js +0 -110
- package/lib/module/hooks/TopTab.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 +0 -24
- 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/TopTabContext.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/context/TopTabContext.hooks.d.ts +0 -5
- package/lib/typescript/commonjs/src/context/TopTabContext.hooks.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/hooks/TopTab.hooks.d.ts +0 -33
- package/lib/typescript/commonjs/src/hooks/TopTab.hooks.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/index.d.ts +0 -10
- 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.map +0 -1
- package/lib/typescript/module/src/components/elements/TabBarLabelBaseComponent.d.ts +0 -8
- 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/TopTabContext.d.ts +0 -4
- package/lib/typescript/module/src/context/TopTabContext.d.ts.map +0 -1
- package/lib/typescript/module/src/context/TopTabContext.hooks.d.ts +0 -5
- package/lib/typescript/module/src/context/TopTabContext.hooks.d.ts.map +0 -1
- package/lib/typescript/module/src/hooks/TopTab.hooks.d.ts +0 -33
- package/lib/typescript/module/src/hooks/TopTab.hooks.d.ts.map +0 -1
- package/lib/typescript/module/src/index.d.ts +0 -10
- 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/TopTabContext.hooks.ts +0 -55
- package/src/context/TopTabContext.tsx +0 -115
- package/src/hooks/TopTab.hooks.ts +0 -112
- /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/wrappers/ScreenWrapper.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/navigator/createReanimatedTopTabNavigator.d.ts +0 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { interpolate, makeMutable, runOnJS, useAnimatedReaction, useDerivedValue, useSharedValue } from 'react-native-reanimated';
|
|
4
|
+
import { useRef } from 'react';
|
|
5
|
+
import { Gesture } from 'react-native-gesture-handler';
|
|
6
|
+
import { assign } from 'lodash';
|
|
7
|
+
import { ContextHelpers } from './Context.helpers';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Hook to reset the scroll offset for the approaching screen in a tab navigation context.
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} params - The parameters for configuring the scroll offset reset.
|
|
13
|
+
* @param {ReanimatedTopTabNavigation.ContextType["context"]} params.context - The context containing navigation and screen information.
|
|
14
|
+
* @param {ReanimatedTopTabNavigation.ContextType["transformationX"]} params.transformationX - The horizontal transformation value used in animations.
|
|
15
|
+
* @param {ReanimatedTopTabNavigation.ContextType["currentYPosition"]} params.currentYPosition - The current vertical scroll position.
|
|
16
|
+
*
|
|
17
|
+
* The hook is responsible for resetting the vertical scroll offset of the "approaching" screen within a tabbed navigation interface,
|
|
18
|
+
* ensuring a smooth user experience by resetting the scroll position to the top under certain conditions.
|
|
19
|
+
* When the user swipes across tabs, it checks if the approaching screen has a non-zero scroll offset and resets it
|
|
20
|
+
* if the current screen is at the top position.
|
|
21
|
+
*/
|
|
22
|
+
const useResetApproachingScreenScrollOffset = ({
|
|
23
|
+
context,
|
|
24
|
+
transformationX,
|
|
25
|
+
currentYPosition
|
|
26
|
+
}) => {
|
|
27
|
+
const screenOffsets = useDerivedValue(() => Object.values(context.screen.properties).map(({
|
|
28
|
+
scrollY
|
|
29
|
+
}) => scrollY.value));
|
|
30
|
+
const resetApproachingScreenOffset = (index, shouldReset) => {
|
|
31
|
+
if (shouldReset) {
|
|
32
|
+
const {
|
|
33
|
+
scrollTo
|
|
34
|
+
} = context.screen.getRef(context.route.getKeyForIndex(index)).current ?? {
|
|
35
|
+
scrollTo: () => {}
|
|
36
|
+
};
|
|
37
|
+
//NOTE: use reanimated scrollTo does not work
|
|
38
|
+
scrollTo({
|
|
39
|
+
y: 0,
|
|
40
|
+
animated: false
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
useAnimatedReaction(() => transformationX.value, (current, previous) => {
|
|
45
|
+
const approachingIndex = ContextHelpers.getTargetIndex(current, previous);
|
|
46
|
+
const approachingScreenOffset = screenOffsets.value[approachingIndex] ?? -1;
|
|
47
|
+
runOnJS(resetApproachingScreenOffset)(approachingIndex, approachingScreenOffset > 0 && currentYPosition.value === 0);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Custom hook to prepare a key map for Tab Navigation.
|
|
53
|
+
*
|
|
54
|
+
* @param {Object} params - The parameters for the hook.
|
|
55
|
+
* @param {TabNavigationState<any>} params.state - The navigation state object containing route information.
|
|
56
|
+
* @returns {ReanimatedTopTabNavigation.TopTabContextProps['context']['route']} An object containing:
|
|
57
|
+
* - map: A mapping of tab indices to route keys.
|
|
58
|
+
* - getKeyForIndex: A function that takes an index and returns the corresponding route key.
|
|
59
|
+
* @throws Will throw an error if the key for the provided index does not exist.
|
|
60
|
+
*/
|
|
61
|
+
const usePrepareKeyMap = ({
|
|
62
|
+
state
|
|
63
|
+
}) => {
|
|
64
|
+
const indexToKeyMap = useRef(state.routes.reduce((previousValue, currentValue, currentIndex) => ({
|
|
65
|
+
...previousValue,
|
|
66
|
+
[currentIndex]: currentValue.key
|
|
67
|
+
}), {}));
|
|
68
|
+
const getKeyForIndex = index => {
|
|
69
|
+
const key = indexToKeyMap.current[index];
|
|
70
|
+
if (!key) throw '[getKeyForIndex]: Key does not exist';
|
|
71
|
+
return key;
|
|
72
|
+
};
|
|
73
|
+
return {
|
|
74
|
+
map: indexToKeyMap.current,
|
|
75
|
+
getKeyForIndex
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Prepares screen properties and manages scroll references for each route in the navigation state.
|
|
81
|
+
*
|
|
82
|
+
* @param {Object} params - The parameters for preparing the screen.
|
|
83
|
+
* @param {TabNavigationState<any>} params.state - The navigation state containing route information.
|
|
84
|
+
* @returns {Object} An object containing screen properties, and methods to set and get scroll references.
|
|
85
|
+
* @property {Object} properties - The current screen properties.
|
|
86
|
+
* @property {Function} setRef - Function to set the scroll reference for a specific route.
|
|
87
|
+
* @property {Function} getRef - Function to get the scroll reference of a specific route.
|
|
88
|
+
*/
|
|
89
|
+
const usePrepareScreen = ({
|
|
90
|
+
state
|
|
91
|
+
}) => {
|
|
92
|
+
const screenProperties = useRef(state.routes.reduce((prev, route) => ({
|
|
93
|
+
...prev,
|
|
94
|
+
[route.key]: {
|
|
95
|
+
innerLayout: makeMutable({
|
|
96
|
+
height: 0,
|
|
97
|
+
width: 0,
|
|
98
|
+
x: 0,
|
|
99
|
+
y: 0
|
|
100
|
+
}),
|
|
101
|
+
nativeGesture: Gesture.Native(),
|
|
102
|
+
outerLayout: makeMutable({
|
|
103
|
+
height: 0,
|
|
104
|
+
width: 0,
|
|
105
|
+
x: 0,
|
|
106
|
+
y: 0
|
|
107
|
+
}),
|
|
108
|
+
scrollY: makeMutable(0),
|
|
109
|
+
scrollRef: {
|
|
110
|
+
current: null
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}), {}));
|
|
114
|
+
const setRef = (key, ref) => {
|
|
115
|
+
const newProperties = assign({}, screenProperties.current[key], {
|
|
116
|
+
scrollRef: {
|
|
117
|
+
current: ref
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
screenProperties.current = assign({}, screenProperties.current, {
|
|
121
|
+
[key]: newProperties
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
const getRef = key => {
|
|
125
|
+
const _ref = screenProperties.current[key]?.scrollRef;
|
|
126
|
+
if (!_ref) throw '[getRef]: Ref does not exist';
|
|
127
|
+
return _ref;
|
|
128
|
+
};
|
|
129
|
+
return {
|
|
130
|
+
properties: screenProperties.current,
|
|
131
|
+
setRef,
|
|
132
|
+
getRef
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Prepares the context required for top tab navigation.
|
|
138
|
+
*
|
|
139
|
+
* This function takes the current state of the navigation
|
|
140
|
+
* and prepares the necessary context properties such as `screen`
|
|
141
|
+
* and `route`, which are then used for navigation purposes.
|
|
142
|
+
*
|
|
143
|
+
* @param {Object} params - The parameters for preparing the context.
|
|
144
|
+
* @param {TabNavigationState<any>} params.state - The current state of the navigation.
|
|
145
|
+
*
|
|
146
|
+
* @returns {ReanimatedTopTabNavigation.TopTabContextProps['context']} The prepared context containing screen and route properties.
|
|
147
|
+
*/
|
|
148
|
+
const usePrepareContext = ({
|
|
149
|
+
state
|
|
150
|
+
}) => {
|
|
151
|
+
const screen = usePrepareScreen({
|
|
152
|
+
state
|
|
153
|
+
});
|
|
154
|
+
const route = usePrepareKeyMap({
|
|
155
|
+
state
|
|
156
|
+
});
|
|
157
|
+
return {
|
|
158
|
+
screen,
|
|
159
|
+
route
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Custom hook that handles the transformation of a header component based on tab changes, particularly
|
|
165
|
+
* for animations and configurations involving header behavior. Utilizes shared and derived values to
|
|
166
|
+
* manage the translation of the header on the Y-axis and maintain its position based on the specified
|
|
167
|
+
* configurations.
|
|
168
|
+
*
|
|
169
|
+
* @param {Object} params - The parameters object.
|
|
170
|
+
* @param {Array} params.config - An array of configuration settings to determine the header's transformation.
|
|
171
|
+
* @returns {Object} An object containing shared values for header transformations and positioning:
|
|
172
|
+
* - transformationY: The derived Y-axis transformation value for the header.
|
|
173
|
+
* - transformationX: The shared X-axis transformation value to be observed.
|
|
174
|
+
* - currentYPosition: The shared Y-axis position of the header.
|
|
175
|
+
* - headerHeight: The shared height value of the header.
|
|
176
|
+
*/
|
|
177
|
+
const useTransformHeaderOnTabChange = ({
|
|
178
|
+
config
|
|
179
|
+
}) => {
|
|
180
|
+
const headerHeight = useSharedValue(0);
|
|
181
|
+
const transformationY = useSharedValue(0);
|
|
182
|
+
const transformationX = useSharedValue(0);
|
|
183
|
+
const currentYPosition = useSharedValue(0);
|
|
184
|
+
|
|
185
|
+
//Hide header base on config
|
|
186
|
+
const inputRange = useDerivedValue(() => config.map((_, idx) => idx), [config]);
|
|
187
|
+
const outputRange = useDerivedValue(() => config.map(type => {
|
|
188
|
+
switch (type) {
|
|
189
|
+
case 'normal':
|
|
190
|
+
return 0;
|
|
191
|
+
case 'minimalized':
|
|
192
|
+
return -headerHeight.value;
|
|
193
|
+
default:
|
|
194
|
+
return 0;
|
|
195
|
+
}
|
|
196
|
+
}), [config]);
|
|
197
|
+
useAnimatedReaction(() => transformationX.value, value => {
|
|
198
|
+
if (currentYPosition.value === -headerHeight.value) return;
|
|
199
|
+
transformationY.value = interpolate(value, inputRange.value, outputRange.value, 'clamp');
|
|
200
|
+
});
|
|
201
|
+
return {
|
|
202
|
+
transformationY,
|
|
203
|
+
transformationX,
|
|
204
|
+
currentYPosition,
|
|
205
|
+
headerHeight
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
export const ContextHooks = {
|
|
209
|
+
useResetApproachingScreenScrollOffset,
|
|
210
|
+
usePrepareContext,
|
|
211
|
+
useTransformHeaderOnTabChange
|
|
212
|
+
};
|
|
213
|
+
//# sourceMappingURL=Context.hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["interpolate","makeMutable","runOnJS","useAnimatedReaction","useDerivedValue","useSharedValue","useRef","Gesture","assign","ContextHelpers","useResetApproachingScreenScrollOffset","context","transformationX","currentYPosition","screenOffsets","Object","values","screen","properties","map","scrollY","value","resetApproachingScreenOffset","index","shouldReset","scrollTo","getRef","route","getKeyForIndex","current","y","animated","previous","approachingIndex","getTargetIndex","approachingScreenOffset","usePrepareKeyMap","state","indexToKeyMap","routes","reduce","previousValue","currentValue","currentIndex","key","usePrepareScreen","screenProperties","prev","innerLayout","height","width","x","nativeGesture","Native","outerLayout","scrollRef","setRef","ref","newProperties","_ref","usePrepareContext","useTransformHeaderOnTabChange","config","headerHeight","transformationY","inputRange","_","idx","outputRange","type","ContextHooks"],"sourceRoot":"../../../src","sources":["context/Context.hooks.ts"],"mappings":";;AAAA,SACEA,WAAW,EACXC,WAAW,EACXC,OAAO,EACPC,mBAAmB,EACnBC,eAAe,EACfC,cAAc,QACT,yBAAyB;AAEhC,SAASC,MAAM,QAAQ,OAAO;AAK9B,SAASC,OAAO,QAAQ,8BAA8B;AACtD,SAASC,MAAM,QAAQ,QAAQ;AAC/B,SAASC,cAAc,QAAQ,mBAAmB;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,qCAAqC,GAAGA,CA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AAC;EACzC,MAAMQ,gBAAgB,GAAGR,cAAc,CAAC,CAAC,CAAC;;EAE1C;EACA,MAAM4D,UAAU,GAAG7D,eAAe,CAChC,MAAM0D,MAAM,CAAC3C,GAAG,CAAC,CAAC+C,CAAC,EAAEC,GAAG,KAAKA,GAAG,CAAC,EACjC,CAACL,MAAM,CACT,CAAC;EAED,MAAMM,WAAW,GAAGhE,eAAe,CACjC,MACE0D,MAAM,CAAC3C,GAAG,CAAEkD,IAAI,IAAK;IACnB,QAAQA,IAAI;MACV,KAAK,QAAQ;QACX,OAAO,CAAC;MACV,KAAK,aAAa;QAChB,OAAO,CAACN,YAAY,CAAC1C,KAAK;MAC5B;QACE,OAAO,CAAC;IACZ;EACF,CAAC,CAAC,EACJ,CAACyC,MAAM,CACT,CAAC;EAED3D,mBAAmB,CACjB,MAAMS,eAAe,CAACS,KAAK,EAC1BA,KAAK,IAAK;IACT,IAAIR,gBAAgB,CAACQ,KAAK,KAAK,CAAC0C,YAAY,CAAC1C,KAAK,EAAE;IACpD2C,eAAe,CAAC3C,KAAK,GAAGrB,WAAW,CACjCqB,KAAK,EACL4C,UAAU,CAAC5C,KAAK,EAChB+C,WAAW,CAAC/C,KAAK,EACjB,OACF,CAAC;EACH,CACF,CAAC;EAED,OAAO;IAAE2C,eAAe;IAAEpD,eAAe;IAAEC,gBAAgB;IAAEkD;EAAa,CAAC;AAC7E,CAAC;AAED,OAAO,MAAMO,YAAY,GAAG;EAC1B5D,qCAAqC;EACrCkD,iBAAiB;EACjBC;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createContext, memo, useRef } from 'react';
|
|
4
|
+
import { Gesture } from 'react-native-gesture-handler';
|
|
5
|
+
import { useSharedValue } from 'react-native-reanimated';
|
|
6
|
+
import { ContextHooks } from './Context.hooks';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
export const Context = /*#__PURE__*/createContext({});
|
|
9
|
+
export const Provider = /*#__PURE__*/memo(({
|
|
10
|
+
children,
|
|
11
|
+
config,
|
|
12
|
+
context
|
|
13
|
+
}) => {
|
|
14
|
+
const gestureEnabled = useSharedValue(true);
|
|
15
|
+
const currentScreenIndex = useSharedValue(0);
|
|
16
|
+
const navHeight = useSharedValue(0);
|
|
17
|
+
const closeOffset = useSharedValue(0);
|
|
18
|
+
const topTabHeight = useSharedValue(0);
|
|
19
|
+
const topTabNativeGesture = useRef(Gesture.Native()).current;
|
|
20
|
+
const {
|
|
21
|
+
transformationX,
|
|
22
|
+
transformationY,
|
|
23
|
+
currentYPosition,
|
|
24
|
+
headerHeight
|
|
25
|
+
} = ContextHooks.useTransformHeaderOnTabChange({
|
|
26
|
+
config
|
|
27
|
+
});
|
|
28
|
+
ContextHooks.useResetApproachingScreenScrollOffset({
|
|
29
|
+
currentYPosition,
|
|
30
|
+
transformationX,
|
|
31
|
+
context
|
|
32
|
+
});
|
|
33
|
+
return /*#__PURE__*/_jsx(Context.Provider, {
|
|
34
|
+
value: {
|
|
35
|
+
closeOffset,
|
|
36
|
+
config,
|
|
37
|
+
currentScreenIndex,
|
|
38
|
+
currentYPosition,
|
|
39
|
+
gestureEnabled,
|
|
40
|
+
headerHeight,
|
|
41
|
+
navHeight,
|
|
42
|
+
topTabHeight,
|
|
43
|
+
topTabNativeGesture,
|
|
44
|
+
transformationX,
|
|
45
|
+
transformationY,
|
|
46
|
+
context
|
|
47
|
+
},
|
|
48
|
+
children: children({
|
|
49
|
+
closeOffset,
|
|
50
|
+
config,
|
|
51
|
+
currentScreenIndex,
|
|
52
|
+
currentYPosition,
|
|
53
|
+
gestureEnabled,
|
|
54
|
+
headerHeight,
|
|
55
|
+
navHeight,
|
|
56
|
+
topTabHeight,
|
|
57
|
+
topTabNativeGesture,
|
|
58
|
+
transformationX,
|
|
59
|
+
transformationY,
|
|
60
|
+
context
|
|
61
|
+
})
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=Context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createContext","memo","useRef","Gesture","useSharedValue","ContextHooks","jsx","_jsx","Context","Provider","children","config","context","gestureEnabled","currentScreenIndex","navHeight","closeOffset","topTabHeight","topTabNativeGesture","Native","current","transformationX","transformationY","currentYPosition","headerHeight","useTransformHeaderOnTabChange","useResetApproachingScreenScrollOffset","value"],"sourceRoot":"../../../src","sources":["context/Context.tsx"],"mappings":";;AACA,SAASA,aAAa,EAAEC,IAAI,EAAEC,MAAM,QAAQ,OAAO;AACnD,SAASC,OAAO,QAAQ,8BAA8B;AACtD,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAASC,YAAY,QAAQ,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/C,OAAO,MAAMC,OAAO,gBAAGR,aAAa,CAClC,CAAC,CACH,CAAC;AAED,OAAO,MAAMS,QAAQ,gBAAGR,IAAI,CAC1B,CAAC;EACCS,QAAQ;EACRC,MAAM;EACNC;AAC6C,CAAC,KAAK;EACnD,MAAMC,cAAc,GAAGT,cAAc,CAAC,IAAI,CAAC;EAC3C,MAAMU,kBAAkB,GAAGV,cAAc,CAAC,CAAC,CAAC;EAE5C,MAAMW,SAAS,GAAGX,cAAc,CAAC,CAAC,CAAC;EACnC,MAAMY,WAAW,GAAGZ,cAAc,CAAC,CAAC,CAAC;EACrC,MAAMa,YAAY,GAAGb,cAAc,CAAC,CAAC,CAAC;EAEtC,MAAMc,mBAAmB,GAAGhB,MAAM,CAACC,OAAO,CAACgB,MAAM,CAAC,CAAC,CAAC,CAACC,OAAO;EAE5D,MAAM;IAAEC,eAAe;IAAEC,eAAe;IAAEC,gBAAgB;IAAEC;EAAa,CAAC,GACxEnB,YAAY,CAACoB,6BAA6B,CAAC;IAAEd;EAAO,CAAC,CAAC;EAExDN,YAAY,CAACqB,qCAAqC,CAAC;IACjDH,gBAAgB;IAChBF,eAAe;IACfT;EACF,CAAC,CAAC;EAEF,oBACEL,IAAA,CAACC,OAAO,CAACC,QAAQ;IACfkB,KAAK,EAAE;MACLX,WAAW;MACXL,MAAM;MACNG,kBAAkB;MAClBS,gBAAgB;MAChBV,cAAc;MACdW,YAAY;MACZT,SAAS;MACTE,YAAY;MACZC,mBAAmB;MACnBG,eAAe;MACfC,eAAe;MACfV;IACF,CAAE;IAAAF,QAAA,EAEDA,QAAQ,CAAC;MACRM,WAAW;MACXL,MAAM;MACNG,kBAAkB;MAClBS,gBAAgB;MAChBV,cAAc;MACdW,YAAY;MACZT,SAAS;MACTE,YAAY;MACZC,mBAAmB;MACnBG,eAAe;MACfC,eAAe;MACfV;IACF,CAAC;EAAC,CACc,CAAC;AAEvB,CACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useTabContext } from './useTabContext';
|
|
4
|
+
import { interpolate, useAnimatedStyle, withTiming } from 'react-native-reanimated';
|
|
5
|
+
export const useHeader = () => {
|
|
6
|
+
const {
|
|
7
|
+
headerHeight,
|
|
8
|
+
transformationX,
|
|
9
|
+
transformationY
|
|
10
|
+
} = useTabContext();
|
|
11
|
+
const hideHeader = () => {
|
|
12
|
+
transformationX.value = withTiming(-headerHeight.value);
|
|
13
|
+
};
|
|
14
|
+
const defaultStyle = useAnimatedStyle(() => ({
|
|
15
|
+
transform: [{
|
|
16
|
+
translateY: interpolate(transformationY.value, [0, -headerHeight.value], [0, -headerHeight.value], 'clamp')
|
|
17
|
+
}],
|
|
18
|
+
zIndex: -1
|
|
19
|
+
}));
|
|
20
|
+
return {
|
|
21
|
+
hideHeader,
|
|
22
|
+
defaultStyle
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=useHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useTabContext","interpolate","useAnimatedStyle","withTiming","useHeader","headerHeight","transformationX","transformationY","hideHeader","value","defaultStyle","transform","translateY","zIndex"],"sourceRoot":"../../../src","sources":["hooks/useHeader.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,iBAAiB;AAC/C,SACEC,WAAW,EACXC,gBAAgB,EAChBC,UAAU,QACL,yBAAyB;AAEhC,OAAO,MAAMC,SAAS,GAAGA,CAAA,KAAM;EAC7B,MAAM;IAAEC,YAAY;IAAEC,eAAe;IAAEC;EAAgB,CAAC,GAAGP,aAAa,CAAC,CAAC;EAE1E,MAAMQ,UAAU,GAAGA,CAAA,KAAM;IACvBF,eAAe,CAACG,KAAK,GAAGN,UAAU,CAAC,CAACE,YAAY,CAACI,KAAK,CAAC;EACzD,CAAC;EAED,MAAMC,YAAY,GAAGR,gBAAgB,CAAC,OAAO;IAC3CS,SAAS,EAAE,CACT;MACEC,UAAU,EAAEX,WAAW,CACrBM,eAAe,CAACE,KAAK,EACrB,CAAC,CAAC,EAAE,CAACJ,YAAY,CAACI,KAAK,CAAC,EACxB,CAAC,CAAC,EAAE,CAACJ,YAAY,CAACI,KAAK,CAAC,EACxB,OACF;IACF,CAAC,CACF;IACDI,MAAM,EAAE,CAAC;EACX,CAAC,CAAC,CAAC;EAEH,OAAO;IAAEL,UAAU;IAAEE;EAAa,CAAC;AACrC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useRoute } from '@react-navigation/native';
|
|
4
|
+
import { useTabContext } from './useTabContext';
|
|
5
|
+
export const useScreenGesture = () => {
|
|
6
|
+
const {
|
|
7
|
+
key
|
|
8
|
+
} = useRoute();
|
|
9
|
+
const {
|
|
10
|
+
context
|
|
11
|
+
} = useTabContext();
|
|
12
|
+
const nativeRef = context.screen.properties[key]?.nativeGesture;
|
|
13
|
+
if (!nativeRef) throw 'GestureRef does not exist for this route';
|
|
14
|
+
return nativeRef;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=useScreenGesture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useRoute","useTabContext","useScreenGesture","key","context","nativeRef","screen","properties","nativeGesture"],"sourceRoot":"../../../src","sources":["hooks/useScreenGesture.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EACpC,MAAM;IAAEC;EAAI,CAAC,GAAGH,QAAQ,CAAC,CAAC;EAC1B,MAAM;IAAEI;EAAQ,CAAC,GAAGH,aAAa,CAAC,CAAC;EAEnC,MAAMI,SAAS,GAAGD,OAAO,CAACE,MAAM,CAACC,UAAU,CAACJ,GAAG,CAAC,EAAEK,aAAa;EAE/D,IAAI,CAACH,SAAS,EAAE,MAAM,0CAA0C;EAEhE,OAAOA,SAAS;AAClB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useRoute } from '@react-navigation/native';
|
|
4
|
+
import { useTabContext } from './useTabContext';
|
|
5
|
+
export const useScreenProperties = () => {
|
|
6
|
+
const {
|
|
7
|
+
key
|
|
8
|
+
} = useRoute();
|
|
9
|
+
const {
|
|
10
|
+
context
|
|
11
|
+
} = useTabContext();
|
|
12
|
+
const screen = context.screen.properties[key];
|
|
13
|
+
if (!screen) throw 'No screen properties registered for this route';
|
|
14
|
+
return screen;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=useScreenProperties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useRoute","useTabContext","useScreenProperties","key","context","screen","properties"],"sourceRoot":"../../../src","sources":["hooks/useScreenProperties.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAM;IAAEC;EAAI,CAAC,GAAGH,QAAQ,CAAC,CAAC;EAC1B,MAAM;IAAEI;EAAQ,CAAC,GAAGH,aAAa,CAAC,CAAC;EACnC,MAAMI,MAAM,GAAGD,OAAO,CAACC,MAAM,CAACC,UAAU,CAACH,GAAG,CAAC;EAC7C,IAAI,CAACE,MAAM,EAAE,MAAM,gDAAgD;EAEnE,OAAOA,MAAM;AACf,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useRoute } from '@react-navigation/native';
|
|
4
|
+
import { useWindowDimensions } from 'react-native';
|
|
5
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
|
+
import { useTabContext } from './useTabContext';
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import { HeaderHeightContext } from '@react-navigation/elements';
|
|
9
|
+
import { useAnimatedProps, useAnimatedScrollHandler, useAnimatedStyle, useDerivedValue } from 'react-native-reanimated';
|
|
10
|
+
import { useScreenProperties } from './useScreenProperties';
|
|
11
|
+
export const useScreenScrollable = () => {
|
|
12
|
+
const {
|
|
13
|
+
key
|
|
14
|
+
} = useRoute();
|
|
15
|
+
const {
|
|
16
|
+
height
|
|
17
|
+
} = useWindowDimensions();
|
|
18
|
+
const {
|
|
19
|
+
bottom,
|
|
20
|
+
top
|
|
21
|
+
} = useSafeAreaInsets();
|
|
22
|
+
const {
|
|
23
|
+
currentYPosition,
|
|
24
|
+
gestureEnabled,
|
|
25
|
+
headerHeight,
|
|
26
|
+
context,
|
|
27
|
+
topTabHeight,
|
|
28
|
+
transformationY
|
|
29
|
+
} = useTabContext();
|
|
30
|
+
const screen = useScreenProperties();
|
|
31
|
+
const navigationHeader = React.useContext(HeaderHeightContext) ?? top;
|
|
32
|
+
const animatedProps = useAnimatedProps(() => ({
|
|
33
|
+
scrollEnabled: !gestureEnabled.value || currentYPosition.value === -headerHeight.value
|
|
34
|
+
}));
|
|
35
|
+
const onScroll = useAnimatedScrollHandler(({
|
|
36
|
+
contentOffset
|
|
37
|
+
}) => {
|
|
38
|
+
const scrollPosition = context.screen.properties[key]?.scrollY;
|
|
39
|
+
if (!scrollPosition) throw 'ScrollPosition property does not exist for this route';
|
|
40
|
+
scrollPosition.value = contentOffset.y;
|
|
41
|
+
});
|
|
42
|
+
const oppositeHeaderState = useDerivedValue(() => transformationY.value >= 0 ? headerHeight.value : 0);
|
|
43
|
+
const difference = useDerivedValue(() => Math.abs(screen.outerLayout.value.height - screen.innerLayout.value.height));
|
|
44
|
+
const style = useAnimatedStyle(() => ({
|
|
45
|
+
minHeight: height - topTabHeight.value - oppositeHeaderState.value - navigationHeader - difference.value
|
|
46
|
+
}));
|
|
47
|
+
return {
|
|
48
|
+
animatedProps,
|
|
49
|
+
bounces: false,
|
|
50
|
+
contentContainerStyle: {
|
|
51
|
+
paddingBottom: bottom
|
|
52
|
+
},
|
|
53
|
+
onScroll,
|
|
54
|
+
style
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=useScreenScrollable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useRoute","useWindowDimensions","useSafeAreaInsets","useTabContext","React","HeaderHeightContext","useAnimatedProps","useAnimatedScrollHandler","useAnimatedStyle","useDerivedValue","useScreenProperties","useScreenScrollable","key","height","bottom","top","currentYPosition","gestureEnabled","headerHeight","context","topTabHeight","transformationY","screen","navigationHeader","useContext","animatedProps","scrollEnabled","value","onScroll","contentOffset","scrollPosition","properties","scrollY","y","oppositeHeaderState","difference","Math","abs","outerLayout","innerLayout","style","minHeight","bounces","contentContainerStyle","paddingBottom"],"sourceRoot":"../../../src","sources":["hooks/useScreenScrollable.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,SAASC,mBAAmB,QAAQ,cAAc;AAClD,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,OAAO,KAAKC,KAA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,CAAC;EAED,MAAMQ,UAAU,GAAG1B,eAAe,CAAC,MACjC2B,IAAI,CAACC,GAAG,CAACf,MAAM,CAACgB,WAAW,CAACX,KAAK,CAACd,MAAM,GAAGS,MAAM,CAACiB,WAAW,CAACZ,KAAK,CAACd,MAAM,CAC5E,CAAC;EAED,MAAM2B,KAAK,GAAGhC,gBAAgB,CAAC,OAAO;IACpCiC,SAAS,EACP5B,MAAM,GACNO,YAAY,CAACO,KAAK,GAClBO,mBAAmB,CAACP,KAAK,GACzBJ,gBAAgB,GAChBY,UAAU,CAACR;EACf,CAAC,CAAC,CAAC;EAEH,OAAO;IACLF,aAAa;IACbiB,OAAO,EAAE,KAAK;IACdC,qBAAqB,EAAE;MAAEC,aAAa,EAAE9B;IAAO,CAAC;IAChDc,QAAQ;IACRY;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useContext","Context","useTabContext"],"sourceRoot":"../../../src","sources":["hooks/useTabContext.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,OAAO,QAAQ,oBAAoB;AAE5C,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAMF,UAAU,CAACC,OAAO,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// returns read-only property
|
|
4
|
+
import { useTabContext } from './useTabContext';
|
|
5
|
+
import { useDerivedValue } from 'react-native-reanimated';
|
|
6
|
+
export const useTabOffset = () => {
|
|
7
|
+
const {
|
|
8
|
+
transformationX
|
|
9
|
+
} = useTabContext();
|
|
10
|
+
return useDerivedValue(() => transformationX.value);
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useTabOffset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useTabContext","useDerivedValue","useTabOffset","transformationX","value"],"sourceRoot":"../../../src","sources":["hooks/useTabOffset.ts"],"mappings":";;AAAA;AACA,SAASA,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,eAAe,QAAQ,yBAAyB;AAEzD,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAChC,MAAM;IAAEC;EAAgB,CAAC,GAAGH,aAAa,CAAC,CAAC;EAC3C,OAAOC,eAAe,CAAC,MAAME,eAAe,CAACC,KAAK,CAAC;AACrD,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,11 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import { ScrollView } from './components/wrappers/ScrollView';
|
|
4
|
+
import { ScreenWrapper } from './components/wrappers/ScreenWrapper';
|
|
5
|
+
import { TabBarBaseComponent } from './components/elements/TabBarBaseComponent';
|
|
6
|
+
import { TabBarLabelBaseComponent } from './components/elements/TabBarLabelBaseComponent';
|
|
7
|
+
import { useEffect } from 'react';
|
|
8
|
+
import { WarningService } from './services/Warning.service';
|
|
9
|
+
import { useTabContext } from './hooks/useTabContext';
|
|
10
|
+
import { useTabOffset } from './hooks/useTabOffset';
|
|
11
|
+
import { useScreenGesture } from './hooks/useScreenGesture';
|
|
12
|
+
import { useScreenScrollable } from './hooks/useScreenScrollable';
|
|
13
|
+
import { useScreenProperties } from './hooks/useScreenProperties';
|
|
14
|
+
import { useHeader } from './hooks/useHeader';
|
|
15
|
+
export { createReanimatedTopTabNavigator } from './navigator/createReanimatedTopTabNavigator';
|
|
16
|
+
const _useTabContext = () => {
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
WarningService.warn();
|
|
19
|
+
}, []);
|
|
20
|
+
return useTabContext();
|
|
21
|
+
};
|
|
22
|
+
export const TabHooks = {
|
|
23
|
+
useHeader,
|
|
24
|
+
useScreenProperties,
|
|
25
|
+
useScreenScrollable,
|
|
26
|
+
useScreenGesture,
|
|
27
|
+
useTabContext: _useTabContext,
|
|
28
|
+
useTabOffset
|
|
29
|
+
};
|
|
30
|
+
export const Tab = {
|
|
31
|
+
ScrollView,
|
|
32
|
+
ScreenWrapper,
|
|
33
|
+
TabBarBaseComponent,
|
|
34
|
+
TabBarLabelBaseComponent
|
|
35
|
+
};
|
|
11
36
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["ScrollView","ScreenWrapper","TabBarBaseComponent","TabBarLabelBaseComponent","useEffect","WarningService","useTabContext","useTabOffset","useScreenGesture","useScreenScrollable","useScreenProperties","useHeader","createReanimatedTopTabNavigator","_useTabContext","warn","TabHooks","Tab"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,kCAAkC;AAC7D,SAASC,aAAa,QAAQ,qCAAqC;AACnE,SAASC,mBAAmB,QAAQ,2CAA2C;AAC/E,SAASC,wBAAwB,QAAQ,gDAAgD;AACzF,SAASC,SAAS,QAAQ,OAAO;AACjC,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SAASC,gBAAgB,QAAQ,0BAA0B;AAC3D,SAASC,mBAAmB,QAAQ,6BAA6B;AACjE,SAASC,mBAAmB,QAAQ,6BAA6B;AACjE,SAASC,SAAS,QAAQ,mBAAmB;AAG7C,SAASC,+BAA+B,QAAQ,6CAA6C;AAE7F,MAAMC,cAAc,GAAGA,CAAA,KAAM;EAC3BT,SAAS,CAAC,MAAM;IACdC,cAAc,CAACS,IAAI,CAAC,CAAC;EACvB,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOR,aAAa,CAAC,CAAC;AACxB,CAAC;AAED,OAAO,MAAMS,QAAQ,GAAG;EACtBJ,SAAS;EACTD,mBAAmB;EACnBD,mBAAmB;EACnBD,gBAAgB;EAChBF,aAAa,EAAEO,cAAc;EAC7BN;AACF,CAAC;AAED,OAAO,MAAMS,GAAG,GAAG;EACjBhB,UAAU;EACVC,aAAa;EACbC,mBAAmB;EACnBC;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { createNavigatorFactory, TabActions, TabRouter, useNavigationBuilder } from '@react-navigation/native';
|
|
4
|
-
import { GestureWrapper } from
|
|
5
|
-
import { TabBarBaseComponent } from
|
|
6
|
-
import { Provider } from
|
|
4
|
+
import { GestureWrapper } from '../components/wrappers/GestureWrapper';
|
|
5
|
+
import { TabBarBaseComponent } from '../components/elements/TabBarBaseComponent';
|
|
6
|
+
import { Provider } from '../context/Context';
|
|
7
7
|
import { omit } from 'lodash';
|
|
8
|
-
import { useCallback, useMemo
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
8
|
+
import { useCallback, useMemo } from 'react';
|
|
9
|
+
import Reanimated from 'react-native-reanimated';
|
|
10
|
+
import { ReanimatedTabView } from '../components/ReanimatedTopTab/ReanimatedTabView';
|
|
11
|
+
import { ContextHooks } from '../context/Context.hooks';
|
|
12
12
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
const TabViewNavigator = ({
|
|
14
14
|
HeaderComponent,
|
|
@@ -33,25 +33,11 @@ const TabViewNavigator = ({
|
|
|
33
33
|
if (!config) {
|
|
34
34
|
_config = state.routes.map(() => 'normal');
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
width: 0,
|
|
42
|
-
x: 0,
|
|
43
|
-
y: 0
|
|
44
|
-
}),
|
|
45
|
-
nativeGesture: Gesture.Native(),
|
|
46
|
-
outerLayout: makeMutable({
|
|
47
|
-
height: 0,
|
|
48
|
-
width: 0,
|
|
49
|
-
x: 0,
|
|
50
|
-
y: 0
|
|
51
|
-
}),
|
|
52
|
-
scrollY: makeMutable(0)
|
|
53
|
-
}
|
|
54
|
-
}), {})).current;
|
|
36
|
+
const context = ContextHooks.usePrepareContext({
|
|
37
|
+
state
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
//NOTE: all belows reefers to Tabs component directly. Consider to move it somewhere
|
|
55
41
|
const onIndexChange = (currentScreenIndex, gestureEnabled) => index => {
|
|
56
42
|
navigation.navigate(state.routes[index]?.name ?? '');
|
|
57
43
|
currentScreenIndex.value = index;
|
|
@@ -100,7 +86,7 @@ const TabViewNavigator = ({
|
|
|
100
86
|
}) => descriptors[route.key]?.render();
|
|
101
87
|
return /*#__PURE__*/_jsx(Provider, {
|
|
102
88
|
config: _config,
|
|
103
|
-
|
|
89
|
+
context: context,
|
|
104
90
|
children: ({
|
|
105
91
|
currentScreenIndex,
|
|
106
92
|
gestureEnabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createNavigatorFactory","TabActions","TabRouter","useNavigationBuilder","GestureWrapper","TabBarBaseComponent","Provider","omit","useCallback","useMemo","
|
|
1
|
+
{"version":3,"names":["createNavigatorFactory","TabActions","TabRouter","useNavigationBuilder","GestureWrapper","TabBarBaseComponent","Provider","omit","useCallback","useMemo","Reanimated","ReanimatedTabView","ContextHooks","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","TabViewNavigator","HeaderComponent","TabBarComponent","children","config","initialRouteName","screenOptions","NavigationContent","descriptors","navigation","state","defaultScreenOptions","_config","routes","map","context","usePrepareContext","onIndexChange","currentScreenIndex","gestureEnabled","index","navigate","name","value","navigationState","route","restOptions","key","options","tabBarLabel","focused","title","undefined","dispatch","jumpTo","params","target","renderTabBar","props","renderScene","render","headerHeight","transformationY","View","onLayout","nativeEvent","layout","height","createReanimatedTopTabNavigator"],"sourceRoot":"../../../src","sources":["navigator/createReanimatedTopTabNavigator.tsx"],"mappings":";;AAAA,SACEA,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CAAC;AAED,OAAO,MAAMW,+BAA+B,GAAGA,CAAA,KAG7CnE,sBAAsB,CAKpBmB,gBAAgB,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const WarningService = {
|
|
4
|
+
hasWarned: false,
|
|
5
|
+
warn() {
|
|
6
|
+
if (__DEV__ && !this.hasWarned) {
|
|
7
|
+
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.');
|
|
8
|
+
this.hasWarned = true;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=Warning.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["WarningService","hasWarned","warn","__DEV__","console"],"sourceRoot":"../../../src","sources":["services/Warning.service.ts"],"mappings":";;AAAA,OAAO,MAAMA,cAAc,GAAG;EAC5BC,SAAS,EAAE,KAAK;EAChBC,IAAIA,CAAA,EAAG;IACL,IAAIC,OAAO,IAAI,CAAC,IAAI,CAACF,SAAS,EAAE;MAC9BG,OAAO,CAACF,IAAI,CACV,mLACF,CAAC;MACD,IAAI,CAACD,SAAS,GAAG,IAAI;IACvB;EACF;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationHelper.d.ts","sourceRoot":"","sources":["../../../../../src/components/ReanimatedTopTab/AnimationHelper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,4BAA4B,EAC5B,6BAA6B,EAC9B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAkFtD,eAAO,MAAM,eAAe;0BALC,MAAM;sBA1E1B,kBAAkB,CACvB,6BAA6B,GAAG,4BAA4B,CAC7D,kBACe,MAAM,SACf,MAAM,mBACI,sBAAsB,CAAC,eAAe;mBA6BhD,uBAAuB,CAAC,6BAA6B,CAAC,4BACnC,MAAM,SACzB,MAAM,mBACI,sBAAsB,CAAC,eAAe;;;;CA8CxD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReanimatedTabView.d.ts","sourceRoot":"","sources":["../../../../../src/components/ReanimatedTopTab/ReanimatedTabView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAiBvE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,WAAW,sBAAsB;IACrC,eAAe,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IACxC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,eAAe,EAAE,sBAAsB,CAAC,eAAe,CAAC;IACxD,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qBAAqB,CAAC,EAAE,sBAAsB,CAAC,qBAAqB,CAAC;IACrE,WAAW,EAAE,CAAC,MAAM,EAAE,sBAAsB,CAAC,UAAU,KAAK,KAAK,CAAC,SAAS,CAAC;IAC5E,YAAY,CAAC,EAAE,CACb,MAAM,EAAE,sBAAsB,CAAC,gBAAgB,KAC5C,KAAK,CAAC,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,iBAAiB,oDA+J7B,CAAC"}
|