react-native-collapsible-header-tab-view 1.0.0 → 1.0.2

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 CHANGED
@@ -22,6 +22,7 @@ yarn add react-native-collapsible-header-tab-view
22
22
 
23
23
  ### 依赖
24
24
 
25
+ 本库依赖 react-native-pager-view, 确保您项目安装正确版本的pagerView
25
26
  ```bash
26
27
  npm install react-native-pager-view
27
28
  ```
@@ -40,13 +41,11 @@ export function App() {
40
41
  renderTabBar={(props) => <TabBarComponent {...props} />}
41
42
  >
42
43
  <TabFlatList
43
- index={0}
44
44
  data={data1}
45
45
  renderItem={({ item }) => <ItemComponent item={item} />}
46
46
  keyExtractor={(item) => item.id}
47
47
  />
48
48
  <TabFlatList
49
- index={1}
50
49
  data={data2}
51
50
  renderItem={({ item }) => <ItemComponent item={item} />}
52
51
  keyExtractor={(item) => item.id}
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { FlatList, FlatListProps, NativeScrollEvent, NativeSyntheticEvent } from "react-native";
3
+ export type TabFlatListProps<T> = Omit<FlatListProps<T>, "onScroll"> & {
4
+ onScroll?: (e: NativeSyntheticEvent<NativeScrollEvent>) => void;
5
+ };
6
+ export declare const TabFlatList: <T>(props: TabFlatListProps<T> & {
7
+ ref?: React.Ref<FlatList<T>>;
8
+ }) => React.ReactElement;
9
+ //# sourceMappingURL=TabFlatList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabFlatList.d.ts","sourceRoot":"","sources":["../../src/TabFlatList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AACf,OAAO,EAEL,QAAQ,EACR,aAAa,EAEb,iBAAiB,EACjB,oBAAoB,EAErB,MAAM,cAAc,CAAC;AAUtB,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG;IACrE,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CACjE,CAAC;AAkGF,eAAO,MAAM,WAAW,EAAmC,CAAC,CAAC,EAC3D,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;CAAE,KAC1D,KAAK,CAAC,YAAY,CAAC"}
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { NativeScrollEvent, NativeSyntheticEvent, ScrollView, ScrollViewProps } from "react-native";
3
+ export type TabScrollViewProps = Omit<ScrollViewProps, "onScroll"> & {
4
+ onScroll?: (e: NativeSyntheticEvent<NativeScrollEvent>) => void;
5
+ };
6
+ declare const TabScrollView: React.ForwardRefExoticComponent<Omit<ScrollViewProps, "onScroll"> & {
7
+ onScroll?: (e: NativeSyntheticEvent<NativeScrollEvent>) => void;
8
+ } & React.RefAttributes<ScrollView>>;
9
+ export { TabScrollView };
10
+ //# sourceMappingURL=TabScrollView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TabScrollView.d.ts","sourceRoot":"","sources":["../../src/TabScrollView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAA;AACd,OAAO,EAGL,iBAAiB,EACjB,oBAAoB,EACpB,UAAU,EACV,eAAe,EAChB,MAAM,cAAc,CAAA;AAIrB,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,GAAG;IACnE,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;CAChE,CAAA;AAED,QAAA,MAAM,aAAa;eAHN,CAAC,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,KAAK,IAAI;oCA+DhE,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { CollapsibleContextValue } from "./types";
2
+ export declare const CollapsibleContext: import("react").Context<CollapsibleContextValue | null>;
3
+ export declare const TabIndexContext: import("react").Context<number>;
4
+ export declare const useCollapsible: () => CollapsibleContextValue;
5
+ export declare const useTabIndex: () => number;
6
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAEjD,eAAO,MAAM,kBAAkB,yDAAsD,CAAA;AAErF,eAAO,MAAM,eAAe,iCAA2B,CAAA;AAEvD,eAAO,MAAM,cAAc,+BAM1B,CAAA;AAED,eAAO,MAAM,WAAW,cAAoC,CAAA"}
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { CollapsibleTabViewProps, CollapsibleTabViewRef } from "./types";
3
+ export { TabFlatList } from "./TabFlatList";
4
+ export { TabScrollView } from "./TabScrollView";
5
+ export type { CollapsibleTabViewProps, CollapsibleTabViewRef, TabBarProps, } from "./types";
6
+ declare const CollapsibleTabView: React.ForwardRefExoticComponent<CollapsibleTabViewProps & React.RefAttributes<CollapsibleTabViewRef>>;
7
+ export default CollapsibleTabView;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAaf,OAAO,EAEL,uBAAuB,EACvB,qBAAqB,EAEtB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EACV,uBAAuB,EACvB,qBAAqB,EACrB,WAAW,GACZ,MAAM,SAAS,CAAC;AAEjB,QAAA,MAAM,kBAAkB,uGAySvB,CAAC;AAwBF,eAAe,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,446 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.tsx
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ TabFlatList: () => TabFlatList,
34
+ TabScrollView: () => TabScrollView,
35
+ default: () => index_default
36
+ });
37
+ module.exports = __toCommonJS(index_exports);
38
+ var import_react4 = __toESM(require("react"));
39
+ var import_react_native3 = require("react-native");
40
+ var import_react_native_pager_view = __toESM(require("react-native-pager-view"));
41
+
42
+ // src/context.ts
43
+ var import_react = require("react");
44
+ var CollapsibleContext = (0, import_react.createContext)(null);
45
+ var TabIndexContext = (0, import_react.createContext)(0);
46
+ var useCollapsible = () => {
47
+ const ctx = (0, import_react.useContext)(CollapsibleContext);
48
+ if (!ctx) {
49
+ throw new Error("useCollapsible must be used within CollapsibleTabView");
50
+ }
51
+ return ctx;
52
+ };
53
+ var useTabIndex = () => (0, import_react.useContext)(TabIndexContext);
54
+
55
+ // src/TabFlatList.tsx
56
+ var import_react2 = __toESM(require("react"));
57
+ var import_react_native = require("react-native");
58
+ var AnimatedFlatListComponent = import_react_native.Animated.createAnimatedComponent(import_react_native.FlatList);
59
+ var AnimatedFlatList = AnimatedFlatListComponent;
60
+ var TabFlatListInner = ({
61
+ contentContainerStyle,
62
+ onScroll,
63
+ ListHeaderComponent,
64
+ ...props
65
+ }, ref) => {
66
+ const index = useTabIndex();
67
+ const {
68
+ scrollY,
69
+ activeIndex,
70
+ stickyEnabled,
71
+ headerHeight,
72
+ tabBarHeight,
73
+ renderHeader,
74
+ renderTabBar,
75
+ registerRef,
76
+ syncScrollY
77
+ } = useCollapsible();
78
+ const innerRef = (0, import_react2.useRef)(null);
79
+ const isActive = activeIndex === index;
80
+ (0, import_react2.useEffect)(() => {
81
+ registerRef(index, innerRef.current);
82
+ return () => registerRef(index, null);
83
+ }, [index]);
84
+ (0, import_react2.useImperativeHandle)(ref, () => innerRef.current, []);
85
+ const handleScroll = (0, import_react2.useCallback)(
86
+ (e) => {
87
+ const y = e.nativeEvent.contentOffset.y;
88
+ syncScrollY(index, y);
89
+ onScroll?.(e);
90
+ },
91
+ [index, onScroll, syncScrollY]
92
+ );
93
+ const mergedHeader = (0, import_react2.useMemo)(() => {
94
+ if (stickyEnabled) return ListHeaderComponent;
95
+ const OriginalHeader = typeof ListHeaderComponent === "function" ? /* @__PURE__ */ import_react2.default.createElement(ListHeaderComponent, null) : ListHeaderComponent ?? null;
96
+ return /* @__PURE__ */ import_react2.default.createElement(import_react_native.View, null, renderHeader?.(), renderTabBar?.(), OriginalHeader);
97
+ }, [stickyEnabled, ListHeaderComponent, renderHeader, renderTabBar]);
98
+ const paddingTop = stickyEnabled ? headerHeight + tabBarHeight : 0;
99
+ const collapseRange = stickyEnabled ? headerHeight : 0;
100
+ const [containerHeight, setContainerHeight] = (0, import_react2.useState)(0);
101
+ const handleLayout = (0, import_react2.useCallback)((e) => {
102
+ setContainerHeight(e.nativeEvent.layout.height);
103
+ }, []);
104
+ const minHeight = containerHeight > 0 ? containerHeight + collapseRange : 0;
105
+ return /* @__PURE__ */ import_react2.default.createElement(
106
+ AnimatedFlatList,
107
+ {
108
+ ...props,
109
+ ref: innerRef,
110
+ onLayout: handleLayout,
111
+ ListHeaderComponent: mergedHeader,
112
+ contentContainerStyle: [
113
+ paddingTop > 0 && { paddingTop },
114
+ minHeight > 0 && { minHeight },
115
+ contentContainerStyle
116
+ ],
117
+ onScroll: isActive && stickyEnabled ? import_react_native.Animated.event(
118
+ [{ nativeEvent: { contentOffset: { y: scrollY } } }],
119
+ {
120
+ useNativeDriver: true,
121
+ listener: handleScroll
122
+ }
123
+ ) : handleScroll,
124
+ scrollEventThrottle: 16,
125
+ showsVerticalScrollIndicator: false
126
+ }
127
+ );
128
+ };
129
+ var TabFlatList = (0, import_react2.forwardRef)(TabFlatListInner);
130
+
131
+ // src/TabScrollView.tsx
132
+ var import_react3 = __toESM(require("react"));
133
+ var import_react_native2 = require("react-native");
134
+ var TabScrollView = (0, import_react3.forwardRef)(
135
+ ({ contentContainerStyle, onScroll, children, ...props }, ref) => {
136
+ const index = useTabIndex();
137
+ const { scrollY, activeIndex, headerHeight, tabBarHeight, registerRef, syncScrollY } = useCollapsible();
138
+ const innerRef = (0, import_react3.useRef)(null);
139
+ const isActive = activeIndex === index;
140
+ (0, import_react3.useEffect)(() => {
141
+ registerRef(index, innerRef.current);
142
+ return () => registerRef(index, null);
143
+ }, [index]);
144
+ (0, import_react3.useImperativeHandle)(ref, () => innerRef.current, []);
145
+ const handleScroll = (0, import_react3.useCallback)(
146
+ (e) => {
147
+ const y = e.nativeEvent.contentOffset.y;
148
+ syncScrollY(index, y);
149
+ onScroll?.(e);
150
+ },
151
+ [index, onScroll, syncScrollY]
152
+ );
153
+ const paddingTop = headerHeight + tabBarHeight;
154
+ const collapseRange = headerHeight;
155
+ const [containerHeight, setContainerHeight] = (0, import_react3.useState)(0);
156
+ const handleLayout = (0, import_react3.useCallback)((e) => {
157
+ setContainerHeight(e.nativeEvent.layout.height);
158
+ }, []);
159
+ const minHeight = containerHeight > 0 ? containerHeight + collapseRange : 0;
160
+ return /* @__PURE__ */ import_react3.default.createElement(
161
+ import_react_native2.Animated.ScrollView,
162
+ {
163
+ ref: innerRef,
164
+ ...props,
165
+ onLayout: handleLayout,
166
+ contentContainerStyle: [
167
+ { paddingTop },
168
+ minHeight > 0 && { minHeight },
169
+ contentContainerStyle
170
+ ],
171
+ onScroll: isActive ? import_react_native2.Animated.event([{ nativeEvent: { contentOffset: { y: scrollY } } }], {
172
+ useNativeDriver: true,
173
+ listener: handleScroll
174
+ }) : handleScroll,
175
+ scrollEventThrottle: 16,
176
+ showsVerticalScrollIndicator: false
177
+ },
178
+ children
179
+ );
180
+ }
181
+ );
182
+
183
+ // src/index.tsx
184
+ var CollapsibleTabView = (0, import_react4.forwardRef)(
185
+ ({
186
+ children,
187
+ renderHeader,
188
+ estimatedHeaderHeight = 0,
189
+ estimatedTabBarHeight = 0,
190
+ stickyEnabled = true,
191
+ stickyTop = 0,
192
+ renderTabBar,
193
+ initialTabIndex = 0,
194
+ onTabChange,
195
+ onScroll: onScrollProp,
196
+ swipeEnabled = true,
197
+ style
198
+ }, ref) => {
199
+ const [activeIndex, setActiveIndex] = (0, import_react4.useState)(initialTabIndex);
200
+ const pagerRef = (0, import_react4.useRef)(null);
201
+ const pages = (0, import_react4.useMemo)(
202
+ () => import_react4.default.Children.toArray(children).filter(import_react4.default.isValidElement),
203
+ [children]
204
+ );
205
+ (0, import_react4.useImperativeHandle)(ref, () => ({
206
+ scrollToTab: (index, animated = true) => {
207
+ if (index === activeIndex || index < 0 || index >= pages.length) return;
208
+ syncTabOnSwitch(index);
209
+ setActiveIndex(index);
210
+ if (animated) {
211
+ pagerRef.current?.setPage(index);
212
+ } else {
213
+ pagerRef.current?.setPageWithoutAnimation(index);
214
+ }
215
+ onTabChange?.(index);
216
+ },
217
+ getActiveIndex: () => activeIndex
218
+ }));
219
+ const hasEstimate = estimatedHeaderHeight > 0;
220
+ const headerHeightRef = (0, import_react4.useRef)(0);
221
+ const tabBarHeightRef = (0, import_react4.useRef)(0);
222
+ const [layout, setLayout] = (0, import_react4.useState)({
223
+ headerHeight: estimatedHeaderHeight,
224
+ tabBarHeight: estimatedTabBarHeight,
225
+ ready: hasEstimate
226
+ });
227
+ const { headerHeight, tabBarHeight } = layout;
228
+ const visible = layout.ready;
229
+ const adjustY = (0, import_react4.useRef)(new import_react_native3.Animated.Value(0)).current;
230
+ const tryCommitLayout = (0, import_react4.useCallback)(() => {
231
+ const h = headerHeightRef.current;
232
+ const t = tabBarHeightRef.current;
233
+ if (h > 0 && t > 0) {
234
+ setLayout((prev) => {
235
+ if (Math.abs(prev.headerHeight - h) <= 1 && Math.abs(prev.tabBarHeight - t) <= 1) {
236
+ return prev;
237
+ }
238
+ const diff = h + t - (prev.headerHeight + prev.tabBarHeight);
239
+ if (prev.ready && Math.abs(diff) > 1) {
240
+ adjustY.setValue(-diff);
241
+ import_react_native3.Animated.timing(adjustY, {
242
+ toValue: 0,
243
+ duration: 200,
244
+ useNativeDriver: true
245
+ }).start();
246
+ }
247
+ return { headerHeight: h, tabBarHeight: t, ready: true };
248
+ });
249
+ }
250
+ }, []);
251
+ const handleHeaderLayout = (0, import_react4.useCallback)(
252
+ (e) => {
253
+ headerHeightRef.current = e.nativeEvent.layout.height;
254
+ tryCommitLayout();
255
+ },
256
+ [tryCommitLayout]
257
+ );
258
+ const handleTabBarLayout = (0, import_react4.useCallback)(
259
+ (e) => {
260
+ tabBarHeightRef.current = e.nativeEvent.layout.height;
261
+ tryCommitLayout();
262
+ },
263
+ [tryCommitLayout]
264
+ );
265
+ const scrollY = (0, import_react4.useRef)(new import_react_native3.Animated.Value(0)).current;
266
+ const tabScrollYMap = (0, import_react4.useRef)(/* @__PURE__ */ new Map());
267
+ const tabRefs = (0, import_react4.useRef)(
268
+ /* @__PURE__ */ new Map()
269
+ );
270
+ const collapseRange = stickyEnabled ? Math.max(headerHeight - stickyTop, 0) : 0;
271
+ const headerTranslateY = (0, import_react4.useMemo)(
272
+ () => collapseRange > 0 ? scrollY.interpolate({
273
+ inputRange: [0, collapseRange],
274
+ outputRange: [0, -collapseRange],
275
+ extrapolate: "clamp"
276
+ }) : new import_react_native3.Animated.Value(0),
277
+ [scrollY, collapseRange]
278
+ );
279
+ const registerRef = (0, import_react4.useCallback)(
280
+ (index, ref2) => {
281
+ if (ref2) {
282
+ tabRefs.current.set(index, ref2);
283
+ } else {
284
+ tabRefs.current.delete(index);
285
+ }
286
+ },
287
+ []
288
+ );
289
+ const syncScrollY = (0, import_react4.useCallback)(
290
+ (index, y) => {
291
+ tabScrollYMap.current.set(index, y);
292
+ onScrollProp?.(y);
293
+ },
294
+ [onScrollProp]
295
+ );
296
+ const scrollTabTo = (0, import_react4.useCallback)((index, offset) => {
297
+ const ref2 = tabRefs.current.get(index);
298
+ if (!ref2) return;
299
+ if (ref2.scrollToOffset) {
300
+ ref2.scrollToOffset({ offset, animated: false });
301
+ } else if (ref2.scrollTo) {
302
+ ref2.scrollTo({ y: offset, animated: false });
303
+ } else if (ref2.getNode) {
304
+ const node = ref2.getNode();
305
+ if (node?.scrollToOffset) {
306
+ node.scrollToOffset({ offset, animated: false });
307
+ } else if (node?.scrollTo) {
308
+ node.scrollTo({ y: offset, animated: false });
309
+ }
310
+ }
311
+ }, []);
312
+ const syncTabOnSwitch = (0, import_react4.useCallback)(
313
+ (newIndex) => {
314
+ const currentY = tabScrollYMap.current.get(activeIndex) ?? 0;
315
+ const newTabSavedY = tabScrollYMap.current.get(newIndex) ?? 0;
316
+ const isCollapsed = currentY >= collapseRange - 1;
317
+ let targetY;
318
+ if (isCollapsed) {
319
+ targetY = Math.max(newTabSavedY, collapseRange);
320
+ } else {
321
+ targetY = Math.min(currentY, collapseRange);
322
+ }
323
+ import_react_native3.InteractionManager.runAfterInteractions(() => {
324
+ scrollTabTo(newIndex, targetY);
325
+ tabScrollYMap.current.set(newIndex, targetY);
326
+ scrollY.setValue(Math.min(targetY, collapseRange));
327
+ });
328
+ },
329
+ [activeIndex, collapseRange, scrollTabTo, scrollY]
330
+ );
331
+ const handleTabPress = (0, import_react4.useCallback)(
332
+ (index) => {
333
+ if (index === activeIndex) return;
334
+ syncTabOnSwitch(index);
335
+ setActiveIndex(index);
336
+ pagerRef.current?.setPageWithoutAnimation(index);
337
+ onTabChange?.(index);
338
+ },
339
+ [activeIndex, onTabChange, syncTabOnSwitch]
340
+ );
341
+ const handlePageSelected = (0, import_react4.useCallback)(
342
+ (e) => {
343
+ const newIndex = e.nativeEvent.position;
344
+ if (newIndex === activeIndex) return;
345
+ syncTabOnSwitch(newIndex);
346
+ setActiveIndex(newIndex);
347
+ onTabChange?.(newIndex);
348
+ },
349
+ [activeIndex, onTabChange, syncTabOnSwitch]
350
+ );
351
+ const tabBarProps = (0, import_react4.useMemo)(
352
+ () => ({
353
+ activeIndex,
354
+ onTabPress: handleTabPress
355
+ }),
356
+ [activeIndex, handleTabPress]
357
+ );
358
+ const renderTabBarNode = (0, import_react4.useCallback)(
359
+ () => renderTabBar(tabBarProps),
360
+ [renderTabBar, tabBarProps]
361
+ );
362
+ const contextValue = (0, import_react4.useMemo)(
363
+ () => ({
364
+ scrollY,
365
+ activeIndex,
366
+ stickyEnabled,
367
+ headerHeight,
368
+ tabBarHeight,
369
+ renderHeader: stickyEnabled ? void 0 : renderHeader,
370
+ renderTabBar: stickyEnabled ? void 0 : renderTabBarNode,
371
+ registerRef,
372
+ syncScrollY
373
+ }),
374
+ [
375
+ scrollY,
376
+ activeIndex,
377
+ stickyEnabled,
378
+ headerHeight,
379
+ tabBarHeight,
380
+ renderHeader,
381
+ renderTabBarNode,
382
+ registerRef,
383
+ syncScrollY
384
+ ]
385
+ );
386
+ return /* @__PURE__ */ import_react4.default.createElement(CollapsibleContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react4.default.createElement(import_react_native3.View, { style: [styles.container, style] }, /* @__PURE__ */ import_react4.default.createElement(
387
+ import_react_native3.Animated.View,
388
+ {
389
+ style: [
390
+ styles.pager,
391
+ !visible && styles.hidden,
392
+ { transform: [{ translateY: adjustY }] }
393
+ ]
394
+ },
395
+ /* @__PURE__ */ import_react4.default.createElement(
396
+ import_react_native_pager_view.default,
397
+ {
398
+ ref: pagerRef,
399
+ style: styles.pager,
400
+ initialPage: initialTabIndex,
401
+ onPageSelected: handlePageSelected,
402
+ scrollEnabled: swipeEnabled
403
+ },
404
+ pages.map((page, i) => /* @__PURE__ */ import_react4.default.createElement(import_react_native3.View, { key: page?.key ?? i, style: styles.page }, /* @__PURE__ */ import_react4.default.createElement(TabIndexContext.Provider, { value: i }, page)))
405
+ )
406
+ ), stickyEnabled && /* @__PURE__ */ import_react4.default.createElement(
407
+ import_react_native3.Animated.View,
408
+ {
409
+ style: [
410
+ styles.overlay,
411
+ { transform: [{ translateY: headerTranslateY }] }
412
+ ],
413
+ pointerEvents: "box-none"
414
+ },
415
+ /* @__PURE__ */ import_react4.default.createElement(import_react_native3.View, { pointerEvents: "box-none", onLayout: handleHeaderLayout }, renderHeader()),
416
+ /* @__PURE__ */ import_react4.default.createElement(import_react_native3.View, { onLayout: handleTabBarLayout }, renderTabBarNode())
417
+ )));
418
+ }
419
+ );
420
+ var styles = import_react_native3.StyleSheet.create({
421
+ container: {
422
+ flex: 1
423
+ },
424
+ pager: {
425
+ flex: 1
426
+ },
427
+ hidden: {
428
+ opacity: 0
429
+ },
430
+ page: {
431
+ flex: 1
432
+ },
433
+ overlay: {
434
+ position: "absolute",
435
+ top: 0,
436
+ left: 0,
437
+ right: 0,
438
+ zIndex: 10
439
+ }
440
+ });
441
+ var index_default = CollapsibleTabView;
442
+ // Annotate the CommonJS export names for ESM import in node:
443
+ 0 && (module.exports = {
444
+ TabFlatList,
445
+ TabScrollView
446
+ });