@xaui/native 0.0.36 → 0.0.37
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/dist/view/index.cjs +48 -2
- package/dist/view/index.d.cts +32 -1
- package/dist/view/index.d.ts +32 -1
- package/dist/view/index.js +83 -37
- package/package.json +1 -1
package/dist/view/index.cjs
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('../chunk-56RPWZD2.cjs');
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkOQ2BLOOGcjs = require('../chunk-OQ2BLOOG.cjs');
|
|
6
|
+
|
|
7
|
+
// src/components/view/column/column.tsx
|
|
2
8
|
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
3
9
|
var _reactnative = require('react-native');
|
|
4
10
|
|
|
@@ -378,6 +384,45 @@ var AspectRatio = ({
|
|
|
378
384
|
return /* @__PURE__ */ _react2.default.createElement(_reactnative.View, { style: [{ aspectRatio: ratio }, style] }, children);
|
|
379
385
|
};
|
|
380
386
|
|
|
387
|
+
// src/components/view/surface/surface.tsx
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
var _core = require('@xaui/core');
|
|
391
|
+
var resolveBackgroundColor = (color, theme) => {
|
|
392
|
+
if (color === "background" || color === "foreground") {
|
|
393
|
+
return theme.colors[color];
|
|
394
|
+
}
|
|
395
|
+
const safeColor = _core.getSafeThemeColor.call(void 0, color);
|
|
396
|
+
return theme.colors[safeColor].background;
|
|
397
|
+
};
|
|
398
|
+
var Surface = ({
|
|
399
|
+
children,
|
|
400
|
+
themeColor = "background",
|
|
401
|
+
padding,
|
|
402
|
+
radius = "none",
|
|
403
|
+
style
|
|
404
|
+
}) => {
|
|
405
|
+
const theme = _chunkOQ2BLOOGcjs.useXUITheme.call(void 0, );
|
|
406
|
+
const radiusStyle = _chunkOQ2BLOOGcjs.useBorderRadiusStyles.call(void 0, radius);
|
|
407
|
+
const background = resolveBackgroundColor(themeColor, theme);
|
|
408
|
+
return /* @__PURE__ */ _react2.default.createElement(
|
|
409
|
+
_reactnative.View,
|
|
410
|
+
{
|
|
411
|
+
style: [
|
|
412
|
+
radiusStyle,
|
|
413
|
+
{
|
|
414
|
+
flex: 1,
|
|
415
|
+
backgroundColor: background,
|
|
416
|
+
padding
|
|
417
|
+
},
|
|
418
|
+
style
|
|
419
|
+
]
|
|
420
|
+
},
|
|
421
|
+
children
|
|
422
|
+
);
|
|
423
|
+
};
|
|
424
|
+
Surface.displayName = "Surface";
|
|
425
|
+
|
|
381
426
|
// src/components/view/grid/grid.tsx
|
|
382
427
|
|
|
383
428
|
|
|
@@ -1012,4 +1057,5 @@ MasonryGridBuilder.displayName = "MasonryGridBuilder";
|
|
|
1012
1057
|
|
|
1013
1058
|
|
|
1014
1059
|
|
|
1015
|
-
|
|
1060
|
+
|
|
1061
|
+
exports.AspectRatio = AspectRatio; exports.BlurView = BlurView; exports.Column = Column; exports.ConditionalView = ConditionalView; exports.Grid = Grid; exports.GridBuilder = GridBuilder; exports.GridItem = GridItem; exports.Margin = Margin; exports.MasonryGrid = MasonryGrid; exports.MasonryGridBuilder = MasonryGridBuilder; exports.MasonryGridItem = MasonryGridItem; exports.Padding = Padding; exports.PositionedView = PositionedView; exports.RoundedView = RoundedView; exports.Row = Row; exports.SizedBox = SizedBox; exports.Spacer = Spacer; exports.Surface = Surface;
|
package/dist/view/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode, ReactElement, ComponentType } from 'react';
|
|
2
2
|
import { ViewStyle, StyleProp, ColorValue, ScrollViewProps } from 'react-native';
|
|
3
|
+
import { T as ThemeColor, R as Radius } from '../index-BOw6tbkc.cjs';
|
|
3
4
|
|
|
4
5
|
type MainAxisAlignment = 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
5
6
|
type CrossAxisAlignment = 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
@@ -289,6 +290,36 @@ type AspectRatioProps = {
|
|
|
289
290
|
|
|
290
291
|
declare const AspectRatio: React.FC<AspectRatioProps>;
|
|
291
292
|
|
|
293
|
+
type SurfaceThemeColor = ThemeColor | 'background' | 'foreground';
|
|
294
|
+
type SurfaceProps = {
|
|
295
|
+
/**
|
|
296
|
+
* Content rendered inside the surface container.
|
|
297
|
+
*/
|
|
298
|
+
children: ReactNode;
|
|
299
|
+
/**
|
|
300
|
+
* Theme-based color key used for background.
|
|
301
|
+
* - Semantic keys (primary, secondary, etc.) use their `.background` tone.
|
|
302
|
+
* - `background` / `foreground` use raw theme values.
|
|
303
|
+
* @default 'background'
|
|
304
|
+
*/
|
|
305
|
+
themeColor?: SurfaceThemeColor;
|
|
306
|
+
/**
|
|
307
|
+
* Uniform padding inside the surface.
|
|
308
|
+
*/
|
|
309
|
+
padding?: number;
|
|
310
|
+
/**
|
|
311
|
+
* Border radius token.
|
|
312
|
+
* @default 'none'
|
|
313
|
+
*/
|
|
314
|
+
radius?: Radius;
|
|
315
|
+
/**
|
|
316
|
+
* Additional container styles.
|
|
317
|
+
*/
|
|
318
|
+
style?: StyleProp<ViewStyle>;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
declare const Surface: React.FC<SurfaceProps>;
|
|
322
|
+
|
|
292
323
|
type GridProps = {
|
|
293
324
|
/**
|
|
294
325
|
* The grid items to render.
|
|
@@ -600,4 +631,4 @@ declare const MasonryGridBuilder: {
|
|
|
600
631
|
displayName: string;
|
|
601
632
|
};
|
|
602
633
|
|
|
603
|
-
export { AspectRatio, type AspectRatioProps, BlurView, type BlurViewProps, Column, type ColumnProps, ConditionalView, type ConditionalViewAnimation, type ConditionalViewProps, type CrossAxisAlignment, Grid, GridBuilder, type GridBuilderProps, GridItem, type GridItemProps, type GridProps, type MainAxisAlignment, Margin, type MarginProps, MasonryGrid, MasonryGridBuilder, type MasonryGridBuilderProps, MasonryGridItem, type MasonryGridItemProps, type MasonryGridProps, Padding, type PaddingProps, PositionedView, type PositionedViewProps, RoundedView, type RoundedViewProps, Row, type RowProps, SizedBox, type SizedBoxProps, Spacer, type SpacerProps };
|
|
634
|
+
export { AspectRatio, type AspectRatioProps, BlurView, type BlurViewProps, Column, type ColumnProps, ConditionalView, type ConditionalViewAnimation, type ConditionalViewProps, type CrossAxisAlignment, Grid, GridBuilder, type GridBuilderProps, GridItem, type GridItemProps, type GridProps, type MainAxisAlignment, Margin, type MarginProps, MasonryGrid, MasonryGridBuilder, type MasonryGridBuilderProps, MasonryGridItem, type MasonryGridItemProps, type MasonryGridProps, Padding, type PaddingProps, PositionedView, type PositionedViewProps, RoundedView, type RoundedViewProps, Row, type RowProps, SizedBox, type SizedBoxProps, Spacer, type SpacerProps, Surface, type SurfaceProps, type SurfaceThemeColor };
|
package/dist/view/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode, ReactElement, ComponentType } from 'react';
|
|
2
2
|
import { ViewStyle, StyleProp, ColorValue, ScrollViewProps } from 'react-native';
|
|
3
|
+
import { T as ThemeColor, R as Radius } from '../index-BOw6tbkc.js';
|
|
3
4
|
|
|
4
5
|
type MainAxisAlignment = 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
5
6
|
type CrossAxisAlignment = 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
@@ -289,6 +290,36 @@ type AspectRatioProps = {
|
|
|
289
290
|
|
|
290
291
|
declare const AspectRatio: React.FC<AspectRatioProps>;
|
|
291
292
|
|
|
293
|
+
type SurfaceThemeColor = ThemeColor | 'background' | 'foreground';
|
|
294
|
+
type SurfaceProps = {
|
|
295
|
+
/**
|
|
296
|
+
* Content rendered inside the surface container.
|
|
297
|
+
*/
|
|
298
|
+
children: ReactNode;
|
|
299
|
+
/**
|
|
300
|
+
* Theme-based color key used for background.
|
|
301
|
+
* - Semantic keys (primary, secondary, etc.) use their `.background` tone.
|
|
302
|
+
* - `background` / `foreground` use raw theme values.
|
|
303
|
+
* @default 'background'
|
|
304
|
+
*/
|
|
305
|
+
themeColor?: SurfaceThemeColor;
|
|
306
|
+
/**
|
|
307
|
+
* Uniform padding inside the surface.
|
|
308
|
+
*/
|
|
309
|
+
padding?: number;
|
|
310
|
+
/**
|
|
311
|
+
* Border radius token.
|
|
312
|
+
* @default 'none'
|
|
313
|
+
*/
|
|
314
|
+
radius?: Radius;
|
|
315
|
+
/**
|
|
316
|
+
* Additional container styles.
|
|
317
|
+
*/
|
|
318
|
+
style?: StyleProp<ViewStyle>;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
declare const Surface: React.FC<SurfaceProps>;
|
|
322
|
+
|
|
292
323
|
type GridProps = {
|
|
293
324
|
/**
|
|
294
325
|
* The grid items to render.
|
|
@@ -600,4 +631,4 @@ declare const MasonryGridBuilder: {
|
|
|
600
631
|
displayName: string;
|
|
601
632
|
};
|
|
602
633
|
|
|
603
|
-
export { AspectRatio, type AspectRatioProps, BlurView, type BlurViewProps, Column, type ColumnProps, ConditionalView, type ConditionalViewAnimation, type ConditionalViewProps, type CrossAxisAlignment, Grid, GridBuilder, type GridBuilderProps, GridItem, type GridItemProps, type GridProps, type MainAxisAlignment, Margin, type MarginProps, MasonryGrid, MasonryGridBuilder, type MasonryGridBuilderProps, MasonryGridItem, type MasonryGridItemProps, type MasonryGridProps, Padding, type PaddingProps, PositionedView, type PositionedViewProps, RoundedView, type RoundedViewProps, Row, type RowProps, SizedBox, type SizedBoxProps, Spacer, type SpacerProps };
|
|
634
|
+
export { AspectRatio, type AspectRatioProps, BlurView, type BlurViewProps, Column, type ColumnProps, ConditionalView, type ConditionalViewAnimation, type ConditionalViewProps, type CrossAxisAlignment, Grid, GridBuilder, type GridBuilderProps, GridItem, type GridItemProps, type GridProps, type MainAxisAlignment, Margin, type MarginProps, MasonryGrid, MasonryGridBuilder, type MasonryGridBuilderProps, MasonryGridItem, type MasonryGridItemProps, type MasonryGridProps, Padding, type PaddingProps, PositionedView, type PositionedViewProps, RoundedView, type RoundedViewProps, Row, type RowProps, SizedBox, type SizedBoxProps, Spacer, type SpacerProps, Surface, type SurfaceProps, type SurfaceThemeColor };
|
package/dist/view/index.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import "../chunk-SHBDANQN.js";
|
|
2
|
+
import {
|
|
3
|
+
useBorderRadiusStyles,
|
|
4
|
+
useXUITheme
|
|
5
|
+
} from "../chunk-LTKYHG5V.js";
|
|
6
|
+
|
|
1
7
|
// src/components/view/column/column.tsx
|
|
2
8
|
import React from "react";
|
|
3
9
|
import { View } from "react-native";
|
|
@@ -378,17 +384,56 @@ var AspectRatio = ({
|
|
|
378
384
|
return /* @__PURE__ */ React10.createElement(View10, { style: [{ aspectRatio: ratio }, style] }, children);
|
|
379
385
|
};
|
|
380
386
|
|
|
387
|
+
// src/components/view/surface/surface.tsx
|
|
388
|
+
import React11 from "react";
|
|
389
|
+
import { View as View11 } from "react-native";
|
|
390
|
+
import { getSafeThemeColor } from "@xaui/core";
|
|
391
|
+
var resolveBackgroundColor = (color, theme) => {
|
|
392
|
+
if (color === "background" || color === "foreground") {
|
|
393
|
+
return theme.colors[color];
|
|
394
|
+
}
|
|
395
|
+
const safeColor = getSafeThemeColor(color);
|
|
396
|
+
return theme.colors[safeColor].background;
|
|
397
|
+
};
|
|
398
|
+
var Surface = ({
|
|
399
|
+
children,
|
|
400
|
+
themeColor = "background",
|
|
401
|
+
padding,
|
|
402
|
+
radius = "none",
|
|
403
|
+
style
|
|
404
|
+
}) => {
|
|
405
|
+
const theme = useXUITheme();
|
|
406
|
+
const radiusStyle = useBorderRadiusStyles(radius);
|
|
407
|
+
const background = resolveBackgroundColor(themeColor, theme);
|
|
408
|
+
return /* @__PURE__ */ React11.createElement(
|
|
409
|
+
View11,
|
|
410
|
+
{
|
|
411
|
+
style: [
|
|
412
|
+
radiusStyle,
|
|
413
|
+
{
|
|
414
|
+
flex: 1,
|
|
415
|
+
backgroundColor: background,
|
|
416
|
+
padding
|
|
417
|
+
},
|
|
418
|
+
style
|
|
419
|
+
]
|
|
420
|
+
},
|
|
421
|
+
children
|
|
422
|
+
);
|
|
423
|
+
};
|
|
424
|
+
Surface.displayName = "Surface";
|
|
425
|
+
|
|
381
426
|
// src/components/view/grid/grid.tsx
|
|
382
|
-
import
|
|
427
|
+
import React13, { useMemo as useMemo2, useState } from "react";
|
|
383
428
|
import {
|
|
384
|
-
View as
|
|
429
|
+
View as View13
|
|
385
430
|
} from "react-native";
|
|
386
431
|
|
|
387
432
|
// src/components/view/grid/grid-item.tsx
|
|
388
|
-
import
|
|
389
|
-
import { View as
|
|
433
|
+
import React12 from "react";
|
|
434
|
+
import { View as View12 } from "react-native";
|
|
390
435
|
var GridItem = ({ children, style }) => {
|
|
391
|
-
return /* @__PURE__ */
|
|
436
|
+
return /* @__PURE__ */ React12.createElement(View12, { style }, children);
|
|
392
437
|
};
|
|
393
438
|
GridItem.displayName = "GridItem";
|
|
394
439
|
|
|
@@ -402,7 +447,7 @@ var getSafeSpan = (span, columns) => {
|
|
|
402
447
|
return Math.min(Math.floor(span), columns);
|
|
403
448
|
};
|
|
404
449
|
var isGridItemElement = (child) => {
|
|
405
|
-
if (!
|
|
450
|
+
if (!React13.isValidElement(child)) return false;
|
|
406
451
|
if (child.type === GridItem) return true;
|
|
407
452
|
const displayName = child.type.displayName;
|
|
408
453
|
return displayName === "GridItem";
|
|
@@ -421,15 +466,15 @@ var Grid = ({
|
|
|
421
466
|
const resolvedRowSpacing = rowSpacing ?? spacing ?? 0;
|
|
422
467
|
const resolvedColumnSpacing = columnSpacing ?? spacing ?? 0;
|
|
423
468
|
const itemWidth = `${100 / safeColumns}%`;
|
|
424
|
-
const items =
|
|
469
|
+
const items = React13.Children.toArray(children);
|
|
425
470
|
const totalColumnGap = resolvedColumnSpacing * (safeColumns - 1);
|
|
426
471
|
const baseItemWidth = useMemo2(() => {
|
|
427
472
|
if (!containerWidth) return void 0;
|
|
428
473
|
return (containerWidth - totalColumnGap) / safeColumns;
|
|
429
474
|
}, [containerWidth, safeColumns, totalColumnGap]);
|
|
430
475
|
let currentColumn = 0;
|
|
431
|
-
return /* @__PURE__ */
|
|
432
|
-
|
|
476
|
+
return /* @__PURE__ */ React13.createElement(
|
|
477
|
+
View13,
|
|
433
478
|
{
|
|
434
479
|
style: [
|
|
435
480
|
{
|
|
@@ -446,7 +491,7 @@ var Grid = ({
|
|
|
446
491
|
}
|
|
447
492
|
},
|
|
448
493
|
items.map((child, index) => {
|
|
449
|
-
const key =
|
|
494
|
+
const key = React13.isValidElement(child) && child.key ? child.key : `grid-${index}`;
|
|
450
495
|
const span = isGridItemElement(child) ? getSafeSpan(child.props.span, safeColumns) : 1;
|
|
451
496
|
const spanWidth = baseItemWidth === void 0 ? `${100 / safeColumns * span}%` : baseItemWidth * span + resolvedColumnSpacing * (span - 1);
|
|
452
497
|
if (currentColumn + span > safeColumns) {
|
|
@@ -466,7 +511,7 @@ var Grid = ({
|
|
|
466
511
|
itemStyle,
|
|
467
512
|
child.props.style
|
|
468
513
|
];
|
|
469
|
-
const element2 =
|
|
514
|
+
const element2 = React13.cloneElement(child, {
|
|
470
515
|
key,
|
|
471
516
|
style: mergedStyle
|
|
472
517
|
});
|
|
@@ -474,8 +519,8 @@ var Grid = ({
|
|
|
474
519
|
return element2;
|
|
475
520
|
}
|
|
476
521
|
const defaultItemWidth = baseItemWidth === void 0 ? itemWidth : baseItemWidth;
|
|
477
|
-
const element = /* @__PURE__ */
|
|
478
|
-
|
|
522
|
+
const element = /* @__PURE__ */ React13.createElement(
|
|
523
|
+
View13,
|
|
479
524
|
{
|
|
480
525
|
key,
|
|
481
526
|
style: [
|
|
@@ -498,11 +543,11 @@ var Grid = ({
|
|
|
498
543
|
};
|
|
499
544
|
|
|
500
545
|
// src/components/view/grid/grid-builder.tsx
|
|
501
|
-
import
|
|
546
|
+
import React14, { useMemo as useMemo3 } from "react";
|
|
502
547
|
import {
|
|
503
548
|
FlatList,
|
|
504
549
|
StyleSheet as StyleSheet3,
|
|
505
|
-
View as
|
|
550
|
+
View as View14
|
|
506
551
|
} from "react-native";
|
|
507
552
|
var getSafeColumns2 = (columns) => {
|
|
508
553
|
if (!columns || columns <= 0) return 1;
|
|
@@ -589,7 +634,7 @@ var GridBuilder = ({
|
|
|
589
634
|
},
|
|
590
635
|
itemStyle
|
|
591
636
|
];
|
|
592
|
-
return /* @__PURE__ */
|
|
637
|
+
return /* @__PURE__ */ React14.createElement(View14, { style: placeholderStyle, pointerEvents: "none" });
|
|
593
638
|
}
|
|
594
639
|
const element = resolvedRenderer({ item: item.item, index: item.index });
|
|
595
640
|
if (element === null) return null;
|
|
@@ -605,7 +650,7 @@ var GridBuilder = ({
|
|
|
605
650
|
},
|
|
606
651
|
itemStyle
|
|
607
652
|
];
|
|
608
|
-
return /* @__PURE__ */
|
|
653
|
+
return /* @__PURE__ */ React14.createElement(View14, { style: wrapperStyle }, element);
|
|
609
654
|
};
|
|
610
655
|
const flattenedStyle = StyleSheet3.flatten(style) ?? {};
|
|
611
656
|
const {
|
|
@@ -626,7 +671,7 @@ var GridBuilder = ({
|
|
|
626
671
|
...columnGap !== void 0 ? { columnGap } : {}
|
|
627
672
|
};
|
|
628
673
|
const hasLayoutStyle = Object.keys(layoutStyle).length > 0;
|
|
629
|
-
return /* @__PURE__ */
|
|
674
|
+
return /* @__PURE__ */ React14.createElement(
|
|
630
675
|
FlatList,
|
|
631
676
|
{
|
|
632
677
|
data: paddedData,
|
|
@@ -646,7 +691,7 @@ var GridBuilder = ({
|
|
|
646
691
|
GridBuilder.displayName = "GridBuilder";
|
|
647
692
|
|
|
648
693
|
// src/components/view/conditional/conditional-view.tsx
|
|
649
|
-
import
|
|
694
|
+
import React15, { useEffect as useEffect2, useMemo as useMemo4, useRef as useRef2, useState as useState2 } from "react";
|
|
650
695
|
import { Animated as Animated3 } from "react-native";
|
|
651
696
|
|
|
652
697
|
// src/components/view/conditional/conditional-view.utils.ts
|
|
@@ -798,18 +843,18 @@ var ConditionalView = ({
|
|
|
798
843
|
if (!shouldRender) {
|
|
799
844
|
return null;
|
|
800
845
|
}
|
|
801
|
-
return /* @__PURE__ */
|
|
846
|
+
return /* @__PURE__ */ React15.createElement(Animated3.View, { style: animatedStyle }, children);
|
|
802
847
|
};
|
|
803
848
|
|
|
804
849
|
// src/components/view/masonry-grid/masonry-grid.tsx
|
|
805
|
-
import
|
|
806
|
-
import { View as
|
|
850
|
+
import React16, { useMemo as useMemo5, useRef as useRef3, useState as useState3 } from "react";
|
|
851
|
+
import { View as View15 } from "react-native";
|
|
807
852
|
var getSafeColumns3 = (columns) => {
|
|
808
853
|
if (!columns || columns <= 0) return 1;
|
|
809
854
|
return Math.floor(columns);
|
|
810
855
|
};
|
|
811
856
|
var getItemKey = (child, index) => {
|
|
812
|
-
return
|
|
857
|
+
return React16.isValidElement(child) && child.key ? String(child.key) : `masonry-${index}`;
|
|
813
858
|
};
|
|
814
859
|
var MasonryGrid = ({
|
|
815
860
|
children,
|
|
@@ -832,7 +877,7 @@ var MasonryGrid = ({
|
|
|
832
877
|
return (containerWidth - totalColumnGap) / safeColumns;
|
|
833
878
|
}, [containerWidth, safeColumns, totalColumnGap]);
|
|
834
879
|
const items = useMemo5(
|
|
835
|
-
() =>
|
|
880
|
+
() => React16.Children.toArray(children).map((child, index) => ({
|
|
836
881
|
key: getItemKey(child, index),
|
|
837
882
|
element: child
|
|
838
883
|
})),
|
|
@@ -849,8 +894,8 @@ var MasonryGrid = ({
|
|
|
849
894
|
});
|
|
850
895
|
return buckets;
|
|
851
896
|
}, [items, layoutVersion, resolvedRowSpacing, safeColumns]);
|
|
852
|
-
return /* @__PURE__ */
|
|
853
|
-
|
|
897
|
+
return /* @__PURE__ */ React16.createElement(
|
|
898
|
+
View15,
|
|
854
899
|
{
|
|
855
900
|
style: [
|
|
856
901
|
{
|
|
@@ -873,10 +918,10 @@ var MasonryGrid = ({
|
|
|
873
918
|
},
|
|
874
919
|
columnStyle
|
|
875
920
|
];
|
|
876
|
-
return /* @__PURE__ */
|
|
921
|
+
return /* @__PURE__ */ React16.createElement(View15, { key: `masonry-col-${columnIndex}`, style: columnStyles }, column.map((item, index) => {
|
|
877
922
|
const isLastRow = index === column.length - 1;
|
|
878
|
-
return /* @__PURE__ */
|
|
879
|
-
|
|
923
|
+
return /* @__PURE__ */ React16.createElement(
|
|
924
|
+
View15,
|
|
880
925
|
{
|
|
881
926
|
key: item.key,
|
|
882
927
|
style: { marginBottom: isLastRow ? 0 : resolvedRowSpacing },
|
|
@@ -895,18 +940,18 @@ var MasonryGrid = ({
|
|
|
895
940
|
};
|
|
896
941
|
|
|
897
942
|
// src/components/view/masonry-grid/masonry-grid-item.tsx
|
|
898
|
-
import
|
|
899
|
-
import { View as
|
|
943
|
+
import React17 from "react";
|
|
944
|
+
import { View as View16 } from "react-native";
|
|
900
945
|
var MasonryGridItem = ({
|
|
901
946
|
children,
|
|
902
947
|
style
|
|
903
948
|
}) => {
|
|
904
|
-
return /* @__PURE__ */
|
|
949
|
+
return /* @__PURE__ */ React17.createElement(View16, { style }, children);
|
|
905
950
|
};
|
|
906
951
|
MasonryGridItem.displayName = "MasonryGridItem";
|
|
907
952
|
|
|
908
953
|
// src/components/view/masonry-grid/masonry-grid-builder.tsx
|
|
909
|
-
import
|
|
954
|
+
import React18, { useMemo as useMemo6, useRef as useRef4 } from "react";
|
|
910
955
|
import {
|
|
911
956
|
ScrollView
|
|
912
957
|
} from "react-native";
|
|
@@ -966,7 +1011,7 @@ var MasonryGridBuilder = ({
|
|
|
966
1011
|
onEndReached();
|
|
967
1012
|
}
|
|
968
1013
|
};
|
|
969
|
-
return /* @__PURE__ */
|
|
1014
|
+
return /* @__PURE__ */ React18.createElement(
|
|
970
1015
|
ScrollView,
|
|
971
1016
|
{
|
|
972
1017
|
scrollEventThrottle: 16,
|
|
@@ -978,7 +1023,7 @@ var MasonryGridBuilder = ({
|
|
|
978
1023
|
onScroll: handleScroll
|
|
979
1024
|
},
|
|
980
1025
|
header,
|
|
981
|
-
/* @__PURE__ */
|
|
1026
|
+
/* @__PURE__ */ React18.createElement(
|
|
982
1027
|
MasonryGrid,
|
|
983
1028
|
{
|
|
984
1029
|
columns,
|
|
@@ -988,7 +1033,7 @@ var MasonryGridBuilder = ({
|
|
|
988
1033
|
style: [{ width: "100%" }, style],
|
|
989
1034
|
columnStyle
|
|
990
1035
|
},
|
|
991
|
-
resolvedData.map((item, index) => /* @__PURE__ */
|
|
1036
|
+
resolvedData.map((item, index) => /* @__PURE__ */ React18.createElement(MasonryGridItem, { key: resolvedKeyExtractor(item, index) }, resolvedRenderer({ item, index })))
|
|
992
1037
|
),
|
|
993
1038
|
footer
|
|
994
1039
|
);
|
|
@@ -1011,5 +1056,6 @@ export {
|
|
|
1011
1056
|
RoundedView,
|
|
1012
1057
|
Row,
|
|
1013
1058
|
SizedBox,
|
|
1014
|
-
Spacer
|
|
1059
|
+
Spacer,
|
|
1060
|
+
Surface
|
|
1015
1061
|
};
|