@butternutbox/pawprint-native 0.5.0 → 0.5.1
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/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +23 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/Drawer/DrawerBody.tsx +29 -7
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react"
|
|
2
|
-
import { ScrollView, ScrollViewProps } from "react-native"
|
|
2
|
+
import { ScrollView, ScrollViewProps, useWindowDimensions } from "react-native"
|
|
3
3
|
import styled from "@emotion/native"
|
|
4
4
|
import { useTheme } from "@emotion/react"
|
|
5
5
|
import { useDrawerHeaderContext } from "./DrawerHeaderContext"
|
|
6
|
+
import { useDrawerFooterContext } from "./DrawerFooterContext"
|
|
6
7
|
|
|
7
8
|
export type DrawerBodyProps = ScrollViewProps
|
|
8
9
|
|
|
@@ -12,12 +13,24 @@ const StyledScrollView = styled(ScrollView)<{
|
|
|
12
13
|
bodyPaddingHorizontal: number
|
|
13
14
|
bodyPaddingRight: number
|
|
14
15
|
bodyGap: number
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
bodyMaxHeight: number
|
|
17
|
+
bodyPaddingBottom: number
|
|
18
|
+
}>(
|
|
19
|
+
({
|
|
20
|
+
bodyPaddingHorizontal,
|
|
21
|
+
bodyPaddingRight,
|
|
22
|
+
bodyGap,
|
|
23
|
+
bodyMaxHeight,
|
|
24
|
+
bodyPaddingBottom
|
|
25
|
+
}) => ({
|
|
26
|
+
flex: 1,
|
|
27
|
+
paddingLeft: bodyPaddingHorizontal,
|
|
28
|
+
paddingRight: bodyPaddingRight,
|
|
29
|
+
gap: bodyGap,
|
|
30
|
+
maxHeight: bodyMaxHeight,
|
|
31
|
+
paddingBottom: bodyPaddingBottom
|
|
32
|
+
})
|
|
33
|
+
)
|
|
21
34
|
|
|
22
35
|
/**
|
|
23
36
|
* Scrollable content area of the drawer. Grows to fill available space
|
|
@@ -30,10 +43,13 @@ export const DrawerBody = React.forwardRef<ScrollView, DrawerBodyProps>(
|
|
|
30
43
|
const { buttons } = theme.tokens.components
|
|
31
44
|
const { content } = spacing
|
|
32
45
|
const headerContext = useDrawerHeaderContext()
|
|
46
|
+
const footerContext = useDrawerFooterContext()
|
|
47
|
+
const { height: windowHeight } = useWindowDimensions()
|
|
33
48
|
|
|
34
49
|
const gap = parseTokenValue(content.slot.gap)
|
|
35
50
|
const horizontalPadding = parseTokenValue(content.slot.horizontalPadding)
|
|
36
51
|
const topPadding = parseTokenValue(content.slot.verticalPadding)
|
|
52
|
+
const bodyMaxHeight = windowHeight - 300
|
|
37
53
|
|
|
38
54
|
// When there's no header the close button floats in the top-right corner.
|
|
39
55
|
// Reserve space on the right so body content doesn't slide under it.
|
|
@@ -43,12 +59,18 @@ export const DrawerBody = React.forwardRef<ScrollView, DrawerBodyProps>(
|
|
|
43
59
|
parseTokenValue(buttons.size.sm.height)
|
|
44
60
|
: horizontalPadding
|
|
45
61
|
|
|
62
|
+
const bodyPaddingBottom = !footerContext
|
|
63
|
+
? parseTokenValue(theme.tokens.semantics.dimensions.spacing["2xl"])
|
|
64
|
+
: 0
|
|
65
|
+
|
|
46
66
|
return (
|
|
47
67
|
<StyledScrollView
|
|
48
68
|
ref={ref}
|
|
49
69
|
bodyPaddingHorizontal={horizontalPadding}
|
|
50
70
|
bodyPaddingRight={paddingRight}
|
|
51
71
|
bodyGap={gap}
|
|
72
|
+
bodyMaxHeight={bodyMaxHeight}
|
|
73
|
+
bodyPaddingBottom={bodyPaddingBottom}
|
|
52
74
|
contentContainerStyle={[
|
|
53
75
|
{
|
|
54
76
|
gap,
|