@ledgerhq/lumen-ui-rnative 0.1.51 → 0.1.53

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.
Files changed (123) hide show
  1. package/dist/module/index.js +1 -1
  2. package/dist/module/index.js.map +1 -1
  3. package/dist/module/lib/Components/Avatar/Avatar.figma.js +3 -6
  4. package/dist/module/lib/Components/Avatar/Avatar.figma.js.map +1 -1
  5. package/dist/module/lib/Components/Avatar/Avatar.js +92 -39
  6. package/dist/module/lib/Components/Avatar/Avatar.js.map +1 -1
  7. package/dist/module/lib/Components/Avatar/Avatar.mdx +36 -191
  8. package/dist/module/lib/Components/Avatar/Avatar.stories.js +80 -125
  9. package/dist/module/lib/Components/Avatar/Avatar.stories.js.map +1 -1
  10. package/dist/module/lib/Components/Avatar/Avatar.test.js +56 -45
  11. package/dist/module/lib/Components/Avatar/Avatar.test.js.map +1 -1
  12. package/dist/module/lib/Components/Avatar/index.js +1 -0
  13. package/dist/module/lib/Components/Avatar/index.js.map +1 -1
  14. package/dist/module/lib/Components/Avatar/resolveAvatarColor.js +18 -0
  15. package/dist/module/lib/Components/Avatar/resolveAvatarColor.js.map +1 -0
  16. package/dist/module/lib/Components/AvatarButton/AvatarButton.js +77 -0
  17. package/dist/module/lib/Components/AvatarButton/AvatarButton.js.map +1 -0
  18. package/dist/module/lib/Components/AvatarButton/AvatarButton.mdx +62 -0
  19. package/dist/module/lib/Components/AvatarButton/AvatarButton.stories.js +59 -0
  20. package/dist/module/lib/Components/AvatarButton/AvatarButton.stories.js.map +1 -0
  21. package/dist/module/lib/Components/AvatarButton/AvatarButton.test.js +100 -0
  22. package/dist/module/lib/Components/AvatarButton/AvatarButton.test.js.map +1 -0
  23. package/dist/module/lib/Components/AvatarButton/index.js +5 -0
  24. package/dist/module/lib/Components/AvatarButton/index.js.map +1 -0
  25. package/dist/module/lib/Components/AvatarButton/types.js +4 -0
  26. package/dist/module/lib/Components/AvatarButton/types.js.map +1 -0
  27. package/dist/module/lib/Components/BottomSheet/BottomSheet.js +4 -1
  28. package/dist/module/lib/Components/BottomSheet/BottomSheet.js.map +1 -1
  29. package/dist/module/lib/Components/BottomSheet/BottomSheet.mdx +133 -2
  30. package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js +114 -7
  31. package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js.map +1 -1
  32. package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js +150 -1
  33. package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js.map +1 -1
  34. package/dist/module/lib/Components/BottomSheet/BottomSheetContent.js +35 -0
  35. package/dist/module/lib/Components/BottomSheet/BottomSheetContent.js.map +1 -0
  36. package/dist/module/lib/Components/BottomSheet/BottomSheetFooter.js +43 -0
  37. package/dist/module/lib/Components/BottomSheet/BottomSheetFooter.js.map +1 -0
  38. package/dist/module/lib/Components/BottomSheet/Scrollables.js +18 -3
  39. package/dist/module/lib/Components/BottomSheet/Scrollables.js.map +1 -1
  40. package/dist/module/lib/Components/BottomSheet/index.js +2 -0
  41. package/dist/module/lib/Components/BottomSheet/index.js.map +1 -1
  42. package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.js +16 -1
  43. package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.js.map +1 -1
  44. package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.test.js +16 -0
  45. package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.test.js.map +1 -1
  46. package/dist/module/lib/Components/MediaBanner/MediaBanner.js +55 -37
  47. package/dist/module/lib/Components/MediaBanner/MediaBanner.js.map +1 -1
  48. package/dist/module/lib/Components/MediaBanner/MediaBanner.mdx +25 -3
  49. package/dist/module/lib/Components/MediaBanner/MediaBanner.stories.js +23 -0
  50. package/dist/module/lib/Components/MediaBanner/MediaBanner.stories.js.map +1 -1
  51. package/dist/module/lib/Components/MediaBanner/MediaBanner.test.js +17 -0
  52. package/dist/module/lib/Components/MediaBanner/MediaBanner.test.js.map +1 -1
  53. package/dist/module/lib/Components/index.js +1 -0
  54. package/dist/module/lib/Components/index.js.map +1 -1
  55. package/dist/typescript/src/index.d.ts +1 -1
  56. package/dist/typescript/src/index.d.ts.map +1 -1
  57. package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts +3 -3
  58. package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts.map +1 -1
  59. package/dist/typescript/src/lib/Components/Avatar/index.d.ts +1 -0
  60. package/dist/typescript/src/lib/Components/Avatar/index.d.ts.map +1 -1
  61. package/dist/typescript/src/lib/Components/Avatar/resolveAvatarColor.d.ts +8 -0
  62. package/dist/typescript/src/lib/Components/Avatar/resolveAvatarColor.d.ts.map +1 -0
  63. package/dist/typescript/src/lib/Components/Avatar/types.d.ts +22 -7
  64. package/dist/typescript/src/lib/Components/Avatar/types.d.ts.map +1 -1
  65. package/dist/typescript/src/lib/Components/AvatarButton/AvatarButton.d.ts +13 -0
  66. package/dist/typescript/src/lib/Components/AvatarButton/AvatarButton.d.ts.map +1 -0
  67. package/dist/typescript/src/lib/Components/AvatarButton/index.d.ts +3 -0
  68. package/dist/typescript/src/lib/Components/AvatarButton/index.d.ts.map +1 -0
  69. package/dist/typescript/src/lib/Components/AvatarButton/types.d.ts +11 -0
  70. package/dist/typescript/src/lib/Components/AvatarButton/types.d.ts.map +1 -0
  71. package/dist/typescript/src/lib/Components/BottomSheet/BottomSheet.d.ts +8 -1
  72. package/dist/typescript/src/lib/Components/BottomSheet/BottomSheet.d.ts.map +1 -1
  73. package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetContent.d.ts +3 -0
  74. package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetContent.d.ts.map +1 -0
  75. package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetFooter.d.ts +3 -0
  76. package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetFooter.d.ts.map +1 -0
  77. package/dist/typescript/src/lib/Components/BottomSheet/Scrollables.d.ts +1 -0
  78. package/dist/typescript/src/lib/Components/BottomSheet/Scrollables.d.ts.map +1 -1
  79. package/dist/typescript/src/lib/Components/BottomSheet/index.d.ts +2 -0
  80. package/dist/typescript/src/lib/Components/BottomSheet/index.d.ts.map +1 -1
  81. package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts +2 -0
  82. package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts.map +1 -1
  83. package/dist/typescript/src/lib/Components/DotIndicator/getDotIndicatorProps.d.ts +32 -0
  84. package/dist/typescript/src/lib/Components/DotIndicator/getDotIndicatorProps.d.ts.map +1 -1
  85. package/dist/typescript/src/lib/Components/MediaBanner/MediaBanner.d.ts +1 -1
  86. package/dist/typescript/src/lib/Components/MediaBanner/MediaBanner.d.ts.map +1 -1
  87. package/dist/typescript/src/lib/Components/MediaBanner/types.d.ts +1 -1
  88. package/dist/typescript/src/lib/Components/MediaBanner/types.d.ts.map +1 -1
  89. package/dist/typescript/src/lib/Components/index.d.ts +1 -0
  90. package/dist/typescript/src/lib/Components/index.d.ts.map +1 -1
  91. package/package.json +3 -3
  92. package/src/index.ts +1 -1
  93. package/src/lib/Components/Avatar/Avatar.figma.tsx +2 -5
  94. package/src/lib/Components/Avatar/Avatar.mdx +36 -191
  95. package/src/lib/Components/Avatar/Avatar.stories.tsx +58 -83
  96. package/src/lib/Components/Avatar/Avatar.test.tsx +58 -58
  97. package/src/lib/Components/Avatar/Avatar.tsx +100 -32
  98. package/src/lib/Components/Avatar/index.ts +1 -0
  99. package/src/lib/Components/Avatar/resolveAvatarColor.ts +19 -0
  100. package/src/lib/Components/Avatar/types.ts +23 -7
  101. package/src/lib/Components/AvatarButton/AvatarButton.mdx +62 -0
  102. package/src/lib/Components/AvatarButton/AvatarButton.stories.tsx +58 -0
  103. package/src/lib/Components/AvatarButton/AvatarButton.test.tsx +92 -0
  104. package/src/lib/Components/AvatarButton/AvatarButton.tsx +77 -0
  105. package/src/lib/Components/AvatarButton/index.ts +2 -0
  106. package/src/lib/Components/AvatarButton/types.ts +15 -0
  107. package/src/lib/Components/BottomSheet/BottomSheet.mdx +133 -2
  108. package/src/lib/Components/BottomSheet/BottomSheet.stories.tsx +111 -5
  109. package/src/lib/Components/BottomSheet/BottomSheet.test.tsx +140 -0
  110. package/src/lib/Components/BottomSheet/BottomSheet.tsx +25 -9
  111. package/src/lib/Components/BottomSheet/BottomSheetContent.tsx +44 -0
  112. package/src/lib/Components/BottomSheet/BottomSheetFooter.tsx +47 -0
  113. package/src/lib/Components/BottomSheet/Scrollables.tsx +25 -12
  114. package/src/lib/Components/BottomSheet/index.ts +2 -0
  115. package/src/lib/Components/BottomSheet/types.ts +2 -1
  116. package/src/lib/Components/DotIndicator/getDotIndicatorProps.test.ts +16 -0
  117. package/src/lib/Components/DotIndicator/getDotIndicatorProps.ts +6 -2
  118. package/src/lib/Components/MediaBanner/MediaBanner.mdx +25 -3
  119. package/src/lib/Components/MediaBanner/MediaBanner.stories.tsx +25 -0
  120. package/src/lib/Components/MediaBanner/MediaBanner.test.tsx +18 -0
  121. package/src/lib/Components/MediaBanner/MediaBanner.tsx +54 -32
  122. package/src/lib/Components/MediaBanner/types.ts +1 -1
  123. package/src/lib/Components/index.ts +1 -0
@@ -0,0 +1,77 @@
1
+ import { useDisabledContext } from '@ledgerhq/lumen-utils-shared';
2
+ import { StyleSheet, View } from 'react-native';
3
+ import { useStyleSheet } from '../../../styles';
4
+ import { Avatar } from '../Avatar/Avatar';
5
+ import { Pressable } from '../Utility';
6
+ import type { AvatarButtonProps } from './types';
7
+
8
+ /**
9
+ * An {@link Avatar} wrapped in a Pressable, for use as an interactive trigger.
10
+ *
11
+ * @see {@link https://ldls-react-native.vercel.app/?path=/docs/rnative-avatar-button--docs Storybook}
12
+ *
13
+ * @example
14
+ * import { AvatarButton } from '@ledgerhq/lumen-ui-rnative';
15
+ *
16
+ * <AvatarButton src="https://example.com/photo.jpg" alt="Open user menu" onPress={openMenu} />
17
+ */
18
+ export const AvatarButton = ({
19
+ src,
20
+ alt,
21
+ size,
22
+ fallbackText,
23
+ fallbackColor,
24
+ appearance,
25
+ disabled: disabledProp = false,
26
+ style,
27
+ ...props
28
+ }: AvatarButtonProps) => {
29
+ const disabled = useDisabledContext({
30
+ consumerName: 'AvatarButton',
31
+ mergeWith: { disabled: disabledProp },
32
+ });
33
+ const styles = useStyles({ disabled });
34
+
35
+ return (
36
+ <Pressable
37
+ accessibilityRole='button'
38
+ disabled={disabled}
39
+ style={[styles.container, style]}
40
+ {...props}
41
+ >
42
+ {({ pressed }) => (
43
+ <>
44
+ <Avatar
45
+ src={src}
46
+ alt={alt}
47
+ size={size}
48
+ fallbackText={fallbackText}
49
+ fallbackColor={fallbackColor}
50
+ appearance={appearance}
51
+ />
52
+ <View
53
+ style={[styles.overlay, pressed && styles.overlayPressed]}
54
+ pointerEvents='none'
55
+ />
56
+ </>
57
+ )}
58
+ </Pressable>
59
+ );
60
+ };
61
+
62
+ const useStyles = ({ disabled }: { disabled: boolean }) =>
63
+ useStyleSheet(
64
+ (t) => ({
65
+ container: {
66
+ ...(disabled && { opacity: 0.3 }),
67
+ },
68
+ overlay: {
69
+ ...StyleSheet.absoluteFillObject,
70
+ borderRadius: 9999,
71
+ },
72
+ overlayPressed: {
73
+ backgroundColor: t.colors.bg.baseTransparentPressed,
74
+ },
75
+ }),
76
+ [disabled],
77
+ );
@@ -0,0 +1,2 @@
1
+ export { AvatarButton } from './AvatarButton';
2
+ export * from './types';
@@ -0,0 +1,15 @@
1
+ import type { StyledPressableProps } from '../../../styles';
2
+ import type { AvatarProps } from '../Avatar/types';
3
+
4
+ export type AvatarButtonProps = Pick<
5
+ AvatarProps,
6
+ 'src' | 'alt' | 'size' | 'fallbackText' | 'fallbackColor' | 'appearance'
7
+ > &
8
+ StyledPressableProps & {
9
+ /**
10
+ * When `true`, prevents the user from interacting with the avatar.
11
+ *
12
+ * @default false
13
+ */
14
+ disabled?: boolean;
15
+ };
@@ -24,7 +24,8 @@ BottomSheet provides a flexible and performant way to present content, forms, or
24
24
  - **Handle**: Visual indicator for draggable area
25
25
  - **Backdrop**: Semi-transparent overlay behind the sheet
26
26
  - **Header**: Optional header with title, description, back button, and close button
27
- - **Content**: Scrollable or static content using specialized scrollable components
27
+ - **Content**: Scrollable or static content
28
+ - **Footer**: Optional sticky area pinned to the bottom of the sheet
28
29
 
29
30
  ## Properties
30
31
 
@@ -97,6 +98,37 @@ Set both properties:
97
98
 
98
99
  <Canvas of={BottomSheetStories.PreventClose} />
99
100
 
101
+ ### Footer
102
+
103
+ `BottomSheetFooter` renders a sticky area pinned below the scrollable region.
104
+
105
+ `BottomSheetContent` is a non-scrollable content block that applies standard paddings.
106
+
107
+ #### BottomSheetContent
108
+
109
+ Gorhom's `BottomSheetView` is `position: absolute; top: 0`, so it always overlaps content above it-including the header. For this reason you cannot nest a second `BottomSheetView` inside another one to wrap your body content.
110
+
111
+ When using dynamic sizing (`enableDynamicSizing`), everything must live inside a single Gorhom-aware wrapper (`BottomSheetView`) so the library can measure the total height correctly. That rules out an extra `BottomSheetView` as a content wrapper.
112
+
113
+ `BottomSheetContent` solves this: it is a plain `Box`-based container (not a Gorhom component) with the standard horizontal and vertical paddings already built in, so you get consistent spacing without fighting the absolute-positioning constraint.
114
+
115
+ #### Automatic padding stripping
116
+
117
+ To avoid double-padding, `BottomSheetContent` and `BottomSheetFooter` communicate with their parent via React context:
118
+
119
+ - If `BottomSheetContent` is a child of `BottomSheetView`, its `paddingHorizontal` is dropped (the view already provides it).
120
+ - If a `BottomSheetFooter` is present inside the bottom sheet, `BottomSheetContent` drops its `paddingBottom` (the footer already handles the bottom spacing).
121
+
122
+ This means all combinations—with/without dynamic sizing, with/without a footer—produce consistent spacing automatically.
123
+
124
+ #### Scrollable content with a sticky footer
125
+
126
+ Footer and scrollable are siblings directly inside `BottomSheet`.
127
+
128
+ <Canvas of={BottomSheetStories.WithFooter} />
129
+
130
+ > **Android 3-button navigation:** If the footer is obscured by the system navigation bar, you can pass a bottom margin via `style` or `lx` to raise it.
131
+
100
132
  </Tab>
101
133
  <Tab label="Implementation">
102
134
 
@@ -266,10 +298,109 @@ import {
266
298
  </BottomSheet>
267
299
  ```
268
300
 
301
+ ### Footer and Content
302
+
303
+ #### BottomSheetFooter
304
+
305
+ `BottomSheetFooter` renders a sticky area at the bottom of the sheet. It must be placed inside a `BottomSheet` (context is required).
306
+
307
+ #### BottomSheetContent
308
+
309
+ `BottomSheetContent` is a non-scrollable `Box`-based container with `lx` support. By default it applies horizontal and vertical paddings.
310
+
311
+ Use it as the body wrapper whenever you need a static (non-scrollable) content area inside a `BottomSheetView`. Do **not** use a second `BottomSheetView` for this purpose. Gorhom's `BottomSheetView` is `position: absolute; top: 0`, so nesting one inside another causes it to overlap the header rather than flow below it. `BottomSheetContent` is a plain `Box` that avoids this constraint entirely.
312
+
313
+ When using dynamic sizing, all content must live inside a single `BottomSheetView` so the library can measure the sheet height. `BottomSheetContent` works correctly in this setup; a nested `BottomSheetView` does not.
314
+
315
+ Padding is handled automatically via context:
316
+ - `paddingHorizontal` is stripped when `BottomSheetContent` is a child of `BottomSheetView` (the view already provides it).
317
+ - `paddingBottom` is stripped when a `BottomSheetFooter` is present (the footer owns the bottom spacing).
318
+
319
+ #### Pattern A: scrollable content with a footer as siblings
320
+
321
+ Footer and scrollable are direct children of `BottomSheet`.
322
+
323
+ ```tsx
324
+ import {
325
+ BottomSheet,
326
+ BottomSheetHeader,
327
+ BottomSheetScrollView,
328
+ BottomSheetFooter,
329
+ useBottomSheetRef,
330
+ } from '@ledgerhq/lumen-ui-rnative';
331
+
332
+ function MyComponent() {
333
+ const ref = useBottomSheetRef();
334
+
335
+ return (
336
+ <BottomSheet ref={ref} snapPoints={['50%']}>
337
+ <BottomSheetHeader spacing title="Title" density="compact" />
338
+ <BottomSheetScrollView>
339
+ {/* scrollable content */}
340
+ </BottomSheetScrollView>
341
+ <BottomSheetFooter>
342
+ <Button size="lg" isFull>Confirm</Button>
343
+ <Button size="lg" isFull appearance="ghost">Cancel</Button>
344
+ </BottomSheetFooter>
345
+ </BottomSheet>
346
+ );
347
+ }
348
+ ```
349
+
350
+ #### Pattern B: static content with a footer inside BottomSheetView
351
+
352
+ Both `BottomSheetContent` and `BottomSheetFooter` are children of `BottomSheetView`.
353
+
354
+ ```tsx
355
+ import {
356
+ BottomSheet,
357
+ BottomSheetView,
358
+ BottomSheetHeader,
359
+ BottomSheetContent,
360
+ BottomSheetFooter,
361
+ useBottomSheetRef,
362
+ } from '@ledgerhq/lumen-ui-rnative';
363
+
364
+ function MyComponent() {
365
+ const ref = useBottomSheetRef();
366
+
367
+ return (
368
+ <BottomSheet ref={ref} snapPoints={null} enableDynamicSizing>
369
+ <BottomSheetView>
370
+ <BottomSheetHeader title="Title" density="compact" />
371
+ <BottomSheetContent lx={{ gap: 's12' }}>
372
+ {/* static content */}
373
+ </BottomSheetContent>
374
+ <BottomSheetFooter>
375
+ <Button size="lg" isFull>Confirm</Button>
376
+ <Button size="lg" isFull appearance="ghost">Cancel</Button>
377
+ </BottomSheetFooter>
378
+ </BottomSheetView>
379
+ </BottomSheet>
380
+ );
381
+ }
382
+ ```
383
+
384
+ #### Pattern C: standalone BottomSheetContent without a scrollable parent
385
+
386
+ `BottomSheetContent` is a direct child of `BottomSheet`, not wrapped in any scrollable.
387
+
388
+ ```tsx
389
+ <BottomSheet ref={ref} snapPoints={['50%']}>
390
+ <BottomSheetHeader spacing title="Title" density="compact" />
391
+ <BottomSheetContent>
392
+ {/* content */}
393
+ </BottomSheetContent>
394
+ <BottomSheetFooter>
395
+ <Button size="lg" isFull>Confirm</Button>
396
+ </BottomSheetFooter>
397
+ </BottomSheet>
398
+ ```
399
+
269
400
  ### Important Notes
270
401
 
271
402
  - **Dynamic Sizing**: When using `enableDynamicSizing`, do not define `snapPoints`
272
- - **Header Spacing**: Use `spacing` prop on `BottomSheetHeader` when using FlatList/VirtualizedList
403
+ - **Header Spacing**: Use `spacing` prop on `BottomSheetHeader` when using FlatList/VirtualizedList or when the footer is a sibling of a list-based scrollable
273
404
  - **SectionList**: Not compatible with react-native-web. See [Gorhom documentation](https://gorhom.dev/react-native-bottom-sheet/components/bottomsheetsectionlist).
274
405
  - **FlashList**: Requires `@shopify/flash-list` package. See [Gorhom docs](https://gorhom.dev/react-native-bottom-sheet/components/bottomsheetflashlist)
275
406
 
@@ -1,11 +1,13 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import type { FC } from 'react';
3
- import { useState } from 'react';
3
+ import { useEffect, useState } from 'react';
4
4
  import { Button } from '../Button';
5
5
  import { SearchInput } from '../SearchInput';
6
6
  import { Spot } from '../Spot';
7
7
  import { Box, RadialGradient, Text } from '../Utility';
8
8
  import { BottomSheet } from './BottomSheet';
9
+ import { BottomSheetContent } from './BottomSheetContent';
10
+ import { BottomSheetFooter } from './BottomSheetFooter';
9
11
  import { BottomSheetHeader } from './BottomSheetHeader';
10
12
  import {
11
13
  BottomSheetFlatList,
@@ -137,7 +139,7 @@ export const Base: Story = {
137
139
  density='compact'
138
140
  description='Description'
139
141
  />
140
- <Box lx={{ flexDirection: 'column', gap: 's12' }}>
142
+ <BottomSheetContent lx={{ flexDirection: 'column', gap: 's12' }}>
141
143
  {Array.from({ length: 3 }).map((_, index) => (
142
144
  <Text typography='body2' lx={{ color: 'base' }} key={index}>
143
145
  Lorem ipsum, dolor sit amet consectetur adipisicing elit.
@@ -146,7 +148,52 @@ export const Base: Story = {
146
148
  voluptates eum, sunt asperiores quod.
147
149
  </Text>
148
150
  ))}
149
- </Box>
151
+ </BottomSheetContent>
152
+ </BottomSheetView>
153
+ </BottomSheet>
154
+ </Box>
155
+ );
156
+ },
157
+ };
158
+
159
+ export const BaseOpen: Story = {
160
+ args: {
161
+ ...Base.args,
162
+ },
163
+ render: (args) => {
164
+ const bottomSheetRef = useBottomSheetRef();
165
+
166
+ useEffect(() => {
167
+ bottomSheetRef.current?.present();
168
+ }, [bottomSheetRef]);
169
+
170
+ return (
171
+ <Box
172
+ lx={{
173
+ height: 's320',
174
+ width: 'full',
175
+ alignItems: 'center',
176
+ justifyContent: 'center',
177
+ paddingTop: 's32',
178
+ }}
179
+ >
180
+ <BottomSheet {...args} ref={bottomSheetRef}>
181
+ <BottomSheetView>
182
+ <BottomSheetHeader
183
+ title='Title'
184
+ density='compact'
185
+ description='Description'
186
+ />
187
+ <BottomSheetContent lx={{ flexDirection: 'column', gap: 's12' }}>
188
+ {Array.from({ length: 3 }).map((_, index) => (
189
+ <Text typography='body2' lx={{ color: 'base' }} key={index}>
190
+ Lorem ipsum, dolor sit amet consectetur adipisicing elit.
191
+ Vitae excepturi odit, quis tenetur iste perspiciatis mollitia
192
+ porro velit laborum quasi numquam reiciendis dolor! Et quia
193
+ voluptates eum, sunt asperiores quod.
194
+ </Text>
195
+ ))}
196
+ </BottomSheetContent>
150
197
  </BottomSheetView>
151
198
  </BottomSheet>
152
199
  </Box>
@@ -187,7 +234,7 @@ export const TitleExpanded: Story = {
187
234
  density='expanded'
188
235
  description='Expanded description.'
189
236
  />
190
- <Box lx={{ flexDirection: 'column', gap: 's12' }}>
237
+ <BottomSheetContent>
191
238
  <Text typography='body2' lx={{ color: 'base' }}>
192
239
  Lorem ipsum dolor sit amet consectetur adipisicing elit. Vitae
193
240
  excepturi odit, quis tenetur iste perspiciatis mollitia porro
@@ -197,7 +244,7 @@ export const TitleExpanded: Story = {
197
244
  consectetur adipiscing elit. Donec ullamcorper nulla non metus
198
245
  auctor fringilla.
199
246
  </Text>
200
- </Box>
247
+ </BottomSheetContent>
201
248
  </BottomSheetView>
202
249
  </BottomSheet>
203
250
  </Box>
@@ -829,3 +876,62 @@ export const InfoStateVariants: Story = {
829
876
  );
830
877
  },
831
878
  };
879
+
880
+ export const WithFooter: Story = {
881
+ args: {
882
+ hideCloseButton: false,
883
+ enableHandlePanningGesture: true,
884
+ enablePanDownToClose: true,
885
+ enableBlurKeyboardOnGesture: true,
886
+ enableDynamicSizing: true,
887
+ detached: false,
888
+ backdropPressBehavior: 'close',
889
+ },
890
+ render: (args) => {
891
+ const bottomSheetRef = useBottomSheetRef();
892
+
893
+ return (
894
+ <Box
895
+ lx={{
896
+ height: 's320',
897
+ width: 'full',
898
+ alignItems: 'center',
899
+ justifyContent: 'center',
900
+ paddingTop: 's32',
901
+ }}
902
+ >
903
+ <Button size='sm' onPress={() => bottomSheetRef.current?.present()}>
904
+ Toggle open
905
+ </Button>
906
+ <BottomSheet {...args} ref={bottomSheetRef}>
907
+ <BottomSheetHeader
908
+ spacing
909
+ title='With Footer'
910
+ density='compact'
911
+ description='Scrollable content with a sticky footer'
912
+ />
913
+ <BottomSheetScrollView>
914
+ <Box lx={{ flexDirection: 'column', gap: 's12' }}>
915
+ {Array.from({ length: 10 }).map((_, index) => (
916
+ <Text typography='body2' lx={{ color: 'base' }} key={index}>
917
+ Item {index + 1}: Lorem ipsum dolor sit amet consectetur
918
+ adipisicing elit. Vitae excepturi odit, quis tenetur iste
919
+ perspiciatis mollitia porro velit laborum quasi numquam
920
+ reiciendis dolor!
921
+ </Text>
922
+ ))}
923
+ </Box>
924
+ </BottomSheetScrollView>
925
+ <BottomSheetFooter>
926
+ <Button size='lg' isFull>
927
+ Confirm
928
+ </Button>
929
+ <Button size='lg' isFull appearance='gray'>
930
+ Cancel
931
+ </Button>
932
+ </BottomSheetFooter>
933
+ </BottomSheet>
934
+ </Box>
935
+ );
936
+ },
937
+ };
@@ -5,7 +5,10 @@ import { fireEvent, render } from '@testing-library/react-native';
5
5
  import { Text, View } from 'react-native';
6
6
  import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
7
7
  import { BottomSheet as BottomSheetComponent } from './BottomSheet';
8
+ import { BottomSheetContent } from './BottomSheetContent';
9
+ import { BottomSheetFooter } from './BottomSheetFooter';
8
10
  import { BottomSheetHeader } from './BottomSheetHeader';
11
+ import { BottomSheetView } from './Scrollables';
9
12
  // Mock react-native-gesture-handler which is used by @gorhom/bottom-sheet
10
13
  jest.mock('react-native-gesture-handler', () => ({}));
11
14
 
@@ -397,3 +400,140 @@ describe('BottomSheet', () => {
397
400
  });
398
401
  });
399
402
  });
403
+
404
+ describe('BottomSheetContent', () => {
405
+ it('renders children', () => {
406
+ const { BottomSheet } = require('./BottomSheet');
407
+ const { getByText } = renderWithTheme(
408
+ <BottomSheet testID='bottom-sheet'>
409
+ <BottomSheetContent>
410
+ <Text>Content child</Text>
411
+ </BottomSheetContent>
412
+ </BottomSheet>,
413
+ );
414
+
415
+ expect(getByText('Content child')).toBeTruthy();
416
+ });
417
+
418
+ it('renders without BottomSheet context without throwing (contextRequired: false)', () => {
419
+ expect(() =>
420
+ renderWithTheme(
421
+ <BottomSheetContent>
422
+ <Text>Standalone</Text>
423
+ </BottomSheetContent>,
424
+ ),
425
+ ).not.toThrow();
426
+ });
427
+
428
+ it('detects scrollable parent context and does not throw', () => {
429
+ const { BottomSheet } = require('./BottomSheet');
430
+ expect(() =>
431
+ renderWithTheme(
432
+ <BottomSheet testID='bottom-sheet'>
433
+ <BottomSheetView>
434
+ <BottomSheetContent>
435
+ <Text>Inside view</Text>
436
+ </BottomSheetContent>
437
+ </BottomSheetView>
438
+ </BottomSheet>,
439
+ ),
440
+ ).not.toThrow();
441
+ });
442
+
443
+ it('renders when BottomSheetFooter is present as a sibling inside BottomSheetView', () => {
444
+ const { BottomSheet } = require('./BottomSheet');
445
+ expect(() =>
446
+ renderWithTheme(
447
+ <BottomSheet testID='bottom-sheet'>
448
+ <BottomSheetView>
449
+ <BottomSheetContent>
450
+ <Text>Content</Text>
451
+ </BottomSheetContent>
452
+ <BottomSheetFooter>
453
+ <Text>Footer</Text>
454
+ </BottomSheetFooter>
455
+ </BottomSheetView>
456
+ </BottomSheet>,
457
+ ),
458
+ ).not.toThrow();
459
+ });
460
+ });
461
+
462
+ describe('BottomSheetFooter', () => {
463
+ it('renders children', () => {
464
+ const { BottomSheet } = require('./BottomSheet');
465
+ const { getByText } = renderWithTheme(
466
+ <BottomSheet testID='bottom-sheet'>
467
+ <BottomSheetFooter>
468
+ <Text>Footer content</Text>
469
+ </BottomSheetFooter>
470
+ </BottomSheet>,
471
+ );
472
+
473
+ expect(getByText('Footer content')).toBeTruthy();
474
+ });
475
+
476
+ it('renders inside BottomSheetView without throwing', () => {
477
+ const { BottomSheet } = require('./BottomSheet');
478
+ expect(() =>
479
+ renderWithTheme(
480
+ <BottomSheet testID='bottom-sheet'>
481
+ <BottomSheetView>
482
+ <BottomSheetFooter>
483
+ <Text>Footer inside view</Text>
484
+ </BottomSheetFooter>
485
+ </BottomSheetView>
486
+ </BottomSheet>,
487
+ ),
488
+ ).not.toThrow();
489
+ });
490
+
491
+ it('signals footer presence to context (renders alongside BottomSheetContent without throwing)', () => {
492
+ const { BottomSheet } = require('./BottomSheet');
493
+ expect(() =>
494
+ renderWithTheme(
495
+ <BottomSheet testID='bottom-sheet'>
496
+ <BottomSheetView>
497
+ <BottomSheetContent>
498
+ <Text>Content</Text>
499
+ </BottomSheetContent>
500
+ <BottomSheetFooter>
501
+ <Text>Footer</Text>
502
+ </BottomSheetFooter>
503
+ </BottomSheetView>
504
+ </BottomSheet>,
505
+ ),
506
+ ).not.toThrow();
507
+ });
508
+ });
509
+
510
+ describe('BottomSheetView', () => {
511
+ it('renders children', () => {
512
+ const { BottomSheet } = require('./BottomSheet');
513
+ const { getByText } = renderWithTheme(
514
+ <BottomSheet testID='bottom-sheet'>
515
+ <BottomSheetView>
516
+ <Text>View child</Text>
517
+ </BottomSheetView>
518
+ </BottomSheet>,
519
+ );
520
+
521
+ expect(getByText('View child')).toBeTruthy();
522
+ });
523
+
524
+ it('renders when BottomSheetFooter is a sibling inside BottomSheetView', () => {
525
+ const { BottomSheet } = require('./BottomSheet');
526
+ expect(() =>
527
+ renderWithTheme(
528
+ <BottomSheet testID='bottom-sheet'>
529
+ <BottomSheetView>
530
+ <Text>Content</Text>
531
+ <BottomSheetFooter>
532
+ <Text>Footer</Text>
533
+ </BottomSheetFooter>
534
+ </BottomSheetView>
535
+ </BottomSheet>,
536
+ ),
537
+ ).not.toThrow();
538
+ });
539
+ });
@@ -1,7 +1,14 @@
1
1
  import type { SNAP_POINT_TYPE } from '@gorhom/bottom-sheet';
2
2
  import { BottomSheetModal as GorhomBottomSheetModal } from '@gorhom/bottom-sheet';
3
3
  import { createSafeContext, useMergedRef } from '@ledgerhq/lumen-utils-shared';
4
- import { useCallback, useMemo, useRef, useState } from 'react';
4
+ import {
5
+ useCallback,
6
+ useMemo,
7
+ useRef,
8
+ useState,
9
+ type Dispatch,
10
+ type SetStateAction,
11
+ } from 'react';
5
12
  import { StyleSheet } from 'react-native';
6
13
  import { useStyleSheet } from '../../../styles';
7
14
  import { RuntimeConstants } from '../../utils';
@@ -56,13 +63,15 @@ const useStyles = ({
56
63
  );
57
64
  };
58
65
 
59
- const [BottomSheetProvider, useBottomSheetContext] =
60
- createSafeContext<
61
- Pick<
62
- BottomSheetProps,
63
- 'onBack' | 'hideCloseButton' | 'onHeaderClosePressed'
64
- >
65
- >('BottomSheet');
66
+ const [BottomSheetProvider, useBottomSheetContext] = createSafeContext<
67
+ Pick<
68
+ BottomSheetProps,
69
+ 'onBack' | 'hideCloseButton' | 'onHeaderClosePressed'
70
+ > & {
71
+ hasFooter: boolean;
72
+ setHasFooter: Dispatch<SetStateAction<boolean>>;
73
+ }
74
+ >('BottomSheet');
66
75
 
67
76
  export const BottomSheet = ({
68
77
  onOpen,
@@ -93,6 +102,7 @@ export const BottomSheet = ({
93
102
  const innerRef = useRef<GorhomBottomSheetModal>(null);
94
103
  const mergedRefs = useMergedRef<GorhomBottomSheetModal>(ref, innerRef);
95
104
  const [isOpen, setIsOpen] = useState(false);
105
+ const [hasFooter, setHasFooter] = useState(false);
96
106
 
97
107
  const styles = useStyles({
98
108
  shadow: hideBackdrop && isOpen,
@@ -208,7 +218,13 @@ export const BottomSheet = ({
208
218
  backdropComponent={hideBackdrop ? undefined : renderBackdrop}
209
219
  >
210
220
  <BottomSheetProvider
211
- value={{ onBack, hideCloseButton, onHeaderClosePressed }}
221
+ value={{
222
+ onBack,
223
+ hideCloseButton,
224
+ onHeaderClosePressed,
225
+ hasFooter,
226
+ setHasFooter,
227
+ }}
212
228
  >
213
229
  {children}
214
230
  </BottomSheetProvider>
@@ -0,0 +1,44 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { useStyleSheet } from '../../../styles';
3
+ import { Box } from '../Utility';
4
+ import { useBottomSheetContext } from './BottomSheet';
5
+ import { useIsInsideScrollableView } from './Scrollables';
6
+ import type { BottomSheetContentProps } from './types';
7
+
8
+ const useStyles = (hasFooter: boolean, isInsideScrollableView: boolean) =>
9
+ useStyleSheet(
10
+ (t) => ({
11
+ container: StyleSheet.flatten([
12
+ {
13
+ flex: 1,
14
+ paddingBottom: hasFooter ? 0 : t.spacings.s16,
15
+ },
16
+ !isInsideScrollableView && {
17
+ paddingHorizontal: t.spacings.s16,
18
+ },
19
+ ]),
20
+ }),
21
+ [hasFooter, isInsideScrollableView],
22
+ );
23
+
24
+ export const BottomSheetContent = ({
25
+ children,
26
+ style,
27
+ lx,
28
+ ...props
29
+ }: BottomSheetContentProps) => {
30
+ const ctx = useBottomSheetContext({
31
+ consumerName: 'BottomSheetContent',
32
+ contextRequired: false,
33
+ });
34
+ const styles = useStyles(
35
+ ctx?.hasFooter ?? false,
36
+ useIsInsideScrollableView(),
37
+ );
38
+
39
+ return (
40
+ <Box {...props} lx={lx} style={[styles.container, style]}>
41
+ {children}
42
+ </Box>
43
+ );
44
+ };