@hero-design/rn 8.78.0 → 8.79.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.
@@ -306,6 +306,41 @@ describe('rendering', () => {
306
306
  expect(getByText('Clear all')).toBeTruthy();
307
307
  expect(getByText('Save')).toBeTruthy();
308
308
  });
309
+
310
+ it('renders correct custom bottom sheet header', () => {
311
+ const { getByText, getByTestId } = renderWithTheme(
312
+ <MultiSelect
313
+ label="Allow notifications"
314
+ options={options}
315
+ value={['mon']}
316
+ onConfirm={jest.fn()}
317
+ bottomSheetConfig={{
318
+ header: <Typography.Body>Custom header</Typography.Body>,
319
+ }}
320
+ footerLabel="Confirm"
321
+ />
322
+ );
323
+
324
+ fireEvent.press(getByTestId('text-input'));
325
+ expect(getByText('Custom header')).toBeTruthy();
326
+ });
327
+
328
+ it('renders correct floating bottom sheet variant', () => {
329
+ const { toJSON, getByTestId, getByText } = renderWithTheme(
330
+ <MultiSelect
331
+ label="Allow notifications"
332
+ options={options}
333
+ value={['mon']}
334
+ onConfirm={jest.fn()}
335
+ bottomSheetConfig={{ variant: 'floating' }}
336
+ footerLabel="Confirm"
337
+ />
338
+ );
339
+
340
+ fireEvent.press(getByTestId('text-input'));
341
+ expect(getByText('Monday')).toBeTruthy();
342
+ expect(toJSON()).toMatchSnapshot();
343
+ });
309
344
  });
310
345
 
311
346
  describe('behavior', () => {
@@ -74,6 +74,7 @@ function MultiSelect<V, T extends OptionType<V>>({
74
74
  testID,
75
75
  value,
76
76
  supportedOrientations = ['portrait'],
77
+ bottomSheetConfig = {},
77
78
  }: MultiSelectProps<V, T>) {
78
79
  const { isKeyboardVisible, keyboardHeight } = useKeyboard();
79
80
  const [open, setOpen] = useState(false);
@@ -86,6 +87,8 @@ function MultiSelect<V, T extends OptionType<V>>({
86
87
  .map((opt) => opt.text)
87
88
  .join(', ');
88
89
  const rawValue = value.length > 0 ? value.join(', ') : '';
90
+ const { variant: bottomSheetVariant, header: bottomSheetHeader } =
91
+ bottomSheetConfig;
89
92
 
90
93
  useEffect(() => {
91
94
  setSelectingValue(value);
@@ -126,12 +129,13 @@ function MultiSelect<V, T extends OptionType<V>>({
126
129
  </TouchableOpacity>
127
130
  </View>
128
131
  <BottomSheet
132
+ variant={bottomSheetVariant || 'fixed'}
129
133
  open={open}
130
134
  onRequestClose={() => {
131
135
  onDismiss?.();
132
136
  setOpen(false);
133
137
  }}
134
- header={label}
138
+ header={bottomSheetHeader || label}
135
139
  style={{
136
140
  paddingBottom: isKeyboardVisible ? keyboardHeight : 0,
137
141
  }}