Skip to content

Commit c322ba6

Browse files
committed
fix(BottomSheet): Add safe area and flagship app height to compute toolbar height
1 parent 64c6c5e commit c322ba6

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

react/BottomSheet/helpers.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ export const computeToolbarHeight = (toolbarProps = {}) => {
1414
computedToolbarHeight = ref.current.offsetHeight
1515
}
1616

17-
return computedToolbarHeight
17+
return (
18+
computedToolbarHeight +
19+
(getFlagshipMetadata().statusBarHeight || 0) +
20+
getSafeAreaValue('top')
21+
)
1822
}
1923

2024
export const computeMaxHeight = toolbarProps => {

react/BottomSheet/helpers.spec.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ describe('computeMaxHeight', () => {
2222
it('should return correct value if no arg', () => {
2323
const res = computeMaxHeight({})
2424

25-
expect(res).toBe(799)
25+
expect(res).toBe(784)
2626
})
2727

2828
it('should return correct value with height arg', () => {
2929
const res = computeMaxHeight({ height: 50 })
3030

31-
expect(res).toBe(750)
31+
expect(res).toBe(735)
3232
})
3333

3434
it('should return correct value with ref arg', () => {
3535
const res = computeMaxHeight({ ref: { current: { offsetHeight: 50 } } })
3636

37-
expect(res).toBe(750)
37+
expect(res).toBe(735)
3838
})
3939
})
4040

@@ -397,7 +397,7 @@ describe('computeBottomSpacer', () => {
397397
offset: 0
398398
})
399399

400-
expect(res).toBe(1)
400+
expect(res).toBe(16)
401401
})
402402

403403
it('should return the toolbar height', () => {
@@ -409,7 +409,7 @@ describe('computeBottomSpacer', () => {
409409
offset: 0
410410
})
411411

412-
expect(res).toBe(50)
412+
expect(res).toBe(65)
413413
})
414414

415415
it('should return the offset value and border', () => {
@@ -420,7 +420,7 @@ describe('computeBottomSpacer', () => {
420420
offset: 48
421421
})
422422

423-
expect(res).toBe(49)
423+
expect(res).toBe(64)
424424
})
425425

426426
it('should return the offset value and border and toolbar height', () => {
@@ -432,7 +432,7 @@ describe('computeBottomSpacer', () => {
432432
offset: 48
433433
})
434434

435-
expect(res).toBe(98)
435+
expect(res).toBe(113)
436436
})
437437
})
438438
})
@@ -495,7 +495,7 @@ describe('computeBottomSpacer', () => {
495495
offset: 0
496496
})
497497

498-
expect(res).toBe(1)
498+
expect(res).toBe(16)
499499
})
500500

501501
it('should return the toolbar height', () => {
@@ -507,7 +507,7 @@ describe('computeBottomSpacer', () => {
507507
offset: 0
508508
})
509509

510-
expect(res).toBe(50)
510+
expect(res).toBe(65)
511511
})
512512

513513
it('should return the offset value', () => {
@@ -518,7 +518,7 @@ describe('computeBottomSpacer', () => {
518518
offset: 48
519519
})
520520

521-
expect(res).toBe(49)
521+
expect(res).toBe(64)
522522
})
523523

524524
it('should return the offset value and toolbar height', () => {
@@ -530,7 +530,7 @@ describe('computeBottomSpacer', () => {
530530
offset: 48
531531
})
532532

533-
expect(res).toBe(98)
533+
expect(res).toBe(113)
534534
})
535535
})
536536
})
@@ -540,18 +540,18 @@ describe('computeToolbarHeight', () => {
540540
it('should return the height prop', () => {
541541
const res = computeToolbarHeight({ height: 50 })
542542

543-
expect(res).toBe(50)
543+
expect(res).toBe(65)
544544
})
545545

546546
it('should return the height from ref', () => {
547547
const res = computeToolbarHeight({ ref: { current: { offsetHeight: 50 } } })
548548

549-
expect(res).toBe(50)
549+
expect(res).toBe(65)
550550
})
551551

552552
it('should return default value', () => {
553553
const res = computeToolbarHeight()
554554

555-
expect(res).toBe(1)
555+
expect(res).toBe(16)
556556
})
557557
})

0 commit comments

Comments
 (0)