Skip to content

Commit e622a2a

Browse files
authored
Fix: incorrect apply style order (#795)
* Fix styles * fmt
1 parent 00f86ec commit e622a2a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/view_state.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ impl ViewState {
255255
computed_style.clear();
256256
// we will apply the views style to the context so that if a style class is used on a view, that class will be directly applied instead of only applying to children
257257
let mut context = context.clone();
258+
if let Some(view_class) = view_class {
259+
computed_style = computed_style.apply_classes_from_context(&[view_class], &context);
260+
}
261+
computed_style = computed_style.apply_classes_from_context(&self.classes, &context);
262+
258263
if let Some(view_style) = view_style {
259264
context.apply_mut(view_style.clone());
260265
computed_style.apply_mut(view_style);
@@ -263,10 +268,6 @@ impl ViewState {
263268
let self_style = self.style();
264269
context.apply_mut(self_style.clone());
265270
computed_style.apply_mut(self_style);
266-
if let Some(view_class) = view_class {
267-
computed_style = computed_style.apply_classes_from_context(&[view_class], &context);
268-
}
269-
computed_style = computed_style.apply_classes_from_context(&self.classes, &context);
270271

271272
self.has_style_selectors = computed_style.selectors();
272273

0 commit comments

Comments
 (0)