Skip to content

Commit

Permalink
1. Add default styles to several views.
Browse files Browse the repository at this point in the history
  • Loading branch information
jm-observer committed Feb 8, 2025
1 parent a49bc20 commit e4bce09
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/views/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ impl View for Container {
self.id
}

fn view_style(&self) -> Option<crate::style::Style> {
Some(crate::style::Style::new().pointer_events_auto())
}

fn debug_name(&self) -> std::borrow::Cow<'static, str> {
"Container".into()
}
Expand Down
7 changes: 5 additions & 2 deletions src/views/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ impl View for Stack {
}

fn view_style(&self) -> Option<crate::style::Style> {
self.direction
.map(|direction| Style::new().flex_direction(direction))
Some(if let Some(direction) = self.direction {
Style::new().flex_direction(direction).pointer_events_auto()
} else {
Style::new().pointer_events_auto()
})
}

fn debug_name(&self) -> std::borrow::Cow<'static, str> {
Expand Down
4 changes: 4 additions & 0 deletions src/views/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ impl View for Svg {
self.id
}

fn view_style(&self) -> Option<crate::style::Style> {
Some(crate::style::Style::new().pointer_events_auto())
}

fn style_pass(&mut self, cx: &mut crate::context::StyleCx<'_>) {
self.svg_style.read(cx);
}
Expand Down

0 comments on commit e4bce09

Please sign in to comment.