-
Notifications
You must be signed in to change notification settings - Fork 984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix subs bug #15680
fix subs bug #15680
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ | |
[:f> | ||
(fn [] | ||
(let [duration (or (rf/sub [:toasts/toast-cursor id :duration]) 3000) | ||
on-dismissed #((or (rf/sub [:toasts/toast-cursor id :on-dismissed]) identity) id) | ||
on-dismissed (or (rf/sub [:toasts/toast-cursor id :on-dismissed]) identity) | ||
create-timer (fn [] | ||
(reset! timer (utils.utils/set-timeout close! duration))) | ||
translate-y (reanimated/use-shared-value 0) | ||
|
@@ -80,7 +80,7 @@ | |
(create-timer)))))] | ||
;; create auto dismiss timer, clear timer when unmount or duration changed | ||
(rn/use-effect (fn [] (create-timer) clear-timer) [duration]) | ||
(rn/use-unmount on-dismissed) | ||
(rn/use-unmount #(on-dismissed id)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to pass the I'm just wondering why it wouldn't work using just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's just to handle situations where id and on-dismissed are both dynamically generated and hard or not elegant enough to pass the id to the on-dismissed fn. |
||
[gesture/gesture-detector {:gesture pan} | ||
[reanimated/view | ||
{;; TODO: this will enable layout animation at runtime and causing flicker on android | ||
|
@@ -100,4 +100,5 @@ | |
[into | ||
[rn/view | ||
{:style style/outmost-transparent-container}] | ||
(map (fn [id] ^{:key id} [container id]) toasts-ordered)])) | ||
(doall | ||
(map (fn [id] ^{:key id} [container id]) toasts-ordered))])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the fix