@swan-io/lake 8.18.2 → 8.18.3
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/package.json
CHANGED
|
@@ -3,10 +3,11 @@ import { Option } from "@swan-io/boxed";
|
|
|
3
3
|
import { cloneElement, memo, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, } from "react";
|
|
4
4
|
import { StyleSheet, View } from "react-native";
|
|
5
5
|
import { commonStyles } from "../constants/commonStyles";
|
|
6
|
-
import { backgroundColor as backgroundColorVariants, colors, spacings } from "../constants/design";
|
|
6
|
+
import { backgroundColor as backgroundColorVariants, colors, negativeSpacings, spacings, } from "../constants/design";
|
|
7
7
|
import { useHover } from "../hooks/useHover";
|
|
8
8
|
import { ScrollView } from "./ScrollView";
|
|
9
9
|
import { Space } from "./Space";
|
|
10
|
+
const HORIZONTAL_ROW_PADDING = 8;
|
|
10
11
|
const styles = StyleSheet.create({
|
|
11
12
|
container: {
|
|
12
13
|
...commonStyles.fill,
|
|
@@ -19,19 +20,26 @@ const styles = StyleSheet.create({
|
|
|
19
20
|
flexDirection: "row",
|
|
20
21
|
alignItems: "stretch",
|
|
21
22
|
zIndex: 2,
|
|
23
|
+
paddingHorizontal: spacings[HORIZONTAL_ROW_PADDING],
|
|
22
24
|
},
|
|
23
25
|
cellsContainer: {
|
|
24
26
|
flexDirection: "row",
|
|
25
27
|
transform: "translateZ(0)",
|
|
28
|
+
marginHorizontal: negativeSpacings[HORIZONTAL_ROW_PADDING],
|
|
29
|
+
paddingHorizontal: spacings[HORIZONTAL_ROW_PADDING],
|
|
26
30
|
},
|
|
27
31
|
stickedToStartColumnGroup: {
|
|
28
32
|
position: "sticky",
|
|
29
33
|
left: 0,
|
|
34
|
+
marginLeft: negativeSpacings[HORIZONTAL_ROW_PADDING],
|
|
35
|
+
paddingLeft: spacings[HORIZONTAL_ROW_PADDING],
|
|
30
36
|
zIndex: 1,
|
|
31
37
|
},
|
|
32
38
|
stickedToEndColumnGroup: {
|
|
33
39
|
position: "sticky",
|
|
34
40
|
right: 0,
|
|
41
|
+
marginRight: negativeSpacings[HORIZONTAL_ROW_PADDING],
|
|
42
|
+
paddingRight: spacings[HORIZONTAL_ROW_PADDING],
|
|
35
43
|
zIndex: 1,
|
|
36
44
|
},
|
|
37
45
|
rowsContainer: {
|
|
@@ -43,6 +51,7 @@ const styles = StyleSheet.create({
|
|
|
43
51
|
right: 0,
|
|
44
52
|
flexDirection: "row",
|
|
45
53
|
alignItems: "stretch",
|
|
54
|
+
paddingHorizontal: spacings[HORIZONTAL_ROW_PADDING],
|
|
46
55
|
},
|
|
47
56
|
headerCell: {
|
|
48
57
|
display: "flex",
|
|
@@ -160,7 +169,10 @@ export const VirtualizedList = ({ variant, data, stickedToStartColumns, columns,
|
|
|
160
169
|
const stickedToEndColumnsWidth = useMemo(() => Option.fromNullable(stickedToEndColumns)
|
|
161
170
|
.map(columns => columns.reduce((acc, column) => acc + column.width, 0))
|
|
162
171
|
.getOr(0), [stickedToEndColumns]);
|
|
163
|
-
const contentContainerWidth = stickedToStartColumnsWidth +
|
|
172
|
+
const contentContainerWidth = stickedToStartColumnsWidth +
|
|
173
|
+
centerColumnsWidth +
|
|
174
|
+
stickedToEndColumnsWidth +
|
|
175
|
+
HORIZONTAL_ROW_PADDING * 2;
|
|
164
176
|
const backgroundColor = backgroundColorVariants[variant];
|
|
165
177
|
// We store the `startIndex` and `endIndex` rather than the scroll position
|
|
166
178
|
// so that it triggers way less re-renders
|