react-native-collapsible-header-tab-view 1.0.4 → 1.0.5
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 +33 -8
- package/dist/index.js +112 -42
- package/dist/index.mjs +128 -47
- package/dist/src/TabSectionList.d.ts +9 -0
- package/dist/src/TabSectionList.d.ts.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +2 -2
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
✨ **轻量级** - 不依赖 react-native-reanimated
|
|
10
10
|
🎯 **高性能** - 优化的滚动性能
|
|
11
11
|
📱 **吸顶效果** - 完整的粘性头部和标签栏支持
|
|
12
|
-
🔄 **灵活** - 支持 FlatList 和 ScrollView
|
|
12
|
+
🔄 **灵活** - 支持 FlatList、SectionList 和 ScrollView
|
|
13
13
|
⚡ **TypeScript** - 完整的类型支持
|
|
14
14
|
|
|
15
15
|
## 安装
|
|
@@ -31,8 +31,18 @@ npm install react-native-pager-view
|
|
|
31
31
|
|
|
32
32
|
### 基础示例
|
|
33
33
|
|
|
34
|
+
`TabFlatList`、`TabSectionList`、`TabScrollView` 可以在同一个 `CollapsibleTabView` 中混合使用,每个子组件对应一个 Tab 页。
|
|
35
|
+
|
|
34
36
|
```jsx
|
|
35
|
-
import CollapsibleTabView
|
|
37
|
+
import CollapsibleTabView, {
|
|
38
|
+
TabFlatList,
|
|
39
|
+
TabSectionList,
|
|
40
|
+
} from 'react-native-collapsible-header-tab-view';
|
|
41
|
+
|
|
42
|
+
const sections = [
|
|
43
|
+
{ title: 'A', data: ['Alice', 'Amy'] },
|
|
44
|
+
{ title: 'B', data: ['Bob', 'Ben'] },
|
|
45
|
+
];
|
|
36
46
|
|
|
37
47
|
export function App() {
|
|
38
48
|
return (
|
|
@@ -40,15 +50,18 @@ export function App() {
|
|
|
40
50
|
renderHeader={() => <HeaderComponent />}
|
|
41
51
|
renderTabBar={(props) => <TabBarComponent {...props} />}
|
|
42
52
|
>
|
|
53
|
+
{/* Tab 1: FlatList */}
|
|
43
54
|
<TabFlatList
|
|
44
|
-
data={
|
|
55
|
+
data={data}
|
|
45
56
|
renderItem={({ item }) => <ItemComponent item={item} />}
|
|
46
57
|
keyExtractor={(item) => item.id}
|
|
47
58
|
/>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
{/* Tab 2: SectionList */}
|
|
60
|
+
<TabSectionList
|
|
61
|
+
sections={sections}
|
|
62
|
+
renderItem={({ item }) => <Text>{item}</Text>}
|
|
63
|
+
renderSectionHeader={({ section }) => <Text>{section.title}</Text>}
|
|
64
|
+
keyExtractor={(item, index) => item + index}
|
|
52
65
|
/>
|
|
53
66
|
</CollapsibleTabView>
|
|
54
67
|
);
|
|
@@ -75,13 +88,25 @@ export function App() {
|
|
|
75
88
|
|
|
76
89
|
### TabFlatList
|
|
77
90
|
|
|
91
|
+
继承所有 `FlatList` 的 Props。
|
|
92
|
+
|
|
78
93
|
| 属性 | 类型 | 说明 |
|
|
79
94
|
|------|------|------|
|
|
80
|
-
| index | `number` | 必需,标签页索引 |
|
|
81
95
|
| data | `T[]` | 列表数据 |
|
|
82
96
|
| renderItem | `(info: { item: T, index: number }) => ReactNode` | 列表项渲染函数 |
|
|
83
97
|
| keyExtractor | `(item: T, index: number) => string` | 列表项 key |
|
|
84
98
|
|
|
99
|
+
### TabSectionList
|
|
100
|
+
|
|
101
|
+
继承所有 `SectionList` 的 Props。
|
|
102
|
+
|
|
103
|
+
| 属性 | 类型 | 说明 |
|
|
104
|
+
|------|------|------|
|
|
105
|
+
| sections | `SectionListData[]` | 分组数据 |
|
|
106
|
+
| renderItem | `(info: { item: T, index: number, section: S }) => ReactNode` | 列表项渲染函数 |
|
|
107
|
+
| renderSectionHeader | `(info: { section: S }) => ReactNode` | 分组头部渲染函数 |
|
|
108
|
+
| keyExtractor | `(item: T, index: number) => string` | 列表项 key |
|
|
109
|
+
|
|
85
110
|
## Ref Methods
|
|
86
111
|
|
|
87
112
|
```typescript
|
package/dist/index.js
CHANGED
|
@@ -32,11 +32,12 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
TabFlatList: () => TabFlatList,
|
|
34
34
|
TabScrollView: () => TabScrollView,
|
|
35
|
+
TabSectionList: () => TabSectionList,
|
|
35
36
|
default: () => index_default
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(index_exports);
|
|
38
|
-
var
|
|
39
|
-
var
|
|
39
|
+
var import_react5 = __toESM(require("react"));
|
|
40
|
+
var import_react_native4 = require("react-native");
|
|
40
41
|
var import_react_native_pager_view = __toESM(require("react-native-pager-view"));
|
|
41
42
|
|
|
42
43
|
// src/context.ts
|
|
@@ -180,8 +181,76 @@ var TabScrollView = (0, import_react3.forwardRef)(
|
|
|
180
181
|
}
|
|
181
182
|
);
|
|
182
183
|
|
|
184
|
+
// src/TabSectionList.tsx
|
|
185
|
+
var import_react4 = __toESM(require("react"));
|
|
186
|
+
var import_react_native3 = require("react-native");
|
|
187
|
+
var AnimatedSectionListComponent = import_react_native3.Animated.createAnimatedComponent(import_react_native3.SectionList);
|
|
188
|
+
var AnimatedSectionList = AnimatedSectionListComponent;
|
|
189
|
+
var TabSectionListInner = ({ contentContainerStyle, onScroll, ListHeaderComponent, ...props }, ref) => {
|
|
190
|
+
const index = useTabIndex();
|
|
191
|
+
const {
|
|
192
|
+
scrollY,
|
|
193
|
+
activeIndex,
|
|
194
|
+
stickyEnabled,
|
|
195
|
+
headerHeight,
|
|
196
|
+
tabBarHeight,
|
|
197
|
+
renderHeader,
|
|
198
|
+
renderTabBar,
|
|
199
|
+
registerRef,
|
|
200
|
+
syncScrollY
|
|
201
|
+
} = useCollapsible();
|
|
202
|
+
const innerRef = (0, import_react4.useRef)(null);
|
|
203
|
+
const isActive = activeIndex === index;
|
|
204
|
+
(0, import_react4.useEffect)(() => {
|
|
205
|
+
registerRef(index, innerRef.current);
|
|
206
|
+
return () => registerRef(index, null);
|
|
207
|
+
}, [index]);
|
|
208
|
+
(0, import_react4.useImperativeHandle)(ref, () => innerRef.current, []);
|
|
209
|
+
const handleScroll = (0, import_react4.useCallback)(
|
|
210
|
+
(e) => {
|
|
211
|
+
const y = e.nativeEvent.contentOffset.y;
|
|
212
|
+
syncScrollY(index, y);
|
|
213
|
+
onScroll?.(e);
|
|
214
|
+
},
|
|
215
|
+
[index, onScroll, syncScrollY]
|
|
216
|
+
);
|
|
217
|
+
const mergedHeader = (0, import_react4.useMemo)(() => {
|
|
218
|
+
if (stickyEnabled) return ListHeaderComponent;
|
|
219
|
+
const OriginalHeader = typeof ListHeaderComponent === "function" ? /* @__PURE__ */ import_react4.default.createElement(ListHeaderComponent, null) : ListHeaderComponent ?? null;
|
|
220
|
+
return /* @__PURE__ */ import_react4.default.createElement(import_react_native3.View, null, renderHeader?.(), renderTabBar?.(), OriginalHeader);
|
|
221
|
+
}, [stickyEnabled, ListHeaderComponent, renderHeader, renderTabBar]);
|
|
222
|
+
const paddingTop = stickyEnabled ? headerHeight + tabBarHeight : 0;
|
|
223
|
+
const collapseRange = stickyEnabled ? headerHeight : 0;
|
|
224
|
+
const [containerHeight, setContainerHeight] = (0, import_react4.useState)(0);
|
|
225
|
+
const handleLayout = (0, import_react4.useCallback)((e) => {
|
|
226
|
+
setContainerHeight(e.nativeEvent.layout.height);
|
|
227
|
+
}, []);
|
|
228
|
+
const minHeight = containerHeight > 0 ? containerHeight + collapseRange : 0;
|
|
229
|
+
return /* @__PURE__ */ import_react4.default.createElement(
|
|
230
|
+
AnimatedSectionList,
|
|
231
|
+
{
|
|
232
|
+
...props,
|
|
233
|
+
ref: innerRef,
|
|
234
|
+
onLayout: handleLayout,
|
|
235
|
+
ListHeaderComponent: mergedHeader,
|
|
236
|
+
contentContainerStyle: [
|
|
237
|
+
paddingTop > 0 && { paddingTop },
|
|
238
|
+
minHeight > 0 && { minHeight },
|
|
239
|
+
contentContainerStyle
|
|
240
|
+
],
|
|
241
|
+
onScroll: isActive && stickyEnabled ? import_react_native3.Animated.event([{ nativeEvent: { contentOffset: { y: scrollY } } }], {
|
|
242
|
+
useNativeDriver: true,
|
|
243
|
+
listener: handleScroll
|
|
244
|
+
}) : handleScroll,
|
|
245
|
+
scrollEventThrottle: 16,
|
|
246
|
+
showsVerticalScrollIndicator: false
|
|
247
|
+
}
|
|
248
|
+
);
|
|
249
|
+
};
|
|
250
|
+
var TabSectionList = (0, import_react4.forwardRef)(TabSectionListInner);
|
|
251
|
+
|
|
183
252
|
// src/index.tsx
|
|
184
|
-
var CollapsibleTabView = (0,
|
|
253
|
+
var CollapsibleTabView = (0, import_react5.forwardRef)(
|
|
185
254
|
({
|
|
186
255
|
children,
|
|
187
256
|
renderHeader,
|
|
@@ -196,13 +265,13 @@ var CollapsibleTabView = (0, import_react4.forwardRef)(
|
|
|
196
265
|
swipeEnabled = true,
|
|
197
266
|
style
|
|
198
267
|
}, ref) => {
|
|
199
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
200
|
-
const pagerRef = (0,
|
|
201
|
-
const pages = (0,
|
|
202
|
-
() =>
|
|
268
|
+
const [activeIndex, setActiveIndex] = (0, import_react5.useState)(initialTabIndex);
|
|
269
|
+
const pagerRef = (0, import_react5.useRef)(null);
|
|
270
|
+
const pages = (0, import_react5.useMemo)(
|
|
271
|
+
() => import_react5.default.Children.toArray(children).filter(import_react5.default.isValidElement),
|
|
203
272
|
[children]
|
|
204
273
|
);
|
|
205
|
-
(0,
|
|
274
|
+
(0, import_react5.useImperativeHandle)(ref, () => ({
|
|
206
275
|
scrollToTab: (index, animated = true) => {
|
|
207
276
|
if (index === activeIndex || index < 0 || index >= pages.length) return;
|
|
208
277
|
syncTabOnSwitch(index);
|
|
@@ -217,17 +286,17 @@ var CollapsibleTabView = (0, import_react4.forwardRef)(
|
|
|
217
286
|
getActiveIndex: () => activeIndex
|
|
218
287
|
}));
|
|
219
288
|
const hasEstimate = estimatedHeaderHeight > 0;
|
|
220
|
-
const headerHeightRef = (0,
|
|
221
|
-
const tabBarHeightRef = (0,
|
|
222
|
-
const [layout, setLayout] = (0,
|
|
289
|
+
const headerHeightRef = (0, import_react5.useRef)(0);
|
|
290
|
+
const tabBarHeightRef = (0, import_react5.useRef)(0);
|
|
291
|
+
const [layout, setLayout] = (0, import_react5.useState)({
|
|
223
292
|
headerHeight: estimatedHeaderHeight,
|
|
224
293
|
tabBarHeight: estimatedTabBarHeight,
|
|
225
294
|
ready: hasEstimate
|
|
226
295
|
});
|
|
227
296
|
const { headerHeight, tabBarHeight } = layout;
|
|
228
297
|
const visible = layout.ready;
|
|
229
|
-
const adjustY = (0,
|
|
230
|
-
const tryCommitLayout = (0,
|
|
298
|
+
const adjustY = (0, import_react5.useRef)(new import_react_native4.Animated.Value(0)).current;
|
|
299
|
+
const tryCommitLayout = (0, import_react5.useCallback)(() => {
|
|
231
300
|
const h = headerHeightRef.current;
|
|
232
301
|
const t = tabBarHeightRef.current;
|
|
233
302
|
if (h > 0 && t > 0) {
|
|
@@ -238,7 +307,7 @@ var CollapsibleTabView = (0, import_react4.forwardRef)(
|
|
|
238
307
|
const diff = h + t - (prev.headerHeight + prev.tabBarHeight);
|
|
239
308
|
if (prev.ready && Math.abs(diff) > 1) {
|
|
240
309
|
adjustY.setValue(-diff);
|
|
241
|
-
|
|
310
|
+
import_react_native4.Animated.timing(adjustY, {
|
|
242
311
|
toValue: 0,
|
|
243
312
|
duration: 200,
|
|
244
313
|
useNativeDriver: true
|
|
@@ -248,35 +317,35 @@ var CollapsibleTabView = (0, import_react4.forwardRef)(
|
|
|
248
317
|
});
|
|
249
318
|
}
|
|
250
319
|
}, [adjustY]);
|
|
251
|
-
const handleHeaderLayout = (0,
|
|
320
|
+
const handleHeaderLayout = (0, import_react5.useCallback)(
|
|
252
321
|
(e) => {
|
|
253
322
|
headerHeightRef.current = e.nativeEvent.layout.height;
|
|
254
323
|
tryCommitLayout();
|
|
255
324
|
},
|
|
256
325
|
[tryCommitLayout]
|
|
257
326
|
);
|
|
258
|
-
const handleTabBarLayout = (0,
|
|
327
|
+
const handleTabBarLayout = (0, import_react5.useCallback)(
|
|
259
328
|
(e) => {
|
|
260
329
|
tabBarHeightRef.current = e.nativeEvent.layout.height;
|
|
261
330
|
tryCommitLayout();
|
|
262
331
|
},
|
|
263
332
|
[tryCommitLayout]
|
|
264
333
|
);
|
|
265
|
-
const scrollY = (0,
|
|
266
|
-
const tabScrollYMap = (0,
|
|
267
|
-
const tabRefs = (0,
|
|
334
|
+
const scrollY = (0, import_react5.useRef)(new import_react_native4.Animated.Value(0)).current;
|
|
335
|
+
const tabScrollYMap = (0, import_react5.useRef)(/* @__PURE__ */ new Map());
|
|
336
|
+
const tabRefs = (0, import_react5.useRef)(
|
|
268
337
|
/* @__PURE__ */ new Map()
|
|
269
338
|
);
|
|
270
339
|
const collapseRange = stickyEnabled ? Math.max(headerHeight - stickyTop, 0) : 0;
|
|
271
|
-
const headerTranslateY = (0,
|
|
340
|
+
const headerTranslateY = (0, import_react5.useMemo)(
|
|
272
341
|
() => collapseRange > 0 ? scrollY.interpolate({
|
|
273
342
|
inputRange: [0, collapseRange],
|
|
274
343
|
outputRange: [0, -collapseRange],
|
|
275
344
|
extrapolate: "clamp"
|
|
276
|
-
}) : new
|
|
345
|
+
}) : new import_react_native4.Animated.Value(0),
|
|
277
346
|
[scrollY, collapseRange]
|
|
278
347
|
);
|
|
279
|
-
const registerRef = (0,
|
|
348
|
+
const registerRef = (0, import_react5.useCallback)(
|
|
280
349
|
(index, ref2) => {
|
|
281
350
|
if (ref2) {
|
|
282
351
|
tabRefs.current.set(index, ref2);
|
|
@@ -286,14 +355,14 @@ var CollapsibleTabView = (0, import_react4.forwardRef)(
|
|
|
286
355
|
},
|
|
287
356
|
[]
|
|
288
357
|
);
|
|
289
|
-
const syncScrollY = (0,
|
|
358
|
+
const syncScrollY = (0, import_react5.useCallback)(
|
|
290
359
|
(index, y) => {
|
|
291
360
|
tabScrollYMap.current.set(index, y);
|
|
292
361
|
onScrollProp?.(y);
|
|
293
362
|
},
|
|
294
363
|
[onScrollProp]
|
|
295
364
|
);
|
|
296
|
-
const scrollTabTo = (0,
|
|
365
|
+
const scrollTabTo = (0, import_react5.useCallback)((index, offset) => {
|
|
297
366
|
const ref2 = tabRefs.current.get(index);
|
|
298
367
|
if (!ref2) return;
|
|
299
368
|
if (ref2.scrollToOffset) {
|
|
@@ -309,7 +378,7 @@ var CollapsibleTabView = (0, import_react4.forwardRef)(
|
|
|
309
378
|
}
|
|
310
379
|
}
|
|
311
380
|
}, []);
|
|
312
|
-
const syncTabOnSwitch = (0,
|
|
381
|
+
const syncTabOnSwitch = (0, import_react5.useCallback)((newIndex) => {
|
|
313
382
|
const currentY = tabScrollYMap.current.get(activeIndex) ?? 0;
|
|
314
383
|
const newTabSavedY = tabScrollYMap.current.get(newIndex) ?? 0;
|
|
315
384
|
const isCollapsed = currentY >= collapseRange - 1;
|
|
@@ -318,7 +387,7 @@ var CollapsibleTabView = (0, import_react4.forwardRef)(
|
|
|
318
387
|
tabScrollYMap.current.set(newIndex, targetY);
|
|
319
388
|
scrollY.setValue(Math.min(targetY, collapseRange));
|
|
320
389
|
}, []);
|
|
321
|
-
const preSyncAdjacentTabs = (0,
|
|
390
|
+
const preSyncAdjacentTabs = (0, import_react5.useCallback)(() => {
|
|
322
391
|
const currentY = tabScrollYMap.current.get(activeIndex) ?? 0;
|
|
323
392
|
const isCollapsed = currentY >= collapseRange - 1;
|
|
324
393
|
for (const i of [activeIndex - 1, activeIndex + 1]) {
|
|
@@ -329,7 +398,7 @@ var CollapsibleTabView = (0, import_react4.forwardRef)(
|
|
|
329
398
|
tabScrollYMap.current.set(i, targetY);
|
|
330
399
|
}
|
|
331
400
|
}, [activeIndex, collapseRange, pages.length, scrollTabTo]);
|
|
332
|
-
const handlePageScrollStateChanged = (0,
|
|
401
|
+
const handlePageScrollStateChanged = (0, import_react5.useCallback)(
|
|
333
402
|
(e) => {
|
|
334
403
|
if (e.nativeEvent.pageScrollState === "dragging") {
|
|
335
404
|
preSyncAdjacentTabs();
|
|
@@ -337,7 +406,7 @@ var CollapsibleTabView = (0, import_react4.forwardRef)(
|
|
|
337
406
|
},
|
|
338
407
|
[preSyncAdjacentTabs]
|
|
339
408
|
);
|
|
340
|
-
const handleTabPress = (0,
|
|
409
|
+
const handleTabPress = (0, import_react5.useCallback)(
|
|
341
410
|
(index) => {
|
|
342
411
|
if (index === activeIndex) return;
|
|
343
412
|
syncTabOnSwitch(index);
|
|
@@ -347,7 +416,7 @@ var CollapsibleTabView = (0, import_react4.forwardRef)(
|
|
|
347
416
|
},
|
|
348
417
|
[activeIndex, syncTabOnSwitch, onTabChange]
|
|
349
418
|
);
|
|
350
|
-
const handlePageSelected = (0,
|
|
419
|
+
const handlePageSelected = (0, import_react5.useCallback)(
|
|
351
420
|
(e) => {
|
|
352
421
|
const newIndex = e.nativeEvent.position;
|
|
353
422
|
if (newIndex === activeIndex) return;
|
|
@@ -358,18 +427,18 @@ var CollapsibleTabView = (0, import_react4.forwardRef)(
|
|
|
358
427
|
},
|
|
359
428
|
[activeIndex, collapseRange, scrollY, onTabChange]
|
|
360
429
|
);
|
|
361
|
-
const tabBarProps = (0,
|
|
430
|
+
const tabBarProps = (0, import_react5.useMemo)(
|
|
362
431
|
() => ({
|
|
363
432
|
activeIndex,
|
|
364
433
|
onTabPress: handleTabPress
|
|
365
434
|
}),
|
|
366
435
|
[activeIndex, handleTabPress]
|
|
367
436
|
);
|
|
368
|
-
const renderTabBarNode = (0,
|
|
437
|
+
const renderTabBarNode = (0, import_react5.useCallback)(
|
|
369
438
|
() => renderTabBar(tabBarProps),
|
|
370
439
|
[renderTabBar, tabBarProps]
|
|
371
440
|
);
|
|
372
|
-
const contextValue = (0,
|
|
441
|
+
const contextValue = (0, import_react5.useMemo)(
|
|
373
442
|
() => ({
|
|
374
443
|
scrollY,
|
|
375
444
|
activeIndex,
|
|
@@ -393,8 +462,8 @@ var CollapsibleTabView = (0, import_react4.forwardRef)(
|
|
|
393
462
|
syncScrollY
|
|
394
463
|
]
|
|
395
464
|
);
|
|
396
|
-
return /* @__PURE__ */
|
|
397
|
-
|
|
465
|
+
return /* @__PURE__ */ import_react5.default.createElement(CollapsibleContext.Provider, { value: contextValue }, /* @__PURE__ */ import_react5.default.createElement(import_react_native4.View, { style: [styles.container, style] }, /* @__PURE__ */ import_react5.default.createElement(
|
|
466
|
+
import_react_native4.Animated.View,
|
|
398
467
|
{
|
|
399
468
|
style: [
|
|
400
469
|
styles.pager,
|
|
@@ -402,7 +471,7 @@ var CollapsibleTabView = (0, import_react4.forwardRef)(
|
|
|
402
471
|
{ transform: [{ translateY: adjustY }] }
|
|
403
472
|
]
|
|
404
473
|
},
|
|
405
|
-
/* @__PURE__ */
|
|
474
|
+
/* @__PURE__ */ import_react5.default.createElement(
|
|
406
475
|
import_react_native_pager_view.default,
|
|
407
476
|
{
|
|
408
477
|
ref: pagerRef,
|
|
@@ -412,10 +481,10 @@ var CollapsibleTabView = (0, import_react4.forwardRef)(
|
|
|
412
481
|
onPageScrollStateChanged: handlePageScrollStateChanged,
|
|
413
482
|
scrollEnabled: swipeEnabled
|
|
414
483
|
},
|
|
415
|
-
pages.map((page, i) => /* @__PURE__ */
|
|
484
|
+
pages.map((page, i) => /* @__PURE__ */ import_react5.default.createElement(import_react_native4.View, { key: page?.key ?? i, style: styles.page }, /* @__PURE__ */ import_react5.default.createElement(TabIndexContext.Provider, { value: i }, page)))
|
|
416
485
|
)
|
|
417
|
-
), stickyEnabled && /* @__PURE__ */
|
|
418
|
-
|
|
486
|
+
), stickyEnabled && /* @__PURE__ */ import_react5.default.createElement(
|
|
487
|
+
import_react_native4.Animated.View,
|
|
419
488
|
{
|
|
420
489
|
style: [
|
|
421
490
|
styles.overlay,
|
|
@@ -423,12 +492,12 @@ var CollapsibleTabView = (0, import_react4.forwardRef)(
|
|
|
423
492
|
],
|
|
424
493
|
pointerEvents: "box-none"
|
|
425
494
|
},
|
|
426
|
-
/* @__PURE__ */
|
|
427
|
-
/* @__PURE__ */
|
|
495
|
+
/* @__PURE__ */ import_react5.default.createElement(import_react_native4.View, { pointerEvents: "box-none", onLayout: handleHeaderLayout }, renderHeader()),
|
|
496
|
+
/* @__PURE__ */ import_react5.default.createElement(import_react_native4.View, { onLayout: handleTabBarLayout }, renderTabBarNode())
|
|
428
497
|
)));
|
|
429
498
|
}
|
|
430
499
|
);
|
|
431
|
-
var styles =
|
|
500
|
+
var styles = import_react_native4.StyleSheet.create({
|
|
432
501
|
container: {
|
|
433
502
|
flex: 1
|
|
434
503
|
},
|
|
@@ -453,5 +522,6 @@ var index_default = CollapsibleTabView;
|
|
|
453
522
|
// Annotate the CommonJS export names for ESM import in node:
|
|
454
523
|
0 && (module.exports = {
|
|
455
524
|
TabFlatList,
|
|
456
|
-
TabScrollView
|
|
525
|
+
TabScrollView,
|
|
526
|
+
TabSectionList
|
|
457
527
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// src/index.tsx
|
|
2
|
-
import
|
|
3
|
-
forwardRef as
|
|
4
|
-
useCallback as
|
|
5
|
-
useImperativeHandle as
|
|
6
|
-
useMemo as
|
|
7
|
-
useRef as
|
|
8
|
-
useState as
|
|
2
|
+
import React4, {
|
|
3
|
+
forwardRef as forwardRef4,
|
|
4
|
+
useCallback as useCallback4,
|
|
5
|
+
useImperativeHandle as useImperativeHandle4,
|
|
6
|
+
useMemo as useMemo3,
|
|
7
|
+
useRef as useRef4,
|
|
8
|
+
useState as useState4
|
|
9
9
|
} from "react";
|
|
10
10
|
import {
|
|
11
|
-
Animated as
|
|
11
|
+
Animated as Animated4,
|
|
12
12
|
StyleSheet,
|
|
13
|
-
View as
|
|
13
|
+
View as View3
|
|
14
14
|
} from "react-native";
|
|
15
15
|
import PagerView from "react-native-pager-view";
|
|
16
16
|
|
|
@@ -176,8 +176,88 @@ var TabScrollView = forwardRef2(
|
|
|
176
176
|
}
|
|
177
177
|
);
|
|
178
178
|
|
|
179
|
+
// src/TabSectionList.tsx
|
|
180
|
+
import React3, {
|
|
181
|
+
forwardRef as forwardRef3,
|
|
182
|
+
useCallback as useCallback3,
|
|
183
|
+
useEffect as useEffect3,
|
|
184
|
+
useImperativeHandle as useImperativeHandle3,
|
|
185
|
+
useMemo as useMemo2,
|
|
186
|
+
useRef as useRef3,
|
|
187
|
+
useState as useState3
|
|
188
|
+
} from "react";
|
|
189
|
+
import {
|
|
190
|
+
Animated as Animated3,
|
|
191
|
+
SectionList,
|
|
192
|
+
View as View2
|
|
193
|
+
} from "react-native";
|
|
194
|
+
var AnimatedSectionListComponent = Animated3.createAnimatedComponent(SectionList);
|
|
195
|
+
var AnimatedSectionList = AnimatedSectionListComponent;
|
|
196
|
+
var TabSectionListInner = ({ contentContainerStyle, onScroll, ListHeaderComponent, ...props }, ref) => {
|
|
197
|
+
const index = useTabIndex();
|
|
198
|
+
const {
|
|
199
|
+
scrollY,
|
|
200
|
+
activeIndex,
|
|
201
|
+
stickyEnabled,
|
|
202
|
+
headerHeight,
|
|
203
|
+
tabBarHeight,
|
|
204
|
+
renderHeader,
|
|
205
|
+
renderTabBar,
|
|
206
|
+
registerRef,
|
|
207
|
+
syncScrollY
|
|
208
|
+
} = useCollapsible();
|
|
209
|
+
const innerRef = useRef3(null);
|
|
210
|
+
const isActive = activeIndex === index;
|
|
211
|
+
useEffect3(() => {
|
|
212
|
+
registerRef(index, innerRef.current);
|
|
213
|
+
return () => registerRef(index, null);
|
|
214
|
+
}, [index]);
|
|
215
|
+
useImperativeHandle3(ref, () => innerRef.current, []);
|
|
216
|
+
const handleScroll = useCallback3(
|
|
217
|
+
(e) => {
|
|
218
|
+
const y = e.nativeEvent.contentOffset.y;
|
|
219
|
+
syncScrollY(index, y);
|
|
220
|
+
onScroll?.(e);
|
|
221
|
+
},
|
|
222
|
+
[index, onScroll, syncScrollY]
|
|
223
|
+
);
|
|
224
|
+
const mergedHeader = useMemo2(() => {
|
|
225
|
+
if (stickyEnabled) return ListHeaderComponent;
|
|
226
|
+
const OriginalHeader = typeof ListHeaderComponent === "function" ? /* @__PURE__ */ React3.createElement(ListHeaderComponent, null) : ListHeaderComponent ?? null;
|
|
227
|
+
return /* @__PURE__ */ React3.createElement(View2, null, renderHeader?.(), renderTabBar?.(), OriginalHeader);
|
|
228
|
+
}, [stickyEnabled, ListHeaderComponent, renderHeader, renderTabBar]);
|
|
229
|
+
const paddingTop = stickyEnabled ? headerHeight + tabBarHeight : 0;
|
|
230
|
+
const collapseRange = stickyEnabled ? headerHeight : 0;
|
|
231
|
+
const [containerHeight, setContainerHeight] = useState3(0);
|
|
232
|
+
const handleLayout = useCallback3((e) => {
|
|
233
|
+
setContainerHeight(e.nativeEvent.layout.height);
|
|
234
|
+
}, []);
|
|
235
|
+
const minHeight = containerHeight > 0 ? containerHeight + collapseRange : 0;
|
|
236
|
+
return /* @__PURE__ */ React3.createElement(
|
|
237
|
+
AnimatedSectionList,
|
|
238
|
+
{
|
|
239
|
+
...props,
|
|
240
|
+
ref: innerRef,
|
|
241
|
+
onLayout: handleLayout,
|
|
242
|
+
ListHeaderComponent: mergedHeader,
|
|
243
|
+
contentContainerStyle: [
|
|
244
|
+
paddingTop > 0 && { paddingTop },
|
|
245
|
+
minHeight > 0 && { minHeight },
|
|
246
|
+
contentContainerStyle
|
|
247
|
+
],
|
|
248
|
+
onScroll: isActive && stickyEnabled ? Animated3.event([{ nativeEvent: { contentOffset: { y: scrollY } } }], {
|
|
249
|
+
useNativeDriver: true,
|
|
250
|
+
listener: handleScroll
|
|
251
|
+
}) : handleScroll,
|
|
252
|
+
scrollEventThrottle: 16,
|
|
253
|
+
showsVerticalScrollIndicator: false
|
|
254
|
+
}
|
|
255
|
+
);
|
|
256
|
+
};
|
|
257
|
+
var TabSectionList = forwardRef3(TabSectionListInner);
|
|
258
|
+
|
|
179
259
|
// src/index.tsx
|
|
180
|
-
var CollapsibleTabView =
|
|
260
|
+
var CollapsibleTabView = forwardRef4(
|
|
181
261
|
({
|
|
182
262
|
children,
|
|
183
263
|
renderHeader,
|
|
@@ -192,13 +272,13 @@ var CollapsibleTabView = forwardRef3(
|
|
|
192
272
|
swipeEnabled = true,
|
|
193
273
|
style
|
|
194
274
|
}, ref) => {
|
|
195
|
-
const [activeIndex, setActiveIndex] =
|
|
196
|
-
const pagerRef =
|
|
197
|
-
const pages =
|
|
198
|
-
() =>
|
|
275
|
+
const [activeIndex, setActiveIndex] = useState4(initialTabIndex);
|
|
276
|
+
const pagerRef = useRef4(null);
|
|
277
|
+
const pages = useMemo3(
|
|
278
|
+
() => React4.Children.toArray(children).filter(React4.isValidElement),
|
|
199
279
|
[children]
|
|
200
280
|
);
|
|
201
|
-
|
|
281
|
+
useImperativeHandle4(ref, () => ({
|
|
202
282
|
scrollToTab: (index, animated = true) => {
|
|
203
283
|
if (index === activeIndex || index < 0 || index >= pages.length) return;
|
|
204
284
|
syncTabOnSwitch(index);
|
|
@@ -213,17 +293,17 @@ var CollapsibleTabView = forwardRef3(
|
|
|
213
293
|
getActiveIndex: () => activeIndex
|
|
214
294
|
}));
|
|
215
295
|
const hasEstimate = estimatedHeaderHeight > 0;
|
|
216
|
-
const headerHeightRef =
|
|
217
|
-
const tabBarHeightRef =
|
|
218
|
-
const [layout, setLayout] =
|
|
296
|
+
const headerHeightRef = useRef4(0);
|
|
297
|
+
const tabBarHeightRef = useRef4(0);
|
|
298
|
+
const [layout, setLayout] = useState4({
|
|
219
299
|
headerHeight: estimatedHeaderHeight,
|
|
220
300
|
tabBarHeight: estimatedTabBarHeight,
|
|
221
301
|
ready: hasEstimate
|
|
222
302
|
});
|
|
223
303
|
const { headerHeight, tabBarHeight } = layout;
|
|
224
304
|
const visible = layout.ready;
|
|
225
|
-
const adjustY =
|
|
226
|
-
const tryCommitLayout =
|
|
305
|
+
const adjustY = useRef4(new Animated4.Value(0)).current;
|
|
306
|
+
const tryCommitLayout = useCallback4(() => {
|
|
227
307
|
const h = headerHeightRef.current;
|
|
228
308
|
const t = tabBarHeightRef.current;
|
|
229
309
|
if (h > 0 && t > 0) {
|
|
@@ -234,7 +314,7 @@ var CollapsibleTabView = forwardRef3(
|
|
|
234
314
|
const diff = h + t - (prev.headerHeight + prev.tabBarHeight);
|
|
235
315
|
if (prev.ready && Math.abs(diff) > 1) {
|
|
236
316
|
adjustY.setValue(-diff);
|
|
237
|
-
|
|
317
|
+
Animated4.timing(adjustY, {
|
|
238
318
|
toValue: 0,
|
|
239
319
|
duration: 200,
|
|
240
320
|
useNativeDriver: true
|
|
@@ -244,35 +324,35 @@ var CollapsibleTabView = forwardRef3(
|
|
|
244
324
|
});
|
|
245
325
|
}
|
|
246
326
|
}, [adjustY]);
|
|
247
|
-
const handleHeaderLayout =
|
|
327
|
+
const handleHeaderLayout = useCallback4(
|
|
248
328
|
(e) => {
|
|
249
329
|
headerHeightRef.current = e.nativeEvent.layout.height;
|
|
250
330
|
tryCommitLayout();
|
|
251
331
|
},
|
|
252
332
|
[tryCommitLayout]
|
|
253
333
|
);
|
|
254
|
-
const handleTabBarLayout =
|
|
334
|
+
const handleTabBarLayout = useCallback4(
|
|
255
335
|
(e) => {
|
|
256
336
|
tabBarHeightRef.current = e.nativeEvent.layout.height;
|
|
257
337
|
tryCommitLayout();
|
|
258
338
|
},
|
|
259
339
|
[tryCommitLayout]
|
|
260
340
|
);
|
|
261
|
-
const scrollY =
|
|
262
|
-
const tabScrollYMap =
|
|
263
|
-
const tabRefs =
|
|
341
|
+
const scrollY = useRef4(new Animated4.Value(0)).current;
|
|
342
|
+
const tabScrollYMap = useRef4(/* @__PURE__ */ new Map());
|
|
343
|
+
const tabRefs = useRef4(
|
|
264
344
|
/* @__PURE__ */ new Map()
|
|
265
345
|
);
|
|
266
346
|
const collapseRange = stickyEnabled ? Math.max(headerHeight - stickyTop, 0) : 0;
|
|
267
|
-
const headerTranslateY =
|
|
347
|
+
const headerTranslateY = useMemo3(
|
|
268
348
|
() => collapseRange > 0 ? scrollY.interpolate({
|
|
269
349
|
inputRange: [0, collapseRange],
|
|
270
350
|
outputRange: [0, -collapseRange],
|
|
271
351
|
extrapolate: "clamp"
|
|
272
|
-
}) : new
|
|
352
|
+
}) : new Animated4.Value(0),
|
|
273
353
|
[scrollY, collapseRange]
|
|
274
354
|
);
|
|
275
|
-
const registerRef =
|
|
355
|
+
const registerRef = useCallback4(
|
|
276
356
|
(index, ref2) => {
|
|
277
357
|
if (ref2) {
|
|
278
358
|
tabRefs.current.set(index, ref2);
|
|
@@ -282,14 +362,14 @@ var CollapsibleTabView = forwardRef3(
|
|
|
282
362
|
},
|
|
283
363
|
[]
|
|
284
364
|
);
|
|
285
|
-
const syncScrollY =
|
|
365
|
+
const syncScrollY = useCallback4(
|
|
286
366
|
(index, y) => {
|
|
287
367
|
tabScrollYMap.current.set(index, y);
|
|
288
368
|
onScrollProp?.(y);
|
|
289
369
|
},
|
|
290
370
|
[onScrollProp]
|
|
291
371
|
);
|
|
292
|
-
const scrollTabTo =
|
|
372
|
+
const scrollTabTo = useCallback4((index, offset) => {
|
|
293
373
|
const ref2 = tabRefs.current.get(index);
|
|
294
374
|
if (!ref2) return;
|
|
295
375
|
if (ref2.scrollToOffset) {
|
|
@@ -305,7 +385,7 @@ var CollapsibleTabView = forwardRef3(
|
|
|
305
385
|
}
|
|
306
386
|
}
|
|
307
387
|
}, []);
|
|
308
|
-
const syncTabOnSwitch =
|
|
388
|
+
const syncTabOnSwitch = useCallback4((newIndex) => {
|
|
309
389
|
const currentY = tabScrollYMap.current.get(activeIndex) ?? 0;
|
|
310
390
|
const newTabSavedY = tabScrollYMap.current.get(newIndex) ?? 0;
|
|
311
391
|
const isCollapsed = currentY >= collapseRange - 1;
|
|
@@ -314,7 +394,7 @@ var CollapsibleTabView = forwardRef3(
|
|
|
314
394
|
tabScrollYMap.current.set(newIndex, targetY);
|
|
315
395
|
scrollY.setValue(Math.min(targetY, collapseRange));
|
|
316
396
|
}, []);
|
|
317
|
-
const preSyncAdjacentTabs =
|
|
397
|
+
const preSyncAdjacentTabs = useCallback4(() => {
|
|
318
398
|
const currentY = tabScrollYMap.current.get(activeIndex) ?? 0;
|
|
319
399
|
const isCollapsed = currentY >= collapseRange - 1;
|
|
320
400
|
for (const i of [activeIndex - 1, activeIndex + 1]) {
|
|
@@ -325,7 +405,7 @@ var CollapsibleTabView = forwardRef3(
|
|
|
325
405
|
tabScrollYMap.current.set(i, targetY);
|
|
326
406
|
}
|
|
327
407
|
}, [activeIndex, collapseRange, pages.length, scrollTabTo]);
|
|
328
|
-
const handlePageScrollStateChanged =
|
|
408
|
+
const handlePageScrollStateChanged = useCallback4(
|
|
329
409
|
(e) => {
|
|
330
410
|
if (e.nativeEvent.pageScrollState === "dragging") {
|
|
331
411
|
preSyncAdjacentTabs();
|
|
@@ -333,7 +413,7 @@ var CollapsibleTabView = forwardRef3(
|
|
|
333
413
|
},
|
|
334
414
|
[preSyncAdjacentTabs]
|
|
335
415
|
);
|
|
336
|
-
const handleTabPress =
|
|
416
|
+
const handleTabPress = useCallback4(
|
|
337
417
|
(index) => {
|
|
338
418
|
if (index === activeIndex) return;
|
|
339
419
|
syncTabOnSwitch(index);
|
|
@@ -343,7 +423,7 @@ var CollapsibleTabView = forwardRef3(
|
|
|
343
423
|
},
|
|
344
424
|
[activeIndex, syncTabOnSwitch, onTabChange]
|
|
345
425
|
);
|
|
346
|
-
const handlePageSelected =
|
|
426
|
+
const handlePageSelected = useCallback4(
|
|
347
427
|
(e) => {
|
|
348
428
|
const newIndex = e.nativeEvent.position;
|
|
349
429
|
if (newIndex === activeIndex) return;
|
|
@@ -354,18 +434,18 @@ var CollapsibleTabView = forwardRef3(
|
|
|
354
434
|
},
|
|
355
435
|
[activeIndex, collapseRange, scrollY, onTabChange]
|
|
356
436
|
);
|
|
357
|
-
const tabBarProps =
|
|
437
|
+
const tabBarProps = useMemo3(
|
|
358
438
|
() => ({
|
|
359
439
|
activeIndex,
|
|
360
440
|
onTabPress: handleTabPress
|
|
361
441
|
}),
|
|
362
442
|
[activeIndex, handleTabPress]
|
|
363
443
|
);
|
|
364
|
-
const renderTabBarNode =
|
|
444
|
+
const renderTabBarNode = useCallback4(
|
|
365
445
|
() => renderTabBar(tabBarProps),
|
|
366
446
|
[renderTabBar, tabBarProps]
|
|
367
447
|
);
|
|
368
|
-
const contextValue =
|
|
448
|
+
const contextValue = useMemo3(
|
|
369
449
|
() => ({
|
|
370
450
|
scrollY,
|
|
371
451
|
activeIndex,
|
|
@@ -389,8 +469,8 @@ var CollapsibleTabView = forwardRef3(
|
|
|
389
469
|
syncScrollY
|
|
390
470
|
]
|
|
391
471
|
);
|
|
392
|
-
return /* @__PURE__ */
|
|
393
|
-
|
|
472
|
+
return /* @__PURE__ */ React4.createElement(CollapsibleContext.Provider, { value: contextValue }, /* @__PURE__ */ React4.createElement(View3, { style: [styles.container, style] }, /* @__PURE__ */ React4.createElement(
|
|
473
|
+
Animated4.View,
|
|
394
474
|
{
|
|
395
475
|
style: [
|
|
396
476
|
styles.pager,
|
|
@@ -398,7 +478,7 @@ var CollapsibleTabView = forwardRef3(
|
|
|
398
478
|
{ transform: [{ translateY: adjustY }] }
|
|
399
479
|
]
|
|
400
480
|
},
|
|
401
|
-
/* @__PURE__ */
|
|
481
|
+
/* @__PURE__ */ React4.createElement(
|
|
402
482
|
PagerView,
|
|
403
483
|
{
|
|
404
484
|
ref: pagerRef,
|
|
@@ -408,10 +488,10 @@ var CollapsibleTabView = forwardRef3(
|
|
|
408
488
|
onPageScrollStateChanged: handlePageScrollStateChanged,
|
|
409
489
|
scrollEnabled: swipeEnabled
|
|
410
490
|
},
|
|
411
|
-
pages.map((page, i) => /* @__PURE__ */
|
|
491
|
+
pages.map((page, i) => /* @__PURE__ */ React4.createElement(View3, { key: page?.key ?? i, style: styles.page }, /* @__PURE__ */ React4.createElement(TabIndexContext.Provider, { value: i }, page)))
|
|
412
492
|
)
|
|
413
|
-
), stickyEnabled && /* @__PURE__ */
|
|
414
|
-
|
|
493
|
+
), stickyEnabled && /* @__PURE__ */ React4.createElement(
|
|
494
|
+
Animated4.View,
|
|
415
495
|
{
|
|
416
496
|
style: [
|
|
417
497
|
styles.overlay,
|
|
@@ -419,8 +499,8 @@ var CollapsibleTabView = forwardRef3(
|
|
|
419
499
|
],
|
|
420
500
|
pointerEvents: "box-none"
|
|
421
501
|
},
|
|
422
|
-
/* @__PURE__ */
|
|
423
|
-
/* @__PURE__ */
|
|
502
|
+
/* @__PURE__ */ React4.createElement(View3, { pointerEvents: "box-none", onLayout: handleHeaderLayout }, renderHeader()),
|
|
503
|
+
/* @__PURE__ */ React4.createElement(View3, { onLayout: handleTabBarLayout }, renderTabBarNode())
|
|
424
504
|
)));
|
|
425
505
|
}
|
|
426
506
|
);
|
|
@@ -449,5 +529,6 @@ var index_default = CollapsibleTabView;
|
|
|
449
529
|
export {
|
|
450
530
|
TabFlatList,
|
|
451
531
|
TabScrollView,
|
|
532
|
+
TabSectionList,
|
|
452
533
|
index_default as default
|
|
453
534
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { NativeScrollEvent, NativeSyntheticEvent, SectionList, SectionListProps } from "react-native";
|
|
3
|
+
export type TabSectionListProps<T = any> = Omit<SectionListProps<T>, "onScroll"> & {
|
|
4
|
+
onScroll?: (e: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const TabSectionList: <T>(props: TabSectionListProps<T> & {
|
|
7
|
+
ref?: React.Ref<SectionList<T>>;
|
|
8
|
+
}) => React.ReactElement;
|
|
9
|
+
//# sourceMappingURL=TabSectionList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabSectionList.d.ts","sourceRoot":"","sources":["../../src/TabSectionList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAA;AACd,OAAO,EAGL,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EACX,gBAAgB,EAEjB,MAAM,cAAc,CAAA;AAUrB,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,GAAG,IAAI,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG;IACjF,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;CAChE,CAAA;AA0FD,eAAO,MAAM,cAAc,EAAsC,CAAC,CAAC,EACjE,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;CAAE,KAChE,KAAK,CAAC,YAAY,CAAA"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { CollapsibleTabViewProps, CollapsibleTabViewRef } from "./types";
|
|
3
3
|
export { TabFlatList } from "./TabFlatList";
|
|
4
4
|
export { TabScrollView } from "./TabScrollView";
|
|
5
|
+
export { TabSectionList } from "./TabSectionList";
|
|
5
6
|
export type { CollapsibleTabViewProps, CollapsibleTabViewRef, TabBarProps, } from "./types";
|
|
6
7
|
declare const CollapsibleTabView: React.ForwardRefExoticComponent<CollapsibleTabViewProps & React.RefAttributes<CollapsibleTabViewRef>>;
|
|
7
8
|
export default CollapsibleTabView;
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;
|
|
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,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EACV,uBAAuB,EACvB,qBAAqB,EACrB,WAAW,GACZ,MAAM,SAAS,CAAC;AAEjB,QAAA,MAAM,kBAAkB,uGA0TvB,CAAC;AAwBF,eAAe,kBAAkB,CAAC"}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Animated, FlatList, ScrollView, StyleProp, ViewStyle } from "react-native";
|
|
2
|
+
import { Animated, FlatList, ScrollView, SectionList, StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
export interface TabBarProps {
|
|
4
4
|
activeIndex: number;
|
|
5
5
|
onTabPress: (index: number) => void;
|
|
@@ -30,7 +30,7 @@ export interface CollapsibleContextValue {
|
|
|
30
30
|
tabBarHeight: number;
|
|
31
31
|
renderHeader?: () => React.ReactNode;
|
|
32
32
|
renderTabBar?: () => React.ReactNode;
|
|
33
|
-
registerRef: (index: number, ref: FlatList<any> | ScrollView | null) => void;
|
|
33
|
+
registerRef: (index: number, ref: FlatList<any> | SectionList<any> | ScrollView | null) => void;
|
|
34
34
|
syncScrollY: (index: number, y: number) => void;
|
|
35
35
|
}
|
|
36
36
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEhG,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACpC;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,YAAY,EAAE,MAAM,KAAK,CAAC,SAAS,CAAA;IACnC,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,KAAK,CAAC,SAAS,CAAA;IACrD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAC7B;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IACxD,cAAc,EAAE,MAAM,MAAM,CAAA;CAC7B;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAA;IACvB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,OAAO,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAA;IACpC,YAAY,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAA;IACpC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,UAAU,GAAG,IAAI,KAAK,IAAI,CAAA;IAC/F,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CAChD"}
|