diff --git a/thaw/src/drawer/mod.rs b/thaw/src/drawer/mod.rs index 90e38d4..fa33ebe 100644 --- a/thaw/src/drawer/mod.rs +++ b/thaw/src/drawer/mod.rs @@ -78,9 +78,9 @@ pub fn Drawer( show.set(false); } }; - let on_esc = move |_: ev::KeyboardEvent| { + let on_esc = Callback::new(move |_: ev::KeyboardEvent| { show.set(false); - }; + }); view! { diff --git a/thaw/src/modal/mod.rs b/thaw/src/modal/mod.rs index 6add373..7000d20 100644 --- a/thaw/src/modal/mod.rs +++ b/thaw/src/modal/mod.rs @@ -34,9 +34,9 @@ pub fn Modal( show.set(false); } }; - let on_esc = move |_: ev::KeyboardEvent| { + let on_esc = Callback::new(move |_: ev::KeyboardEvent| { show.set(false); - }; + }); let mask_ref = NodeRef::::new(); let scrollbar_ref = ComponentRef::::new();