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.
Files changed (199) hide show
  1. package/README.md +5 -17
  2. package/lib/commonjs/components/ReanimatedTopTab/ReanimatedTabView.js +5 -3
  3. package/lib/commonjs/components/ReanimatedTopTab/ReanimatedTabView.js.map +1 -1
  4. package/lib/commonjs/components/elements/TabBarBaseComponent.js +6 -5
  5. package/lib/commonjs/components/elements/TabBarBaseComponent.js.map +1 -1
  6. package/lib/commonjs/components/elements/TabBarLabelBaseComponent.js +2 -4
  7. package/lib/commonjs/components/elements/TabBarLabelBaseComponent.js.map +1 -1
  8. package/lib/commonjs/components/wrappers/GestureWrapper.js +18 -26
  9. package/lib/commonjs/components/wrappers/GestureWrapper.js.map +1 -1
  10. package/lib/commonjs/components/wrappers/ScreenWrapper.js +4 -4
  11. package/lib/commonjs/components/wrappers/ScreenWrapper.js.map +1 -1
  12. package/lib/commonjs/components/wrappers/ScrollView.js +27 -16
  13. package/lib/commonjs/components/wrappers/ScrollView.js.map +1 -1
  14. package/lib/commonjs/context/Context.helpers.js +19 -0
  15. package/lib/commonjs/context/Context.helpers.js.map +1 -0
  16. package/lib/commonjs/context/Context.hooks.js +216 -0
  17. package/lib/commonjs/context/Context.hooks.js.map +1 -0
  18. package/lib/commonjs/context/Context.js +68 -0
  19. package/lib/commonjs/context/Context.js.map +1 -0
  20. package/lib/commonjs/hooks/useHeader.js +30 -0
  21. package/lib/commonjs/hooks/useHeader.js.map +1 -0
  22. package/lib/commonjs/hooks/useScreenGesture.js +21 -0
  23. package/lib/commonjs/hooks/useScreenGesture.js.map +1 -0
  24. package/lib/commonjs/hooks/useScreenProperties.js +21 -0
  25. package/lib/commonjs/hooks/useScreenProperties.js.map +1 -0
  26. package/lib/commonjs/hooks/useScreenScrollable.js +64 -0
  27. package/lib/commonjs/hooks/useScreenScrollable.js.map +1 -0
  28. package/lib/commonjs/hooks/useTabContext.js +11 -0
  29. package/lib/commonjs/hooks/useTabContext.js.map +1 -0
  30. package/lib/commonjs/hooks/useTabOffset.js +18 -0
  31. package/lib/commonjs/hooks/useTabOffset.js.map +1 -0
  32. package/lib/commonjs/index.js +34 -80
  33. package/lib/commonjs/index.js.map +1 -1
  34. package/lib/commonjs/navigator/createReanimatedTopTabNavigator.js +14 -29
  35. package/lib/commonjs/navigator/createReanimatedTopTabNavigator.js.map +1 -1
  36. package/lib/commonjs/services/Warning.service.js +16 -0
  37. package/lib/commonjs/services/Warning.service.js.map +1 -0
  38. package/lib/module/components/ReanimatedTopTab/ReanimatedTabView.js +8 -6
  39. package/lib/module/components/ReanimatedTopTab/ReanimatedTabView.js.map +1 -1
  40. package/lib/module/components/elements/TabBarBaseComponent.js +5 -4
  41. package/lib/module/components/elements/TabBarBaseComponent.js.map +1 -1
  42. package/lib/module/components/elements/TabBarLabelBaseComponent.js +2 -4
  43. package/lib/module/components/elements/TabBarLabelBaseComponent.js.map +1 -1
  44. package/lib/module/components/wrappers/GestureWrapper.js +18 -27
  45. package/lib/module/components/wrappers/GestureWrapper.js.map +1 -1
  46. package/lib/module/components/wrappers/ScreenWrapper.js +3 -3
  47. package/lib/module/components/wrappers/ScreenWrapper.js.map +1 -1
  48. package/lib/module/components/wrappers/ScrollView.js +23 -12
  49. package/lib/module/components/wrappers/ScrollView.js.map +1 -1
  50. package/lib/module/context/Context.helpers.js +15 -0
  51. package/lib/module/context/Context.helpers.js.map +1 -0
  52. package/lib/module/context/Context.hooks.js +213 -0
  53. package/lib/module/context/Context.hooks.js.map +1 -0
  54. package/lib/module/context/Context.js +64 -0
  55. package/lib/module/context/Context.js.map +1 -0
  56. package/lib/module/hooks/useHeader.js +25 -0
  57. package/lib/module/hooks/useHeader.js.map +1 -0
  58. package/lib/module/hooks/useScreenGesture.js +16 -0
  59. package/lib/module/hooks/useScreenGesture.js.map +1 -0
  60. package/lib/module/hooks/useScreenProperties.js +16 -0
  61. package/lib/module/hooks/useScreenProperties.js.map +1 -0
  62. package/lib/module/hooks/useScreenScrollable.js +57 -0
  63. package/lib/module/hooks/useScreenScrollable.js.map +1 -0
  64. package/lib/module/hooks/useTabContext.js +6 -0
  65. package/lib/module/hooks/useTabContext.js.map +1 -0
  66. package/lib/module/hooks/useTabOffset.js +12 -0
  67. package/lib/module/hooks/useTabOffset.js.map +1 -0
  68. package/lib/module/index.js +33 -8
  69. package/lib/module/index.js.map +1 -1
  70. package/lib/module/navigator/createReanimatedTopTabNavigator.js +13 -27
  71. package/lib/module/navigator/createReanimatedTopTabNavigator.js.map +1 -1
  72. package/lib/module/services/Warning.service.js +12 -0
  73. package/lib/module/services/Warning.service.js.map +1 -0
  74. package/lib/typescript/src/components/ReanimatedTopTab/AnimationHelper.d.ts.map +1 -0
  75. package/lib/typescript/src/components/ReanimatedTopTab/ReanimatedTabView.d.ts.map +1 -0
  76. package/lib/typescript/src/components/ReanimatedTopTab/types.d.ts.map +1 -0
  77. package/lib/typescript/{module/src → src}/components/elements/TabBarBaseComponent.d.ts +1 -2
  78. package/lib/typescript/src/components/elements/TabBarBaseComponent.d.ts.map +1 -0
  79. package/lib/typescript/{commonjs/src → src}/components/elements/TabBarLabelBaseComponent.d.ts +1 -2
  80. package/lib/typescript/src/components/elements/TabBarLabelBaseComponent.d.ts.map +1 -0
  81. package/lib/typescript/src/components/wrappers/GestureWrapper.d.ts +7 -0
  82. package/lib/typescript/src/components/wrappers/GestureWrapper.d.ts.map +1 -0
  83. package/lib/typescript/src/components/wrappers/ScreenWrapper.d.ts.map +1 -0
  84. package/lib/typescript/src/components/wrappers/ScrollView.d.ts +5 -0
  85. package/lib/typescript/src/components/wrappers/ScrollView.d.ts.map +1 -0
  86. package/lib/typescript/{commonjs/src/context/TopTabContext.d.ts → src/context/Context.d.ts} +2 -2
  87. package/lib/typescript/src/context/Context.d.ts.map +1 -0
  88. package/lib/typescript/src/context/Context.helpers.d.ts +4 -0
  89. package/lib/typescript/src/context/Context.helpers.d.ts.map +1 -0
  90. package/lib/typescript/src/context/Context.hooks.d.ts +15 -0
  91. package/lib/typescript/src/context/Context.hooks.d.ts.map +1 -0
  92. package/lib/typescript/src/hooks/useHeader.d.ts +10 -0
  93. package/lib/typescript/src/hooks/useHeader.d.ts.map +1 -0
  94. package/lib/typescript/src/hooks/useScreenGesture.d.ts +2 -0
  95. package/lib/typescript/src/hooks/useScreenGesture.d.ts.map +1 -0
  96. package/lib/typescript/src/hooks/useScreenProperties.d.ts +10 -0
  97. package/lib/typescript/src/hooks/useScreenProperties.d.ts.map +1 -0
  98. package/lib/typescript/src/hooks/useScreenScrollable.d.ts +14 -0
  99. package/lib/typescript/src/hooks/useScreenScrollable.d.ts.map +1 -0
  100. package/lib/typescript/src/hooks/useTabContext.d.ts +2 -0
  101. package/lib/typescript/src/hooks/useTabContext.d.ts.map +1 -0
  102. package/lib/typescript/src/hooks/useTabOffset.d.ts +2 -0
  103. package/lib/typescript/src/hooks/useTabOffset.d.ts.map +1 -0
  104. package/lib/typescript/src/index.d.ts +45 -0
  105. package/lib/typescript/src/index.d.ts.map +1 -0
  106. package/lib/typescript/src/navigator/createReanimatedTopTabNavigator.d.ts.map +1 -0
  107. package/lib/typescript/src/services/Warning.service.d.ts +5 -0
  108. package/lib/typescript/src/services/Warning.service.d.ts.map +1 -0
  109. package/lib/typescript/{module/src → src}/types.d.ts +24 -17
  110. package/lib/typescript/src/types.d.ts.map +1 -0
  111. package/package.json +24 -38
  112. package/src/components/ReanimatedTopTab/ReanimatedTabView.tsx +7 -6
  113. package/src/components/elements/TabBarBaseComponent.tsx +7 -3
  114. package/src/components/elements/TabBarLabelBaseComponent.tsx +4 -3
  115. package/src/components/wrappers/GestureWrapper.tsx +27 -29
  116. package/src/components/wrappers/ScreenWrapper.tsx +4 -3
  117. package/src/components/wrappers/ScrollView.tsx +33 -19
  118. package/src/context/Context.helpers.tsx +10 -0
  119. package/src/context/Context.hooks.ts +253 -0
  120. package/src/context/Context.tsx +69 -0
  121. package/src/hooks/useHeader.ts +30 -0
  122. package/src/hooks/useScreenGesture.ts +13 -0
  123. package/src/hooks/useScreenProperties.ts +11 -0
  124. package/src/hooks/useScreenScrollable.ts +69 -0
  125. package/src/hooks/useTabContext.ts +4 -0
  126. package/src/hooks/useTabOffset.ts +8 -0
  127. package/src/index.tsx +34 -10
  128. package/src/navigator/createReanimatedTopTabNavigator.tsx +8 -32
  129. package/src/services/Warning.service.ts +11 -0
  130. package/src/types.ts +23 -19
  131. package/lib/commonjs/context/TopTabContext.hooks.js +0 -48
  132. package/lib/commonjs/context/TopTabContext.hooks.js.map +0 -1
  133. package/lib/commonjs/context/TopTabContext.js +0 -86
  134. package/lib/commonjs/context/TopTabContext.js.map +0 -1
  135. package/lib/commonjs/hooks/TopTab.hooks.js +0 -120
  136. package/lib/commonjs/hooks/TopTab.hooks.js.map +0 -1
  137. package/lib/module/context/TopTabContext.hooks.js +0 -44
  138. package/lib/module/context/TopTabContext.hooks.js.map +0 -1
  139. package/lib/module/context/TopTabContext.js +0 -82
  140. package/lib/module/context/TopTabContext.js.map +0 -1
  141. package/lib/module/hooks/TopTab.hooks.js +0 -110
  142. package/lib/module/hooks/TopTab.hooks.js.map +0 -1
  143. package/lib/typescript/commonjs/src/components/ReanimatedTopTab/AnimationHelper.d.ts.map +0 -1
  144. package/lib/typescript/commonjs/src/components/ReanimatedTopTab/ReanimatedTabView.d.ts.map +0 -1
  145. package/lib/typescript/commonjs/src/components/ReanimatedTopTab/types.d.ts.map +0 -1
  146. package/lib/typescript/commonjs/src/components/elements/TabBarBaseComponent.d.ts +0 -24
  147. package/lib/typescript/commonjs/src/components/elements/TabBarBaseComponent.d.ts.map +0 -1
  148. package/lib/typescript/commonjs/src/components/elements/TabBarLabelBaseComponent.d.ts.map +0 -1
  149. package/lib/typescript/commonjs/src/components/wrappers/GestureWrapper.d.ts +0 -2
  150. package/lib/typescript/commonjs/src/components/wrappers/GestureWrapper.d.ts.map +0 -1
  151. package/lib/typescript/commonjs/src/components/wrappers/ScreenWrapper.d.ts.map +0 -1
  152. package/lib/typescript/commonjs/src/components/wrappers/ScrollView.d.ts +0 -6
  153. package/lib/typescript/commonjs/src/components/wrappers/ScrollView.d.ts.map +0 -1
  154. package/lib/typescript/commonjs/src/context/TopTabContext.d.ts.map +0 -1
  155. package/lib/typescript/commonjs/src/context/TopTabContext.hooks.d.ts +0 -5
  156. package/lib/typescript/commonjs/src/context/TopTabContext.hooks.d.ts.map +0 -1
  157. package/lib/typescript/commonjs/src/hooks/TopTab.hooks.d.ts +0 -33
  158. package/lib/typescript/commonjs/src/hooks/TopTab.hooks.d.ts.map +0 -1
  159. package/lib/typescript/commonjs/src/index.d.ts +0 -10
  160. package/lib/typescript/commonjs/src/index.d.ts.map +0 -1
  161. package/lib/typescript/commonjs/src/navigator/createReanimatedTopTabNavigator.d.ts.map +0 -1
  162. package/lib/typescript/commonjs/src/types.d.ts +0 -56
  163. package/lib/typescript/commonjs/src/types.d.ts.map +0 -1
  164. package/lib/typescript/module/src/components/ReanimatedTopTab/AnimationHelper.d.ts +0 -11
  165. package/lib/typescript/module/src/components/ReanimatedTopTab/AnimationHelper.d.ts.map +0 -1
  166. package/lib/typescript/module/src/components/ReanimatedTopTab/ReanimatedTabView.d.ts +0 -14
  167. package/lib/typescript/module/src/components/ReanimatedTopTab/ReanimatedTabView.d.ts.map +0 -1
  168. package/lib/typescript/module/src/components/ReanimatedTopTab/types.d.ts +0 -30
  169. package/lib/typescript/module/src/components/ReanimatedTopTab/types.d.ts.map +0 -1
  170. package/lib/typescript/module/src/components/elements/TabBarBaseComponent.d.ts.map +0 -1
  171. package/lib/typescript/module/src/components/elements/TabBarLabelBaseComponent.d.ts +0 -8
  172. package/lib/typescript/module/src/components/elements/TabBarLabelBaseComponent.d.ts.map +0 -1
  173. package/lib/typescript/module/src/components/wrappers/GestureWrapper.d.ts +0 -2
  174. package/lib/typescript/module/src/components/wrappers/GestureWrapper.d.ts.map +0 -1
  175. package/lib/typescript/module/src/components/wrappers/ScreenWrapper.d.ts +0 -6
  176. package/lib/typescript/module/src/components/wrappers/ScreenWrapper.d.ts.map +0 -1
  177. package/lib/typescript/module/src/components/wrappers/ScrollView.d.ts +0 -6
  178. package/lib/typescript/module/src/components/wrappers/ScrollView.d.ts.map +0 -1
  179. package/lib/typescript/module/src/context/TopTabContext.d.ts +0 -4
  180. package/lib/typescript/module/src/context/TopTabContext.d.ts.map +0 -1
  181. package/lib/typescript/module/src/context/TopTabContext.hooks.d.ts +0 -5
  182. package/lib/typescript/module/src/context/TopTabContext.hooks.d.ts.map +0 -1
  183. package/lib/typescript/module/src/hooks/TopTab.hooks.d.ts +0 -33
  184. package/lib/typescript/module/src/hooks/TopTab.hooks.d.ts.map +0 -1
  185. package/lib/typescript/module/src/index.d.ts +0 -10
  186. package/lib/typescript/module/src/index.d.ts.map +0 -1
  187. package/lib/typescript/module/src/navigator/createReanimatedTopTabNavigator.d.ts +0 -4
  188. package/lib/typescript/module/src/navigator/createReanimatedTopTabNavigator.d.ts.map +0 -1
  189. package/lib/typescript/module/src/types.d.ts.map +0 -1
  190. package/src/context/TopTabContext.hooks.ts +0 -55
  191. package/src/context/TopTabContext.tsx +0 -115
  192. package/src/hooks/TopTab.hooks.ts +0 -112
  193. /package/lib/{typescript/commonjs → commonjs}/package.json +0 -0
  194. /package/lib/{typescript/module → module}/package.json +0 -0
  195. /package/lib/typescript/{commonjs/src → src}/components/ReanimatedTopTab/AnimationHelper.d.ts +0 -0
  196. /package/lib/typescript/{commonjs/src → src}/components/ReanimatedTopTab/ReanimatedTabView.d.ts +0 -0
  197. /package/lib/typescript/{commonjs/src → src}/components/ReanimatedTopTab/types.d.ts +0 -0
  198. /package/lib/typescript/{commonjs/src → src}/components/wrappers/ScreenWrapper.d.ts +0 -0
  199. /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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CAAC,KAAK;EAC5D,MAAMC,YAAY,GAAG1D,cAAc,CAAC,CAAC,CAAC;EACtC,MAAM2D,eAAe,GAAG3D,cAAc,CAAC,CAAC,CAAC;EACzC,MAAMO,eAAe,GAAGP,cAAc,CAAC,CAAC,CAAC;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,S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AgB;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,K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pD,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,6 @@
1
+ "use strict";
2
+
3
+ import { useContext } from 'react';
4
+ import { Context } from '../context/Context';
5
+ export const useTabContext = () => useContext(Context);
6
+ //# sourceMappingURL=useTabContext.js.map
@@ -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":[]}
@@ -1,11 +1,36 @@
1
1
  "use strict";
2
2
 
3
- export { Provider, Context } from "./context/TopTabContext.js";
4
- export { createReanimatedTopTabNavigator } from "./navigator/createReanimatedTopTabNavigator.js";
5
- export { ScrollView } from "./components/wrappers/ScrollView.js";
6
- export { ScreenWrapper } from "./components/wrappers/ScreenWrapper.js";
7
- export { GestureWrapper } from "./components/wrappers/GestureWrapper.js";
8
- export { TabBarBaseComponent } from "./components/elements/TabBarBaseComponent.js";
9
- export { TabBarLabelBaseComponent } from "./components/elements/TabBarLabelBaseComponent.js";
10
- export { useTabContext, useHeader, useScreenProperties, useScreenScrollable, useScreenGesture } from "./hooks/TopTab.hooks.js";
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
@@ -1 +1 @@
1
- {"version":3,"names":["Provider","Context","createReanimatedTopTabNavigator","ScrollView","ScreenWrapper","GestureWrapper","TabBarBaseComponent","TabBarLabelBaseComponent","useTabContext","useHeader","useScreenProperties","useScreenScrollable","useScreenGesture"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,OAAO,QAAQ,4BAAyB;AAC3D,SAASC,+BAA+B,QAAQ,gDAA6C;AAC7F,SAASC,UAAU,QAAQ,qCAAkC;AAC7D,SAASC,aAAa,QAAQ,wCAAqC;AACnE,SAASC,cAAc,QAAQ,yCAAsC;AACrE,SAASC,mBAAmB,QAAQ,8CAA2C;AAC/E,SAASC,wBAAwB,QAAQ,mDAAgD;AACzF,SACEC,aAAa,EACbC,SAAS,EACTC,mBAAmB,EACnBC,mBAAmB,EACnBC,gBAAgB,QACX,yBAAsB","ignoreList":[]}
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 "../components/wrappers/GestureWrapper.js";
5
- import { TabBarBaseComponent } from "../components/elements/TabBarBaseComponent.js";
6
- import { Provider } from "../context/TopTabContext.js";
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, useRef } from 'react';
9
- import { Gesture } from 'react-native-gesture-handler';
10
- import Reanimated, { makeMutable } from 'react-native-reanimated';
11
- import { ReanimatedTabView } from "../components/ReanimatedTopTab/ReanimatedTabView.js";
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 screenProperties = useRef(state.routes.reduce((prev, route) => ({
37
- ...prev,
38
- [route.key]: {
39
- innerLayout: makeMutable({
40
- height: 0,
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
- screenProperties: screenProperties,
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","useRef","Gesture","Reanimated","makeMutable","ReanimatedTabView","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","TabViewNavigator","HeaderComponent","TabBarComponent","children","config","initialRouteName","screenOptions","NavigationContent","descriptors","navigation","state","defaultScreenOptions","_config","routes","map","screenProperties","reduce","prev","route","key","innerLayout","height","width","x","y","nativeGesture","Native","outerLayout","scrollY","current","onIndexChange","currentScreenIndex","gestureEnabled","index","navigate","name","value","navigationState","restOptions","options","tabBarLabel","focused","title","undefined","dispatch","jumpTo","params","target","renderTabBar","props","renderScene","render","headerHeight","transformationY","View","onLayout","nativeEvent","layout","createReanimatedTopTabNavigator"],"sourceRoot":"../../../src","sources":["navigator/createReanimatedTopTabNavigator.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EAEtBC,UAAU,EAEVC,SAAS,EACTC,oBAAoB,QACf,0BAA0B;AAEjC,SAASC,cAAc,QAAQ,0CAAuC;AACtE,SAEEC,mBAAmB,QACd,+CAA4C;AACnD,SAASC,QAAQ,QAAQ,6BAA0B;AAEnD,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,WAAW,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AACpD,SAASC,OAAO,QAAQ,8BAA8B;AACtD,OAAOC,UAAU,IACfC,WAAW,QAEN,yBAAyB;AAEhC,SAASC,iBAAiB,QAAQ,qDAAkD;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAErF,MAAMC,gBAAgB,GAAGA,CAAC;EACxBC,eAAe;EACfC,eAAe,GAAGlB,mBAAmB;EACrCmB,QAAQ;EACRC,MAAM;EACNC,gBAAgB;EAChBC,aAAa,GAAG,CAAC;AAC+B,CAAC,KAAK;EACtD,MAAM;IAAEC,iBAAiB;IAAEC,WAAW;IAAEC,UAAU;IAAEC;EAAM,CAAC,GACzD5B,oBAAoB,CAMlBD,SAAS,EAAE;IACXsB,QAAQ;IACRQ,oBAAoB,EAAEL,aAAa;IACnCD,gBAAgB;IAChBC;EACF,CAAC,CAAC;EAEJ,IAAIM,OAAiB,GAAGR,MAAO;EAE/B,IAAI,CAACA,MAAM,EAAE;IACXQ,OAAO,GAAGF,KAAK,CAACG,MAAM,CAACC,GAAG,CAAC,MAAM,QAAQ,CAAC;EAC5C;EACA,MAAMC,gBAAgB,GAAG1B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Q,OAAQ;IAACG,gBAAgB,EAAEA,gBAAiB;IAAAZ,QAAA,EAC3DA,CAAC;MACA4B,kBAAkB;MAClBC,cAAc;MACdoB,YAAY;MACZC;IACF,CAAC,kBACCtD,KAAA,CAAAF,SAAA;MAAAM,QAAA,gBACER,IAAA,CAACJ,UAAU,CAAC+D,IAAI;QACdC,QAAQ,EAAEA,CAAC;UAAEC;QAAY,CAAC,KAAK;UAC7BJ,YAAY,CAAChB,KAAK,GAAGoB,WAAW,CAACC,MAAM,CAACpC,MAAM;QAChD,CAAE;QAAAlB,QAAA,EAEDF,eAAe,gBACdN,IAAA,CAACM,eAAe;UACdmD,YAAY,EAAEA,YAAa;UAC3BC,eAAe,EAAEA;QAAgB,CAClC,CAAC,GACA;MAAI,CACO,CAAC,eAClB1D,IAAA,CAACY,iBAAiB;QAAAJ,QAAA,eAChBR,IAAA,CAACZ,cAAc;UAAAoB,QAAA,eACbR,IAAA,CAACF,iBAAiB;YAChB4C,eAAe,EAAEA,eAAgB;YACjCP,aAAa,EAAEA,aAAa,CAC1BC,kBAAkB,EAClBC,cACF,CAAE;YACFkB,WAAW,EAAEA,WAAY;YACzBF,YAAY,EAAEA;UAAa,CAC5B;QAAC,CACY;MAAC,CACA,CAAC;IAAA,CACpB;EACH,CACO,CAAC;AAEf,CAAC;AAED,OAAO,MAAMU,+BAA+B,GAAGA,CAAA,KAG7C/E,sBAAsB,CAKpBqB,gBAAgB,CAAC,CAAC,CAAC","ignoreList":[]}
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,sBAAsB,EAEtBC,UAAU,EAEVC,SAAS,EACTC,oBAAoB,QACf,0BAA0B;AAEjC,SAASC,cAAc,QAAQ,uCAAuC;AACtE,SAEEC,mBAAmB,QACd,4CAA4C;AACnD,SAASC,QAAQ,QAAQ,oBAAoB;AAE7C,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAC5C,OAAOC,UAAU,MAA4B,yBAAyB;AAEtE,SAASC,iBAAiB,QAAQ,kDAAkD;AACpF,SAASC,YAAY,QAAQ,0BAA0B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAExD,MAAMC,gBAAgB,GAAGA,CAAC;EACxBC,eAAe;EACfC,eAAe,GAAGhB,mBAAmB;EACrCiB,QAAQ;EACRC,MAAM;EACNC,gBAAgB;EAChBC,aAAa,GAAG,CAAC;AAC+B,CAAC,KAAK;EACtD,MAAM;IAAEC,iBAAiB;IAAEC,WAAW;IAAEC,UAAU;IAAEC;EAAM,CAAC,GACzD1B,oBAAoB,CAMlBD,SAAS,EAAE;IACXoB,QAAQ;IACRQ,oBAAoB,EAAEL,aAAa;IACnCD,gBAAgB;IAChBC;EACF,CAAC,CAAC;EAEJ,IAAIM,OAAiB,GAAGR,MAAO;EAE/B,IAAI,CAACA,MAAM,EAAE;IACXQ,OAAO,GAAGF,KAAK,CAACG,MAAM,CAACC,GAAG,CAAC,MAAM,QAAQ,CAAC;EAC5C;EAEA,MAAMC,OAAO,GAAGtB,YAAY,CAACuB,iBAAiB,CAAC;IAAEN;EAAM,CAAC,CAAC;;EAEz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,EAAEA,eAAgB;YACjCP,aAAa,EAAEA,aAAa,CAC1BC,kBAAkB,EAClBC,cACF,CAAE;YACFoB,WAAW,EAAEA,WAAY;YACzBF,YAAY,EAAEA;UAAa,CAC5B;QAAC,CACY;MAAC,CACA,CAAC;IAAA,CACpB;EACH,CACO,CAAC;AAEf,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"}