File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
plugin/src/App/Components/Notifications Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,15 @@ local FullscreenNotification = Roact.Component:extend("FullscreeFullscreenNotifi
1919function FullscreenNotification :init ()
2020 self .transparency , self .setTransparency = Roact .createBinding (0 )
2121 self .lifetime = self .props .timeout
22+ self .dismissed = false
2223end
2324
2425function FullscreenNotification :dismiss ()
26+ if self .dismissed then
27+ return
28+ end
29+ self .dismissed = true
30+
2531 if self .props .onClose then
2632 self .props .onClose ()
2733 end
@@ -59,8 +65,9 @@ function FullscreenNotification:didMount()
5965end
6066
6167function FullscreenNotification :willUnmount ()
62- if self .timeout and coroutine.status (self .timeout ) ~= " dead " then
68+ if self .timeout and coroutine.status (self .timeout ) == " suspended " then
6369 task .cancel (self .timeout )
70+ self .timeout = nil
6471 end
6572end
6673
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ function Notification:init()
2525 self .binding = bindingUtil .fromMotor (self .motor )
2626
2727 self .lifetime = self .props .timeout
28+ self .dismissed = false
2829
2930 self .motor :onStep (function (value )
3031 if value <= 0 and self .props .onClose then
@@ -34,6 +35,11 @@ function Notification:init()
3435end
3536
3637function Notification :dismiss ()
38+ if self .dismissed then
39+ return
40+ end
41+ self .dismissed = true
42+
3743 self .motor :setGoal (Flipper .Spring .new (0 , {
3844 frequency = 5 ,
3945 dampingRatio = 1 ,
@@ -75,8 +81,9 @@ function Notification:didMount()
7581end
7682
7783function Notification :willUnmount ()
78- if self .timeout and coroutine.status (self .timeout ) ~= " dead " then
84+ if self .timeout and coroutine.status (self .timeout ) == " suspended " then
7985 task .cancel (self .timeout )
86+ self .timeout = nil
8087 end
8188end
8289
You can’t perform that action at this time.
0 commit comments