mod.rs 487 B

12345678910111213141516171819202122
  1. mod button;
  2. mod checkbox;
  3. mod input;
  4. mod number;
  5. mod password;
  6. mod slider;
  7. mod textbox;
  8. use dioxus_core::{RenderReturn, Scope};
  9. use dioxus_native_core::NodeId;
  10. pub use input::*;
  11. use crate::DioxusElementToNodeId;
  12. pub(crate) fn get_root_id<T>(cx: Scope<T>) -> Option<NodeId> {
  13. if let RenderReturn::Ready(sync) = cx.root_node() {
  14. let mapping: DioxusElementToNodeId = cx.consume_context()?;
  15. mapping.get_node_id(sync.root_ids.get(0)?)
  16. } else {
  17. None
  18. }
  19. }