@@ -7,10 +7,10 @@ import { useSnapPoints } from '../../hooks/bottomSheet';
7
7
import { useAppDispatch , useAppSelector } from '../../hooks/redux' ;
8
8
import { startCoopCloseTimestampSelector } from '../../store/reselect/user' ;
9
9
import { clearCoopCloseTimer } from '../../store/slices/user' ;
10
- import { closeSheet , showBottomSheet } from '../../store/utils/ui' ;
11
10
import { Display } from '../../styles/text' ;
12
11
import { closeAllChannels } from '../../utils/lightning' ;
13
12
import { showToast } from '../../utils/notifications' ;
13
+ import { useSheetRef } from './SheetRefsProvider' ;
14
14
15
15
const imageSrc = require ( '../../assets/illustrations/exclamation-mark.png' ) ;
16
16
@@ -21,10 +21,12 @@ const ForceTransfer = (): ReactElement => {
21
21
const { t } = useTranslation ( 'lightning' ) ;
22
22
const snapPoints = useSnapPoints ( 'large' ) ;
23
23
const dispatch = useAppDispatch ( ) ;
24
+ const sheetRef = useSheetRef ( 'forceTransfer' ) ;
24
25
const startTime = useAppSelector ( startCoopCloseTimestampSelector ) ;
25
26
const [ isPending , setIsPending ] = useState ( false ) ;
26
27
27
28
// try to cooperatively close the channel(s) for 30min
29
+ // biome-ignore lint/correctness/useExhaustiveDependencies: sheetRef doesn't change
28
30
useEffect ( ( ) => {
29
31
// biome-ignore lint/style/useConst: false alarm
30
32
let interval : NodeJS . Timer ;
@@ -57,7 +59,7 @@ const ForceTransfer = (): ReactElement => {
57
59
console . log ( 'giving up on coop close.' ) ;
58
60
dispatch ( clearCoopCloseTimer ( ) ) ;
59
61
clearInterval ( interval ) ;
60
- showBottomSheet ( 'forceTransfer' ) ;
62
+ sheetRef . current ?. present ( ) ;
61
63
return ;
62
64
}
63
65
@@ -70,7 +72,7 @@ const ForceTransfer = (): ReactElement => {
70
72
} , [ startTime , dispatch ] ) ;
71
73
72
74
const onCancel = ( ) : void => {
73
- closeSheet ( 'forceTransfer' ) ;
75
+ sheetRef . current ?. close ( ) ;
74
76
} ;
75
77
76
78
const onContinue = async ( ) : Promise < void > => {
@@ -96,7 +98,7 @@ const ForceTransfer = (): ReactElement => {
96
98
title : t ( 'force_init_title' ) ,
97
99
description : t ( 'force_init_msg' ) ,
98
100
} ) ;
99
- closeSheet ( 'forceTransfer' ) ;
101
+ sheetRef . current ?. close ( ) ;
100
102
} else {
101
103
showToast ( {
102
104
type : 'warning' ,
0 commit comments