I've been working on integrating signals into dioxus-spring and I have this weird issue using this new hook. Animations work great using this code in the crate examples, but writing to the signal from dioxus-use-gesture (which uses custom event handlers) doesn't. Both crates worked before the update but now only spring does 🤔 This is the hook minus the funky type desc:
let spring_ref = use_spring_ref(cx, from, f);
to_owned![spring_ref];
let signal: Signal<Option<(V, Option<Duration>)>> = use_signal(cx, || None);
dioxus_signals::use_effect(cx, move || {
// Not being called with 'static event handlers
// Called with dioxus listeners
if let Some((to, duration_cell)) = &*signal.read() {
if let Some(duration) = duration_cell {
spring_ref.animate(to.clone(), *duration);
} else {
spring_ref.set(to.clone());
}
}
});
UseSpringSignal { signal }