@terreno/ui 57.10.1 → 57.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -0
- package/dist/Button.js +1 -1
- package/dist/Button.js.map +1 -1
- package/dist/Common.d.ts +7 -0
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js.map +1 -1
- package/dist/DataTable.js +1 -1
- package/dist/DataTable.js.map +1 -1
- package/dist/DateTimeActionSheet.js +1 -1
- package/dist/DateTimeActionSheet.js.map +1 -1
- package/dist/DateTimeField.js +1 -1
- package/dist/DateTimeField.js.map +1 -1
- package/dist/SplitPage.d.ts +2 -2
- package/dist/SplitPage.d.ts.map +1 -1
- package/dist/SplitPage.js +148 -46
- package/dist/SplitPage.js.map +1 -1
- package/dist/table/TableHeaderCell.js +1 -1
- package/dist/table/TableHeaderCell.js.map +1 -1
- package/package.json +2 -2
- package/src/Button.test.tsx +29 -0
- package/src/Button.tsx +1 -1
- package/src/Common.ts +7 -0
- package/src/DataTable.tsx +1 -1
- package/src/DateTimeActionSheet.tsx +1 -1
- package/src/DateTimeField.tsx +1 -1
- package/src/SplitPage.test.tsx +527 -4
- package/src/SplitPage.tsx +269 -129
- package/src/__snapshots__/Button.test.tsx.snap +1 -1
- package/src/__snapshots__/SplitPage.test.tsx.snap +168 -56
- package/src/bunSetup.ts +0 -6
- package/src/table/TableHeaderCell.tsx +1 -1
package/src/SplitPage.tsx
CHANGED
|
@@ -2,6 +2,8 @@ import {
|
|
|
2
2
|
Children,
|
|
3
3
|
type ComponentProps,
|
|
4
4
|
type ElementRef,
|
|
5
|
+
type ReactElement,
|
|
6
|
+
type ReactNode,
|
|
5
7
|
useCallback,
|
|
6
8
|
useEffect,
|
|
7
9
|
useRef,
|
|
@@ -13,11 +15,12 @@ import {
|
|
|
13
15
|
ScrollView,
|
|
14
16
|
useWindowDimensions,
|
|
15
17
|
View,
|
|
18
|
+
type ViewStyle,
|
|
16
19
|
} from "react-native";
|
|
17
20
|
import {SwiperFlatList} from "react-native-swiper-flatlist";
|
|
18
21
|
|
|
19
22
|
import {Box} from "./Box";
|
|
20
|
-
import type
|
|
23
|
+
import {getRounding, getSpacing, type SplitPageListItem, type SplitPageProps} from "./Common";
|
|
21
24
|
import {FlatList} from "./FlatList";
|
|
22
25
|
import {IconButton} from "./IconButton";
|
|
23
26
|
import {isNarrowViewport} from "./MediaQuery";
|
|
@@ -25,6 +28,54 @@ import {SegmentedControl} from "./SegmentedControl";
|
|
|
25
28
|
import {Spinner} from "./Spinner";
|
|
26
29
|
import {useTheme} from "./Theme";
|
|
27
30
|
|
|
31
|
+
// flex: 1 (basis 0, shrink 1) sizes the content container to the pane. A height: "100%"
|
|
32
|
+
// child then stays pane-bounded and can scroll internally. A taller child that does not
|
|
33
|
+
// shrink still extends this ScrollView. flexGrow: 1 leaves the basis at the content size,
|
|
34
|
+
// so that same height: "100%" child grows with its content instead of the pane.
|
|
35
|
+
const desktopChildContentContainerStyle = {flex: 1};
|
|
36
|
+
|
|
37
|
+
// Matches IconButton's default box. The labeled pager reserves this slot even when the
|
|
38
|
+
// arrow is hidden, so the other arrow does not reflow.
|
|
39
|
+
const labeledColumnNavButtonHeight = 32;
|
|
40
|
+
const labeledPagerEdgeSpacing = getSpacing(2);
|
|
41
|
+
|
|
42
|
+
const renderDesktopChildColumn = ({
|
|
43
|
+
borderRadius,
|
|
44
|
+
columnKey,
|
|
45
|
+
element,
|
|
46
|
+
paneStyle,
|
|
47
|
+
scrollTestID,
|
|
48
|
+
testID,
|
|
49
|
+
}: {
|
|
50
|
+
borderRadius: number;
|
|
51
|
+
columnKey: number;
|
|
52
|
+
element: ReactNode;
|
|
53
|
+
paneStyle: ViewStyle;
|
|
54
|
+
scrollTestID: string;
|
|
55
|
+
testID: string;
|
|
56
|
+
}): ReactElement => {
|
|
57
|
+
return (
|
|
58
|
+
<View
|
|
59
|
+
key={columnKey}
|
|
60
|
+
style={{
|
|
61
|
+
...paneStyle,
|
|
62
|
+
borderRadius,
|
|
63
|
+
height: "100%",
|
|
64
|
+
overflow: "hidden",
|
|
65
|
+
}}
|
|
66
|
+
testID={testID}
|
|
67
|
+
>
|
|
68
|
+
<ScrollView
|
|
69
|
+
contentContainerStyle={desktopChildContentContainerStyle}
|
|
70
|
+
style={{flex: 1, height: "100%"}}
|
|
71
|
+
testID={scrollTestID}
|
|
72
|
+
>
|
|
73
|
+
{element}
|
|
74
|
+
</ScrollView>
|
|
75
|
+
</View>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
28
79
|
// A component for rendering a list on one side and a details view on the right for large screens,
|
|
29
80
|
// and a scrollable list where clicking an item takes you the details view.
|
|
30
81
|
// On web, opt in to minimum widths for the desktop side-by-side children, or a labeled pager
|
|
@@ -51,6 +102,7 @@ export const SplitPage = <TItem extends SplitPageListItem = SplitPageListItem>({
|
|
|
51
102
|
narrowViewportListButtonLabel,
|
|
52
103
|
narrowViewportSelectionActive,
|
|
53
104
|
narrowViewportSelectionKey,
|
|
105
|
+
childColumnRounding = "md",
|
|
54
106
|
showItemList,
|
|
55
107
|
}: SplitPageProps<TItem>) => {
|
|
56
108
|
const {theme} = useTheme();
|
|
@@ -61,12 +113,15 @@ export const SplitPage = <TItem extends SplitPageListItem = SplitPageListItem>({
|
|
|
61
113
|
const activeChildIndexRef = useRef(activeChildIndex);
|
|
62
114
|
activeChildIndexRef.current = activeChildIndex;
|
|
63
115
|
const swiperRef = useRef<ElementRef<typeof SwiperFlatList> | null>(null);
|
|
116
|
+
const narrowPagerRef = useRef<ElementRef<typeof View> | null>(null);
|
|
64
117
|
const [desktopScrollWidth, setDesktopScrollWidth] = useState(0);
|
|
65
118
|
const [measuredPageWidth, setMeasuredPageWidth] = useState(0);
|
|
119
|
+
const [measuredPageHeight, setMeasuredPageHeight] = useState(0);
|
|
66
120
|
|
|
67
121
|
const isNarrowLayout =
|
|
68
122
|
narrowBelowWidth === undefined ? isNarrowViewport() : windowWidth <= narrowBelowWidth;
|
|
69
123
|
const isDetailActive = selectedId !== undefined || narrowViewportSelectionActive === true;
|
|
124
|
+
const childColumnBorderRadius = getRounding(childColumnRounding);
|
|
70
125
|
|
|
71
126
|
const elementArray = Children.toArray(children).filter((c) => c !== null);
|
|
72
127
|
|
|
@@ -107,6 +162,50 @@ export const SplitPage = <TItem extends SplitPageListItem = SplitPageListItem>({
|
|
|
107
162
|
});
|
|
108
163
|
}, [measuredPageWidth, windowWidth]);
|
|
109
164
|
|
|
165
|
+
const rememberNarrowPagerSize = useCallback((width: number, height: number): void => {
|
|
166
|
+
if (width > 0) {
|
|
167
|
+
setMeasuredPageWidth((current) => (current === width ? current : width));
|
|
168
|
+
}
|
|
169
|
+
if (height > 0) {
|
|
170
|
+
setMeasuredPageHeight((current) => (current === height ? current : height));
|
|
171
|
+
}
|
|
172
|
+
}, []);
|
|
173
|
+
|
|
174
|
+
const onNarrowPagerLayout = useCallback(
|
|
175
|
+
(event: LayoutChangeEvent): void => {
|
|
176
|
+
const {height, width} = event.nativeEvent.layout;
|
|
177
|
+
rememberNarrowPagerSize(width, height);
|
|
178
|
+
},
|
|
179
|
+
[rememberNarrowPagerSize]
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
// The pager frame is already the visible height. Reading it here covers the case where
|
|
183
|
+
// the view's onLayout callback does not run after the frame settles.
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
if (!isNarrowLayout || !isDetailActive) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const node = narrowPagerRef.current as unknown as HTMLElement | null;
|
|
189
|
+
if (
|
|
190
|
+
node == null ||
|
|
191
|
+
typeof node.offsetHeight !== "number" ||
|
|
192
|
+
typeof ResizeObserver === "undefined"
|
|
193
|
+
) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const measure = (): void => {
|
|
197
|
+
rememberNarrowPagerSize(node.offsetWidth, node.offsetHeight);
|
|
198
|
+
};
|
|
199
|
+
measure();
|
|
200
|
+
const observer = new ResizeObserver(() => {
|
|
201
|
+
measure();
|
|
202
|
+
});
|
|
203
|
+
observer.observe(node);
|
|
204
|
+
return () => {
|
|
205
|
+
observer.disconnect();
|
|
206
|
+
};
|
|
207
|
+
}, [rememberNarrowPagerSize, isNarrowLayout, isDetailActive]);
|
|
208
|
+
|
|
110
209
|
if (!children && !renderContent) {
|
|
111
210
|
console.warn("A child node is required");
|
|
112
211
|
return null;
|
|
@@ -203,23 +302,19 @@ export const SplitPage = <TItem extends SplitPageListItem = SplitPageListItem>({
|
|
|
203
302
|
width={activeTabs.length > 1 ? "100%" : "60%"}
|
|
204
303
|
>
|
|
205
304
|
{activeTabs.map((tabIndex, i) => {
|
|
206
|
-
return (
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
>
|
|
220
|
-
{elementArray[tabIndex]}
|
|
221
|
-
</ScrollView>
|
|
222
|
-
);
|
|
305
|
+
return renderDesktopChildColumn({
|
|
306
|
+
borderRadius: childColumnBorderRadius,
|
|
307
|
+
columnKey: tabIndex,
|
|
308
|
+
element: elementArray[tabIndex],
|
|
309
|
+
paneStyle: {
|
|
310
|
+
flex: 1,
|
|
311
|
+
paddingLeft: i ? 16 : 0,
|
|
312
|
+
paddingRight: i ? 0 : 16,
|
|
313
|
+
width: "60%",
|
|
314
|
+
},
|
|
315
|
+
scrollTestID: `split-page-desktop-child-scroll-${i}`,
|
|
316
|
+
testID: `split-page-desktop-segment-child-${i}`,
|
|
317
|
+
});
|
|
223
318
|
})}
|
|
224
319
|
</Box>
|
|
225
320
|
</View>
|
|
@@ -254,22 +349,19 @@ export const SplitPage = <TItem extends SplitPageListItem = SplitPageListItem>({
|
|
|
254
349
|
testID="split-page-desktop-children-scroll"
|
|
255
350
|
>
|
|
256
351
|
{elementArray.map((element, index) => {
|
|
257
|
-
return (
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
{element}
|
|
271
|
-
</ScrollView>
|
|
272
|
-
);
|
|
352
|
+
return renderDesktopChildColumn({
|
|
353
|
+
borderRadius: childColumnBorderRadius,
|
|
354
|
+
columnKey: index,
|
|
355
|
+
element,
|
|
356
|
+
paneStyle: {
|
|
357
|
+
flexGrow: 0,
|
|
358
|
+
flexShrink: 0,
|
|
359
|
+
maxWidth: childWidth,
|
|
360
|
+
width: childWidth,
|
|
361
|
+
},
|
|
362
|
+
scrollTestID: `split-page-desktop-child-scroll-${index}`,
|
|
363
|
+
testID: `split-page-desktop-child-${index}`,
|
|
364
|
+
});
|
|
273
365
|
})}
|
|
274
366
|
</ScrollView>
|
|
275
367
|
);
|
|
@@ -278,21 +370,17 @@ export const SplitPage = <TItem extends SplitPageListItem = SplitPageListItem>({
|
|
|
278
370
|
return (
|
|
279
371
|
<Box alignItems="center" direction="row" flex="grow" justifyContent="center" paddingX={2}>
|
|
280
372
|
{elementArray.map((element, index) => {
|
|
281
|
-
return (
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
>
|
|
293
|
-
{element}
|
|
294
|
-
</ScrollView>
|
|
295
|
-
);
|
|
373
|
+
return renderDesktopChildColumn({
|
|
374
|
+
borderRadius: childColumnBorderRadius,
|
|
375
|
+
columnKey: index,
|
|
376
|
+
element,
|
|
377
|
+
paneStyle: {
|
|
378
|
+
flex: 1,
|
|
379
|
+
width: "60%",
|
|
380
|
+
},
|
|
381
|
+
scrollTestID: `split-page-desktop-child-scroll-${index}`,
|
|
382
|
+
testID: `split-page-desktop-row-child-${index}`,
|
|
383
|
+
});
|
|
296
384
|
})}
|
|
297
385
|
</Box>
|
|
298
386
|
);
|
|
@@ -354,19 +442,47 @@ export const SplitPage = <TItem extends SplitPageListItem = SplitPageListItem>({
|
|
|
354
442
|
swiperRef.current?.scrollToIndex({animated: true, index: destination});
|
|
355
443
|
};
|
|
356
444
|
|
|
445
|
+
// The horizontal pager's content container sizes to its children, so height: "100%" on a page
|
|
446
|
+
// grows with the child instead of the visible pane. overflowY: hidden on that pager then clips
|
|
447
|
+
// the extra height. A measured pixel height gives the page a definite box: rounded corners still
|
|
448
|
+
// clip, and a height: "100%" child can scroll inside that box.
|
|
449
|
+
const narrowPageHeight = (ratio: number): number | "100%" | "90%" => {
|
|
450
|
+
if (measuredPageHeight > 0) {
|
|
451
|
+
return measuredPageHeight * ratio;
|
|
452
|
+
}
|
|
453
|
+
return ratio === 1 ? "100%" : "90%";
|
|
454
|
+
};
|
|
455
|
+
|
|
357
456
|
const renderLabeledMobilePager = (labels: string[]) => {
|
|
358
457
|
const pageWidth = measuredPageWidth > 0 ? measuredPageWidth : windowWidth;
|
|
359
458
|
const lastIndex = elementArray.length - 1;
|
|
360
|
-
const
|
|
459
|
+
const navInset = bottomNavBarHeight ?? 0;
|
|
460
|
+
const labeledChromeHeight =
|
|
461
|
+
labeledPagerEdgeSpacing +
|
|
462
|
+
labeledPagerEdgeSpacing +
|
|
463
|
+
labeledColumnNavButtonHeight +
|
|
464
|
+
labeledPagerEdgeSpacing +
|
|
465
|
+
navInset;
|
|
466
|
+
const columnHeight =
|
|
467
|
+
measuredPageHeight > 0 ? Math.max(measuredPageHeight - labeledChromeHeight, 0) : undefined;
|
|
468
|
+
const navSlotStyle: ViewStyle = {
|
|
469
|
+
alignItems: "center",
|
|
470
|
+
flexShrink: 0,
|
|
471
|
+
height: labeledColumnNavButtonHeight,
|
|
472
|
+
justifyContent: "center",
|
|
473
|
+
width: labeledColumnNavButtonHeight,
|
|
474
|
+
};
|
|
361
475
|
return (
|
|
362
476
|
<View
|
|
363
|
-
onLayout={
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}}
|
|
367
|
-
style={{flex: 1, width: "100%"}}
|
|
477
|
+
onLayout={onNarrowPagerLayout}
|
|
478
|
+
ref={narrowPagerRef}
|
|
479
|
+
style={{flex: 1, height: "100%", minHeight: 0, width: "100%"}}
|
|
368
480
|
testID="split-page-mobile-children"
|
|
369
481
|
>
|
|
482
|
+
<View
|
|
483
|
+
style={{flexShrink: 0, height: labeledPagerEdgeSpacing}}
|
|
484
|
+
testID="split-page-column-top-space"
|
|
485
|
+
/>
|
|
370
486
|
<SwiperFlatList
|
|
371
487
|
getItemLayout={(_data, index) => ({
|
|
372
488
|
index,
|
|
@@ -379,16 +495,23 @@ export const SplitPage = <TItem extends SplitPageListItem = SplitPageListItem>({
|
|
|
379
495
|
}}
|
|
380
496
|
ref={swiperRef}
|
|
381
497
|
renderAll
|
|
382
|
-
style={{
|
|
498
|
+
style={{
|
|
499
|
+
flexGrow: columnHeight === undefined ? 1 : 0,
|
|
500
|
+
flexShrink: 1,
|
|
501
|
+
height: columnHeight,
|
|
502
|
+
minHeight: 0,
|
|
503
|
+
width: "100%",
|
|
504
|
+
}}
|
|
383
505
|
>
|
|
384
506
|
{elementArray.map((element, index) => {
|
|
385
507
|
return (
|
|
386
508
|
<View
|
|
387
509
|
key={index}
|
|
388
510
|
style={{
|
|
389
|
-
|
|
511
|
+
borderRadius: childColumnBorderRadius,
|
|
512
|
+
height: columnHeight ?? "100%",
|
|
513
|
+
overflow: "hidden",
|
|
390
514
|
padding: 0,
|
|
391
|
-
paddingBottom: bottomNavBarHeight,
|
|
392
515
|
width: pageWidth,
|
|
393
516
|
}}
|
|
394
517
|
testID={`split-page-mobile-child-${index}`}
|
|
@@ -398,61 +521,67 @@ export const SplitPage = <TItem extends SplitPageListItem = SplitPageListItem>({
|
|
|
398
521
|
);
|
|
399
522
|
})}
|
|
400
523
|
</SwiperFlatList>
|
|
401
|
-
{narrowViewportListButtonLabel ? (
|
|
402
|
-
<View
|
|
403
|
-
style={{
|
|
404
|
-
bottom: controlBottom,
|
|
405
|
-
left: 16,
|
|
406
|
-
position: "absolute",
|
|
407
|
-
zIndex: 1,
|
|
408
|
-
}}
|
|
409
|
-
>
|
|
410
|
-
<IconButton
|
|
411
|
-
accessibilityHint={narrowViewportListButtonLabel}
|
|
412
|
-
accessibilityLabel={narrowViewportListButtonLabel}
|
|
413
|
-
backgroundOpacity={0.88}
|
|
414
|
-
iconName="arrow-left"
|
|
415
|
-
onClick={() => onItemDeselect()}
|
|
416
|
-
testID="split-page-back-to-list"
|
|
417
|
-
variant="muted"
|
|
418
|
-
/>
|
|
419
|
-
</View>
|
|
420
|
-
) : null}
|
|
421
524
|
<View
|
|
422
525
|
style={{
|
|
423
|
-
|
|
526
|
+
alignItems: "center",
|
|
424
527
|
flexDirection: "row",
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
528
|
+
flexShrink: 0,
|
|
529
|
+
height: labeledColumnNavButtonHeight,
|
|
530
|
+
justifyContent: "space-between",
|
|
531
|
+
marginTop: labeledPagerEdgeSpacing,
|
|
532
|
+
paddingHorizontal: getSpacing(4),
|
|
429
533
|
}}
|
|
534
|
+
testID="split-page-column-nav"
|
|
430
535
|
>
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
536
|
+
<View
|
|
537
|
+
style={{
|
|
538
|
+
alignItems: "center",
|
|
539
|
+
flexDirection: "row",
|
|
540
|
+
flexShrink: 0,
|
|
541
|
+
gap: labeledPagerEdgeSpacing,
|
|
542
|
+
}}
|
|
543
|
+
>
|
|
544
|
+
{narrowViewportListButtonLabel ? (
|
|
545
|
+
<View style={navSlotStyle} testID="split-page-column-back-slot">
|
|
546
|
+
<IconButton
|
|
547
|
+
accessibilityHint={narrowViewportListButtonLabel}
|
|
548
|
+
accessibilityLabel={narrowViewportListButtonLabel}
|
|
549
|
+
iconName="arrow-left"
|
|
550
|
+
onClick={() => onItemDeselect()}
|
|
551
|
+
testID="split-page-back-to-list"
|
|
552
|
+
/>
|
|
553
|
+
</View>
|
|
554
|
+
) : null}
|
|
555
|
+
<View accessible={false} style={navSlotStyle} testID="split-page-column-previous-slot">
|
|
556
|
+
{activeChildIndex > 0 ? (
|
|
557
|
+
<IconButton
|
|
558
|
+
accessibilityLabel={`Show previous column: ${labels[activeChildIndex - 1]}`}
|
|
559
|
+
iconName="chevron-left"
|
|
560
|
+
onClick={() => {
|
|
561
|
+
showMobileChild(activeChildIndex - 1);
|
|
562
|
+
}}
|
|
563
|
+
testID="split-page-column-previous"
|
|
564
|
+
/>
|
|
565
|
+
) : null}
|
|
566
|
+
</View>
|
|
567
|
+
</View>
|
|
568
|
+
<View accessible={false} style={navSlotStyle} testID="split-page-column-next-slot">
|
|
569
|
+
{activeChildIndex < lastIndex ? (
|
|
570
|
+
<IconButton
|
|
571
|
+
accessibilityLabel={`Show next column: ${labels[activeChildIndex + 1]}`}
|
|
572
|
+
iconName="chevron-right"
|
|
573
|
+
onClick={() => {
|
|
574
|
+
showMobileChild(activeChildIndex + 1);
|
|
575
|
+
}}
|
|
576
|
+
testID="split-page-column-next"
|
|
577
|
+
/>
|
|
578
|
+
) : null}
|
|
579
|
+
</View>
|
|
455
580
|
</View>
|
|
581
|
+
<View
|
|
582
|
+
style={{flexShrink: 0, height: labeledPagerEdgeSpacing + navInset}}
|
|
583
|
+
testID="split-page-column-bottom-space"
|
|
584
|
+
/>
|
|
456
585
|
</View>
|
|
457
586
|
);
|
|
458
587
|
};
|
|
@@ -469,30 +598,41 @@ export const SplitPage = <TItem extends SplitPageListItem = SplitPageListItem>({
|
|
|
469
598
|
) {
|
|
470
599
|
return renderLabeledMobilePager(narrowViewportChildLabels);
|
|
471
600
|
}
|
|
601
|
+
const pageRatio = elementArray.length > 1 ? 0.9 : 1;
|
|
472
602
|
return (
|
|
473
|
-
<
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
style={{width: "100%"}}
|
|
603
|
+
<View
|
|
604
|
+
onLayout={onNarrowPagerLayout}
|
|
605
|
+
ref={narrowPagerRef}
|
|
606
|
+
style={{flex: 1, height: "100%", minHeight: 0, width: "100%"}}
|
|
607
|
+
testID="split-page-dotted-pager"
|
|
479
608
|
>
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
609
|
+
<SwiperFlatList
|
|
610
|
+
nestedScrollEnabled
|
|
611
|
+
paginationStyle={{justifyContent: "center", width: "95%"}}
|
|
612
|
+
renderAll
|
|
613
|
+
showPagination
|
|
614
|
+
style={{height: "100%", width: "100%"}}
|
|
615
|
+
>
|
|
616
|
+
{elementArray.map((element, i) => {
|
|
617
|
+
return (
|
|
618
|
+
<View
|
|
619
|
+
key={i}
|
|
620
|
+
style={{
|
|
621
|
+
borderRadius: childColumnBorderRadius,
|
|
622
|
+
height: narrowPageHeight(pageRatio),
|
|
623
|
+
overflow: "hidden",
|
|
624
|
+
padding: 4,
|
|
625
|
+
paddingBottom: bottomNavBarHeight,
|
|
626
|
+
width: windowWidth - 8,
|
|
627
|
+
}}
|
|
628
|
+
testID={`split-page-dotted-child-${i}`}
|
|
629
|
+
>
|
|
630
|
+
{element}
|
|
631
|
+
</View>
|
|
632
|
+
);
|
|
633
|
+
})}
|
|
634
|
+
</SwiperFlatList>
|
|
635
|
+
</View>
|
|
496
636
|
);
|
|
497
637
|
};
|
|
498
638
|
|