Fix some warnings: avoid deprecated fields
This commit is contained in:
1 parent
6aa800018b
commit
cae0c1409d
4 files changed
+7
-5
No files matched your search
@@ -1,5 +1,4 @@
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_core::UiEvent;
|
||||
use dioxus_html::on::{FocusData, KeyboardData, MouseData, WheelData};
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use dioxus::{events::KeyCode, prelude::*};
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_html::input_data::keyboard_types::Code;
|
||||
|
||||
fn main() {
|
||||
dioxus::tui::launch(app);
|
||||
@@ -27,7 +28,7 @@ fn Button(cx: Scope<ButtonProps>) -> Element {
|
||||
background_color: "{color}",
|
||||
tabindex: "{cx.props.layer}",
|
||||
onkeydown: |e| {
|
||||
if let KeyCode::Space = e.data.key_code{
|
||||
if let Code::Space = e.data.code() {
|
||||
toggle.modify(|f| !f);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#![cfg(target_arch = "wasm32")]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use dioxus_core::prelude::*;
|
||||
use dioxus_core_macro::*;
|
||||
|
||||
@@ -4,6 +4,7 @@ use dioxus_core::*;
|
||||
use dioxus_core_macro::*;
|
||||
use dioxus_hooks::*;
|
||||
use dioxus_html as dioxus_elements;
|
||||
use dioxus_html::input_data::keyboard_types::Code;
|
||||
use dioxus_tui::TuiContext;
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
@@ -60,7 +61,7 @@ fn key_down() {
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
onkeydown: move |evt| {
|
||||
assert_eq!(evt.data.key_code, dioxus_html::KeyCode::A);
|
||||
assert_eq!(evt.data.code(), Code::KeyA);
|
||||
tui_ctx.quit();
|
||||
},
|
||||
}
|
||||
@@ -290,7 +291,7 @@ fn wheel() {
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
onwheel: move |evt| {
|
||||
assert!(evt.data.delta_y > 0.0);
|
||||
assert!(evt.data.delta().strip_units().y > 0.0);
|
||||
tui_ctx.quit();
|
||||
},
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user